procedure start;
procedure combat_p_proc;
procedure map_update_p_proc;
procedure talk_p_proc;
procedure razlo00;
procedure razlo00a;
procedure razlo01;
procedure razlo02;
procedure razlo03;
procedure razlo04;
procedure razlo05;
procedure razlo06;
procedure razlo06na;
procedure razlo06nb;
procedure razlo07;
procedure razlo08;
procedure razlo09;
procedure razlo10;
procedure razlo11;
procedure razlo12;
procedure razlo14;
procedure razlo15;
procedure Razlo17;
procedure razlo18;
procedure razlo19;
procedure razlo20;
procedure razlo21;
procedure razlo22;
procedure razlo23;
procedure razlo23a;
procedure razlo24;
procedure razlo25;
procedure razlo26;
procedure razlo27;
procedure razlo27a;
procedure razlo28;
procedure razlo29;
procedure razlo30;
procedure razlo31;
procedure razlo00n;
procedure razlo01n;
procedure razlo02n;
procedure razlo03n;
procedure razlo04n;
procedure razlo05n;
procedure razlo06n;
procedure razlo07n;
procedure razlo08n;
procedure razlo09n;
procedure razlo10n;
procedure razlo11n;
procedure razlo14n;
procedure razlo15n;
procedure razlo16n;
procedure razlowmpa;
procedure razlowmpb;
procedure razlofixa;
procedure razlofixb;
procedure razlofixc;
procedure razlox;
procedure razloend;
procedure givestuff;
procedure remove_items;
procedure critter_p_proc;
procedure look_at_p_proc;
procedure destroy_p_proc;
procedure pickup_p_proc;
procedure sleeping;
variable night_person;
variable wake_time;
variable sleep_time;
variable home_tile;
variable sleep_tile;
variable STIM;
variable FRUIT;
variable damage;
variable HOSTILE;
variable heal;
variable COST;
variable BONUS;
variable NIGHT;
variable round_counter;
variable dummyvar;
variable MONEY;
variable MAX_HITS;
variable HITS;
variable initialized;
variable tail;
procedure get_reaction;
procedure ReactToLevel;
procedure LevelToReact;
procedure UpReact;
procedure DownReact;
procedure BottomReact;
procedure TopReact;
procedure BigUpReact;
procedure BigDownReact;
procedure UpReactLevel;
procedure DownReactLevel;
procedure Goodbyes;
variable exit_line;
procedure start
begin
if (script_action == 13) then begin
call combat_p_proc;
end
else begin
if (script_action == 23) then begin
call map_update_p_proc;
end
else begin
if (script_action == 11) then begin
call talk_p_proc;
end
else begin
if (script_action == 4) then begin
call pickup_p_proc;
end
else begin
if (script_action == 12) then begin
call critter_p_proc;
end
else begin
if (script_action == 21) then begin
call look_at_p_proc;
end
else begin
if (script_action == 18) then begin
call destroy_p_proc;
end
end
end
end
end
end
end
end
procedure combat_p_proc
begin
if (fixed_param == 4) then begin
round_counter := round_counter + 1;
end
if (round_counter > 3) then begin
if (global_var(246) == 0) then begin
set_global_var(246, 1);
set_global_var(155, global_var(155) - 5);
end
end
end
procedure map_update_p_proc
begin
if (not(initialized)) then begin
critter_add_trait(self_obj, 1, 6, 2);
critter_add_trait(self_obj, 1, 5, 6);
home_tile := 24529;
sleep_tile := 23133;
wake_time := 630;
sleep_time := 2230;
initialized := 0;
end
end
procedure talk_p_proc
begin
MAX_HITS := get_critter_stat(dude_obj, 7);
HITS := get_critter_stat(dude_obj, 35);
call get_reaction;
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
set_global_var(156, 1);
set_global_var(157, 0);
end
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(160) > (3 * global_var(159))) or (global_var(157) == 1))) then begin
set_global_var(157, 1);
set_global_var(156, 0);
end
if (local_var(9) == 1) then begin
float_msg(self_obj, message_str(185, 166), 0);
end
else begin
if ((game_time_hour >= 1900) or (game_time_hour < 600)) then begin
set_local_var(6, 1);
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo00n;
gsay_end;
end_dialogue;
end
else begin
if (global_var(43) == 1) then begin
if ((global_var(26) == 1) and (local_var(4) == 0) and (global_var(218) == 1)) then begin
set_local_var(4, 1);
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo01;
gsay_end;
end_dialogue;
end
else begin
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo23;
gsay_end;
end_dialogue;
end
end
else begin
if (obj_is_carrying_obj_pid(dude_obj, 92)) then begin
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo23;
gsay_end;
end_dialogue;
end
else begin
if ((local_var(6) == 0) and (local_var(1) >= 2)) then begin
set_local_var(6, 1);
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo10;
gsay_end;
end_dialogue;
end
else begin
if (local_var(6) == 0) then begin
set_local_var(6, 1);
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo18;
gsay_end;
end_dialogue;
end
else begin
if (global_var(26) == 3) then begin
call razlo09;
end
else begin
if ((global_var(26) == 2) and (local_var(5) == 0)) then begin
set_local_var(5, 1);
call razlo08;
end
else begin
if ((global_var(26) == 1) and (local_var(4) == 0) and (global_var(218) == 1)) then begin
set_local_var(4, 1);
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo01;
gsay_end;
end_dialogue;
end
else begin
if ((global_var(26) == 1) and (global_var(218) == 1) and (local_var(4) == 1)) then begin
set_local_var(4, 2);
call razlo07;
end
else begin
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1)) or (global_var(158) > 2)) then begin
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo00;
gsay_end;
end_dialogue;
display_msg(message_str(129, 103));
end
else begin
if (local_var(1) >= 2) then begin
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo19;
gsay_end;
end_dialogue;
end
else begin
start_gdialog(129, self_obj, 4, -1, -1);
gsay_start;
call razlo21;
gsay_end;
end_dialogue;
end
end
end
end
end
end
end
end
end
end
end
end
call remove_items;
end
procedure razlo00
begin
gsay_message(129, 101, 50);
end
procedure razlo00a
begin
display_msg(message_str(129, 103));
end
procedure razlo01
begin
gsay_reply(129, 104);
if ((global_var(26) == 1) and (global_var(218) == 1)) then begin
giq_option(4, 129, 105, razlo03, 50);
end
giq_option(4, 129, 143, razlo22, 50);
giq_option(4, 129, 144, razlo23a, 50);
giq_option(-3, 129, 106, razlo02, 50);
end
procedure razlo02
begin
gsay_message(129, 107, 50);
set_local_var(4, 1);
end
procedure razlo03
begin
set_local_var(4, 1);
gsay_reply(129, 108);
giq_option(5, 129, 110, razlo04, 50);
giq_option(4, 129, 109, razloend, 50);
giq_option(5, 129, 111, razloend, 50);
end
procedure razlo04
begin
gsay_reply(129, 112);
giq_option(4, 129, 113, razlo05, 50);
giq_option(4, 129, 114, razlo06, 50);
end
procedure razlo05
begin
gsay_message(129, 115, 50);
end
procedure razlo06
begin
gsay_message(129, 116, 50);
call givestuff;
end
procedure razlo06na
begin
gsay_message(129, 306, 50);
call razlo06nb;
end
procedure razlo06nb
begin
variable LVar0 := 0;
variable LVar1 := 0;
gsay_message(129, 307, 50);
LVar0 := create_object_sid(49, 0, 0, -1);
add_obj_to_inven(dude_obj, LVar0);
LVar1 := obj_carrying_pid_obj(dude_obj, 92);
rm_obj_from_inven(dude_obj, LVar1);
destroy_object(LVar1);
if (local_var(7) == 0) then begin
set_local_var(7, 1);
give_exp_points(250);
display_msg(message_str(129, 300));
end
gfade_out(400);
gfade_in(400);
game_time_advance(game_ticks(1200 * damage));
critter_heal(dude_obj, damage);
end
procedure razlo07
begin
float_msg(self_obj, message_str(129, 117), 2);
end
procedure razlo08
begin
float_msg(self_obj, message_str(129, 118), 7);
end
procedure razlo09
begin
float_msg(self_obj, message_str(129, 119), 12);
end
procedure razlo10
begin
gsay_reply(129, 120);
giq_option(4, 129, 122, razlo14, 50);
giq_option(4, 129, 144, razlo23a, 50);
giq_option(4, 129, 121, razloend, 50);
giq_option(-3, 129, 123, razlo11, 50);
end
procedure razlo11
begin
gsay_message(129, 124, 50);
damage := MAX_HITS - HITS;
if (damage > (MAX_HITS / 4)) then begin
call razlo14;
end
else begin
call razlo12;
end
end
procedure razlo12
begin
gsay_message(129, 125, 50);
end
procedure razlo14
begin
gsay_message(129, 126, 50);
damage := MAX_HITS - HITS;
if (damage < (MAX_HITS / 4)) then begin
call razlowmpa;
end
else begin
if (damage < (MAX_HITS / 2)) then begin
call razlofixa;
end
else begin
if (damage < (3 * MAX_HITS / 4)) then begin
call razlofixb;
end
else begin
call razlofixc;
end
end
end
end
procedure razlo15
begin
gsay_message(129, 127, 50);
end
procedure Razlo17
begin
variable LVar0 := 0;
if (damage < (MAX_HITS / 2)) then begin
LVar0 := create_object_sid(218, 0, 0, -1);
add_obj_to_inven(self_obj, LVar0);
end
else begin
if (damage < (3 * MAX_HITS / 4)) then begin
LVar0 := create_object_sid(219, 0, 0, -1);
add_obj_to_inven(self_obj, LVar0);
end
else begin
LVar0 := create_object_sid(220, 0, 0, -1);
add_obj_to_inven(self_obj, LVar0);
end
end
gdialog_mod_barter(0);
gsay_message(129, 126, 50);
call razlo08n;
end
procedure razlo18
begin
gsay_reply(129, 128);
giq_option(4, 129, 130, razlo14, 50);
giq_option(4, 129, 144, razlo23a, 50);
giq_option(5, 129, 129, razloend, 50);
end
procedure razlo19
begin
gsay_reply(129, 131);
giq_option(4, 129, 132, razlo20, 50);
giq_option(4, 129, 143, razlo22, 50);
giq_option(4, 129, 144, razlo23a, 50);
giq_option(-3, 129, 134, razlo11, 50);
end
procedure razlo20
begin
gsay_message(129, 135, 50);
end
procedure razlo21
begin
gsay_reply(129, 136);
giq_option(4, 129, 138, razlo22, 50);
giq_option(4, 129, 144, razlo23a, 50);
giq_option(-3, 129, 139, razlo11, 50);
giq_option(4, 129, 137, razloend, 50);
end
procedure razlo22
begin
gsay_message(129, 140, 50);
call razlo14;
end
procedure razlo23
begin
gsay_reply(129, 141);
giq_option(4, 129, 143, razlo22, 50);
giq_option(4, 129, 144, razlo23a, 50);
giq_option(5, 129, 145, razlo27, 50);
if (obj_is_carrying_obj_pid(dude_obj, 92)) then begin
giq_option(4, 129, 146, razlo30, 50);
giq_option(-3, 129, 303, razlo30, 50);
end
giq_option(4, 129, 142, razloend, 50);
giq_option(-3, 129, 147, razlo11, 50);
end
procedure razlo23a
begin
if (local_var(8) == 1) then begin
call razlo25;
end
else begin
call razlo24;
end
end
procedure razlo24
begin
gsay_message(129, 148, 50);
end
procedure razlo25
begin
gsay_message(129, 149, 50);
if (get_poison(dude_obj) > 0) then begin
gsay_message(129, 150, 50);
poison(dude_obj, -get_poison(dude_obj));
call razlo26;
end
else begin
gsay_message(129, 151, 50);
end
poison(dude_obj, -get_poison(dude_obj));
end
procedure razlo26
begin
gsay_message(129, 152, 50);
end
procedure razlo27
begin
gsay_message(129, 153, 50);
gsay_reply(129, 154);
giq_option(5, 129, 156, razlo29, 50);
giq_option(5, 129, 157, razlo28, 50);
giq_option(4, 129, 155, razlo27a, 49);
end
procedure razlo27a
begin
call UpReact;
end
procedure razlo28
begin
gsay_reply(129, 158);
giq_option(5, 129, 159, razloend, 50);
end
procedure razlo29
begin
gsay_message(129, 160, 50);
end
procedure razlo30
begin
gsay_message(129, 161, 50);
gfade_out(400);
gfade_in(400);
game_time_advance(game_ticks(14400));
set_local_var(8, 1);
call razlo31;
end
procedure razlo31
begin
variable LVar0 := 0;
gsay_message(129, 162, 50);
LVar0 := create_object_sid(49, 0, 0, -1);
add_obj_to_inven(dude_obj, LVar0);
tail := obj_carrying_pid_obj(dude_obj, 92);
rm_obj_from_inven(dude_obj, tail);
destroy_object(tail);
if (local_var(7) == 0) then begin
set_local_var(7, 1);
give_exp_points(250);
display_msg(message_str(129, 300));
end
end
procedure razlo00n
begin
gsay_reply(129, 163);
giq_option(4, 129, 164, razlo02n, 50);
if (global_var(43) == 1) then begin
giq_option(5, 129, 165, razlo09n, 50);
end
if ((global_var(26) == 1) and (global_var(218) == 1)) then begin
giq_option(5, 129, 166, razlo15n, 50);
end
giq_option(-3, 129, 167, razlo01n, 50);
end
procedure razlo01n
begin
gsay_message(129, 168, 50);
call DownReact;
end
procedure razlo02n
begin
gsay_reply(129, 169);
giq_option(4, 129, 170, razlo04n, 50);
giq_option(4, 129, 171, razlo03n, 50);
end
procedure razlo03n
begin
gsay_message(129, 172, 50);
call DownReact;
end
procedure razlo04n
begin
gsay_reply(129, 173);
giq_option(4, 129, 174, razlo05n, 50);
end
procedure razlo05n
begin
damage := MAX_HITS - HITS;
if (damage < (MAX_HITS / 4)) then begin
call razlowmpb;
end
else begin
if (damage < (MAX_HITS / 2)) then begin
call razlofixa;
end
else begin
if (damage < (3 * MAX_HITS / 4)) then begin
call razlofixb;
end
else begin
call razlofixc;
end
end
end
end
procedure razlo06n
begin
gsay_reply(129, 186);
giq_option(4, 129, 187, Razlo17, 50);
if (obj_is_carrying_obj_pid(dude_obj, 92)) then begin
giq_option(4, 129, 305, razlo06na, 50);
giq_option(-3, 129, 303, razlo06na, 50);
end
giq_option(4, 129, 188, razloend, 50);
giq_option(-3, 129, 304, Razlo17, 50);
giq_option(-3, 129, 302, razloend, 50);
end
procedure razlo07n
begin
gsay_message(129, 189, 49);
end
procedure razlo08n
begin
if (obj_is_carrying_obj_pid(dude_obj, 218) or obj_is_carrying_obj_pid(dude_obj, 219) or obj_is_carrying_obj_pid(dude_obj, 220)) then begin
call razlo14n;
end
else begin
if (item_caps_total(dude_obj) >= COST) then begin
dummyvar := item_caps_adjust(dude_obj, -COST);
call razlo14n;
end
else begin
call razlo06n;
end
end
end
procedure razlo09n
begin
gsay_reply(129, 190);
giq_option(6, 129, 191, razlo10n, 50);
end
procedure razlo10n
begin
gsay_message(129, 192, 50);
end
procedure razlo11n
begin
gsay_reply(129, 108);
giq_option(5, 129, 194, razlo04, 50);
giq_option(5, 129, 195, razloend, 50);
end
procedure razlo14n
begin
gsay_message(129, 196, 50);
gfade_out(400);
gfade_in(400);
game_time_advance(game_ticks(1200 * damage));
critter_heal(dude_obj, damage);
end
procedure razlo15n
begin
if (local_var(11) == 1) then begin
call razlo16n;
end
else begin
set_local_var(11, 1);
call razlo11n;
end
end
procedure razlo16n
begin
gsay_message(129, 197, 50);
end
procedure razlowmpa
begin
gsay_message(129, 175, 50);
end
procedure razlowmpb
begin
gsay_message(129, 176, 50);
end
procedure razlofixa
begin
COST := 25;
gsay_reply(129, 177);
giq_option(4, 129, 178, razlo08n, 50);
giq_option(4, 129, 179, razlo06n, 50);
giq_option(-3, 129, 301, razlo08n, 50);
giq_option(-3, 129, 302, razloend, 50);
end
procedure razlofixb
begin
COST := 50;
gsay_reply(129, 180);
giq_option(4, 129, 181, razlo08n, 50);
giq_option(4, 129, 182, razlo06n, 50);
giq_option(-3, 129, 301, razlo08n, 50);
giq_option(-3, 129, 302, razloend, 50);
end
procedure razlofixc
begin
COST := 100;
gsay_reply(129, 183);
giq_option(4, 129, 184, razlo08n, 50);
giq_option(4, 129, 185, razlo06n, 50);
giq_option(-3, 129, 301, razlo08n, 50);
giq_option(-3, 129, 302, razloend, 50);
end
procedure razlox
begin
end
procedure razloend
begin
end
procedure givestuff
begin
variable LVar0 := 0;
LVar0 := create_object_sid(40, 0, 0, -1);
add_obj_to_inven(dude_obj, LVar0);
LVar0 := create_object_sid(40, 0, 0, -1);
add_obj_to_inven(dude_obj, LVar0);
LVar0 := create_object_sid(71, 0, 0, -1);
add_obj_to_inven(dude_obj, LVar0);
if (local_var(8) == 1) then begin
LVar0 := create_object_sid(49, 0, 0, -1);
add_obj_to_inven(dude_obj, LVar0);
end
end
procedure remove_items
begin
variable LVar0 := 0;
if (obj_is_carrying_obj_pid(dude_obj, 218)) then begin
LVar0 := obj_carrying_pid_obj(dude_obj, 218);
rm_obj_from_inven(dude_obj, LVar0);
destroy_object(LVar0);
end
if (obj_is_carrying_obj_pid(self_obj, 218)) then begin
LVar0 := obj_carrying_pid_obj(self_obj, 218);
rm_obj_from_inven(self_obj, LVar0);
destroy_object(LVar0);
end
if (obj_is_carrying_obj_pid(dude_obj, 219)) then begin
LVar0 := obj_carrying_pid_obj(dude_obj, 219);
rm_obj_from_inven(dude_obj, LVar0);
destroy_object(LVar0);
end
if (obj_is_carrying_obj_pid(self_obj, 219)) then begin
LVar0 := obj_carrying_pid_obj(self_obj, 219);
rm_obj_from_inven(self_obj, LVar0);
destroy_object(LVar0);
end
if (obj_is_carrying_obj_pid(dude_obj, 220)) then begin
LVar0 := obj_carrying_pid_obj(dude_obj, 220);
rm_obj_from_inven(dude_obj, LVar0);
destroy_object(LVar0);
end
if (obj_is_carrying_obj_pid(self_obj, 220)) then begin
LVar0 := obj_carrying_pid_obj(self_obj, 220);
rm_obj_from_inven(self_obj, LVar0);
destroy_object(LVar0);
end
end
procedure critter_p_proc
begin
if (map_var(2) == 1) then begin
set_local_var(10, local_var(10) + 1);
set_map_var(2, 0);
if (local_var(10) < 3) then begin
float_msg(self_obj, message_str(129, 308), 2);
end
else begin
HOSTILE := 1;
end
end
if (obj_can_see_obj(self_obj, dude_obj)) then begin
if (global_var(246) == 1) then begin
HOSTILE := 1;
end
end
if (HOSTILE) then begin
HOSTILE := 0;
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
end
procedure look_at_p_proc
begin
script_overrides;
display_msg(message_str(129, 100));
end
procedure destroy_p_proc
begin
if (source_obj == dude_obj) then begin
set_global_var(246, 1);
end
if (source_obj == dude_obj) then begin
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
set_global_var(156, 1);
set_global_var(157, 0);
end
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(160) > (3 * global_var(159))) or (global_var(157) == 1))) then begin
set_global_var(157, 1);
set_global_var(156, 0);
end
set_global_var(159, global_var(159) + 1);
if ((global_var(159) % 2) == 0) then begin
set_global_var(155, global_var(155) - 1);
end
end
end
procedure pickup_p_proc
begin
HOSTILE := 1;
end
procedure sleeping
begin
if (local_var(9) == 1) then begin
if (not(night_person) and (game_time_hour >= wake_time) and (game_time_hour < sleep_time) or (night_person and ((game_time_hour >= wake_time) or (game_time_hour < sleep_time)))) then begin
if (((game_time_hour - wake_time) < 10) and ((game_time_hour - wake_time) > 0)) then begin
if (tile_num(self_obj) != home_tile) then begin
animate_move_obj_to_tile(self_obj, home_tile, 0);
end
else begin
set_local_var(9, 0);
end
end
else begin
move_to(self_obj, home_tile, elevation(self_obj));
if (tile_num(self_obj) == home_tile) then begin
set_local_var(9, 0);
end
end
end
end
else begin
if (night_person and (game_time_hour >= sleep_time) and (game_time_hour < wake_time) or (not(night_person) and ((game_time_hour >= sleep_time) or (game_time_hour < wake_time)))) then begin
if (((game_time_hour - sleep_time) < 10) and ((game_time_hour - sleep_time) > 0)) then begin
if (tile_num(self_obj) != sleep_tile) then begin
animate_move_obj_to_tile(self_obj, self_obj, 0);
end
else begin
set_local_var(9, 1);
end
end
else begin
if (tile_num(self_obj) != sleep_tile) then begin
move_to(self_obj, sleep_tile, elevation(self_obj));
end
else begin
set_local_var(9, 1);
end
end
end
end
end
procedure get_reaction
begin
if (local_var(2) == 0) then begin
set_local_var(0, 50);
set_local_var(1, 2);
set_local_var(2, 1);
set_local_var(0, local_var(0) + (5 * get_critter_stat(dude_obj, 3)) - 25);
set_local_var(0, local_var(0) + (10 * has_trait(0, dude_obj, 10)));
if (has_trait(0, dude_obj, 39)) then begin
if (global_var(155) > 0) then begin
set_local_var(0, local_var(0) + global_var(155));
end
else begin
set_local_var(0, local_var(0) - global_var(155));
end
end
else begin
if (local_var(3) == 1) then begin
set_local_var(0, local_var(0) - global_var(155));
end
else begin
set_local_var(0, local_var(0) + global_var(155));
end
end
if (global_var(158) > 2) then begin
set_local_var(0, local_var(0) - 30);
end
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(160) > (3 * global_var(159))) or (global_var(1