procedure start;
procedure do_dialogue;
procedure goto01;
procedure goto02;
procedure goto03;
procedure goto04;
procedure goto05;
procedure goto06;
procedure goto07;
procedure goto08;
procedure goto09;
procedure goto10;
procedure goto11;
procedure goto12;
procedure goto13;
procedure goto14;
procedure goto15;
procedure goto16;
procedure goto17;
procedure goto18;
procedure goto19;
procedure goto20;
procedure goto21;
procedure goto22;
procedure goto23;
procedure goto24;
procedure goto24a;
procedure goto25;
procedure goto26;
procedure goto27;
procedure goto75;
procedure gotoend;
procedure gotopart;
procedure combat;
procedure critter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure smalltalk;
procedure pre_dialogue;
variable known;
variable only_once := 1;
variable hostile;
variable radx;
variable ccount;
variable loot;
variable stuff;
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 (only_once) then begin
only_once := 0;
critter_add_trait(self_obj, 1, 6, 44);
critter_add_trait(self_obj, 1, 5, 64);
end
if (script_action == 21) then begin
call look_at_p_proc;
end
else begin
if (script_action == 4) then begin
call pickup_p_proc;
end
else begin
if (script_action == 11) then begin
call talk_p_proc;
end
else begin
if (script_action == 12) then begin
call critter_p_proc;
end
else begin
if (script_action == 18) then begin
call destroy_p_proc;
end
end
end
end
end
end
procedure do_dialogue
begin
display_msg("in do_dialogue");
call get_reaction;
start_gdialog(845, self_obj, 4, -1, -1);
gsay_start;
if (local_var(4) == 0) then begin
set_local_var(4, 1);
call goto01;
end
else begin
if (global_var(304) == 2) then begin
call goto26;
end
else begin
if (global_var(304) == 3) then begin
call goto26;
end
else begin
if (obj_carrying_pid_obj(dude_obj, 229)) then begin
call goto23;
end
else begin
if (global_var(304)) then begin
call goto17;
end
else begin
call goto27;
end
end
end
end
end
gsay_end;
end_dialogue;
end
procedure goto01
begin
gsay_reply(845, 102);
giq_option(-3, 845, 103, goto02, 50);
giq_option(4, 845, 103, goto02, 50);
giq_option(4, 845, 104, goto13, 50);
end
procedure goto02
begin
gsay_reply(845, 105);
giq_option(4, 845, 106, goto04, 50);
giq_option(4, 845, 107, goto03, 50);
giq_option(4, 845, 108, goto14, 50);
giq_option(-3, 845, 103, gotoend, 50);
end
procedure goto03
begin
gsay_reply(845, 109);
giq_option(4, 845, 110, goto04, 50);
giq_option(4, 845, 111, goto06, 50);
giq_option(4, 845, 112, goto09, 51);
end
procedure goto04
begin
gsay_reply(845, 113);
if (global_var(30) != 1) then begin
giq_option(4, 845, 114, goto12, 50);
end
giq_option(4, 845, 115, goto05, 50);
giq_option(4, 845, 116, gotoend, 50);
end
procedure goto05
begin
gsay_reply(845, 117);
giq_option(4, 845, 118, goto06, 50);
if (global_var(30) != 1) then begin
giq_option(4, 845, 114, goto12, 50);
end
end
procedure goto06
begin
gsay_reply(845, 119);
giq_option(4, 845, 120, goto07, 50);
giq_option(4, 845, 121, gotoend, 50);
end
procedure goto07
begin
gsay_reply(845, 122);
giq_option(4, 845, 123, goto08, 50);
giq_option(4, 845, 124, goto10, 50);
end
procedure goto08
begin
gsay_reply(845, 125);
giq_option(4, 845, 124, goto10, 50);
giq_option(4, 845, 126, goto09, 51);
end
procedure goto09
begin
call BottomReact;
gsay_message(845, 127, 51);
end
procedure goto10
begin
gsay_reply(845, 128);
giq_option(4, 845, 129, goto11, 50);
giq_option(4, 845, 130, gotopart, 50);
end
procedure goto11
begin
gsay_reply(845, 131);
giq_option(4, 845, 132, gotopart, 50);
end
procedure goto12
begin
gsay_reply(845, 133);
giq_option(4, 845, 134, gotoend, 50);
giq_option(4, 845, 135, goto09, 51);
giq_option(4, 845, 136, goto06, 50);
end
procedure goto13
begin
gsay_reply(845, 137);
giq_option(4, 845, 138, goto02, 50);
giq_option(4, 845, 139, goto04, 51);
giq_option(4, 845, 140, gotoend, 50);
end
procedure goto14
begin
gsay_reply(845, 141);
giq_option(4, 845, 142, goto15, 50);
end
procedure goto15
begin
gsay_reply(845, 143);
giq_option(4, 845, message_str(845, 144) + proto_data(obj_pid(dude_obj), 1) + message_str(845, 145), goto13, 50);
giq_option(4, 845, 146, goto16, 50);
end
procedure goto16
begin
gsay_reply(845, 147);
giq_option(4, 845, 148, goto06, 50);
end
procedure goto17
begin
gsay_reply(845, 149);
giq_option(4, 845, 150, goto18, 50);
giq_option(4, 845, 151, gotoend, 50);
giq_option(4, 845, 152, gotoend, 50);
giq_option(-3, 845, 103, gotoend, 50);
end
procedure goto18
begin
gsay_reply(845, 153);
giq_option(4, 845, 154, goto09, 51);
giq_option(4, 845, 155, goto19, 50);
giq_option(4, 845, 156, goto11, 50);
giq_option(4, 845, 157, gotoend, 50);
end
procedure goto19
begin
gsay_reply(845, 158);
giq_option(4, 845, 159, gotoend, 50);
giq_option(4, 845, 160, goto11, 50);
end
procedure goto20
begin
end
procedure goto21
begin
float_msg(self_obj, message_str(845, 161), 2);
end
procedure goto22
begin
float_msg(self_obj, message_str(845, 162), 2);
end
procedure goto23
begin
loot := 0;
gsay_reply(845, 163);
loot := obj_carrying_pid_obj(dude_obj, 229);
if (loot) then begin
giq_option(4, 845, 164, goto24, 50);
end
giq_option(4, 845, 165, goto25, 50);
giq_option(-3, 845, 103, gotoend, 50);
end
procedure goto24
begin
rm_obj_from_inven(dude_obj, loot);
gsay_reply(845, 166);
giq_option(4, 845, 300, goto24a, 50);
end
procedure goto24a
begin
gfade_out(600);
gfade_in(600);
stuff := create_object_sid(76, 0, 0, -1);
add_obj_to_inven(dude_obj, stuff);
set_global_var(304, 2);
gsay_message(845, 167, 50);
end
procedure goto25
begin
gsay_message(845, 168, 50);
end
procedure goto26
begin
gsay_reply(845, 169);
giq_option(4, 845, 170, gotoend, 50);
giq_option(-3, 845, 103, gotoend, 50);
end
procedure goto27
begin
gsay_reply(845, 171);
giq_option(4, 845, 106, goto04, 50);
giq_option(4, 845, 104, goto13, 50);
giq_option(-3, 845, 103, gotoend, 50);
end
procedure goto75
begin
end
procedure gotoend
begin
end
procedure gotopart
begin
set_global_var(304, 1);
end
procedure combat
begin
hostile := 1;
end
procedure critter_p_proc
begin
if (global_var(250)) then begin
hostile := 1;
end
if (tile_distance_objs(self_obj, dude_obj) > 12) then begin
hostile := 0;
end
if (hostile) then begin
set_global_var(250, 1);
hostile := 0;
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
end
procedure pickup_p_proc
begin
if (source_obj == dude_obj) then begin
hostile := 1;
end
end
procedure talk_p_proc
begin
debug_msg("global_var(PART_RUN) == " + global_var(304));
if (global_var(304) == 4) then begin
call smalltalk;
end
else begin
if ((local_var(4) == 1) and (local_var(1) < 2)) then begin
call goto22;
end
else begin
call get_reaction;
start_gdialog(845, self_obj, 4, -1, -1);
gsay_start;
if (local_var(4) == 0) then begin
set_local_var(4, 1);
call goto01;
end
else begin
if (global_var(304) == 2) then begin
call goto26;
end
else begin
if (global_var(304) == 3) then begin
call goto26;
end
else begin
if (obj_carrying_pid_obj(dude_obj, 229)) then begin
call goto23;
end
else begin
if (global_var(304)) then begin
call goto17;
end
else begin
call goto27;
end
end
end
end
end
gsay_end;
end_dialogue;
end
end
end
procedure destroy_p_proc
begin
set_global_var(250, 1);
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 look_at_p_proc
begin
script_overrides;
if (known) then begin
display_msg(message_str(845, 100));
end
else begin
display_msg(message_str(845, 101));
end
end
procedure smalltalk
begin
ccount := ccount + 1;
if (ccount < 6) then begin
float_msg(self_obj, message_str(723, 200 + random(0, 2)), 2);
end
else begin
if (ccount < 9) then begin
float_msg(self_obj, message_str(723, 203 + random(0, 4)), 2);
end
else begin
if (ccount < 12) then begin
float_msg(self_obj, message_str(723, 209 + random(0, 3)), 2);
end
else begin
display_msg(message_str(723, 213));
end
end
end
end
procedure pre_dialogue
begin
display_msg("in pre_dialogue");
if (global_var(304) == 4) then begin
call smalltalk;
end
else begin
if ((local_var(4) == 1) and (local_var(1) < 2)) then begin
call goto22;
end
else begin
call do_dialogue;
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(157) == 1))) then begin
set_local_var(0, local_var(0) + 20);
end
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
set_local_var(0, local_var(0) - 20);
end
call ReactToLevel;
end
end
procedure ReactToLevel
begin
if (local_var(0) <= 25) then begin
set_local_var(1, 1);
end
else begin
if (local_var(0) <= 75) then begin
set_local_var(1, 2);
end
else begin
set_local_var(1, 3);
end
end
end
procedure LevelToReact
begin
if (local_var(1) == 1) then begin
set_local_var(0, random(1, 25));
end
else begin
if (local_var(1) == 2) then begin
set_local_var(0, random(26, 75));
end
else begin
set_local_var(0, random(76, 100));
end
end
end
procedure UpReact
begin
set_local_var(0, local_var(0) + 10);
call ReactToLevel;
end
procedure DownReact
begin
set_local_var(0, local_var(0) - 10);
call ReactToLevel;
end
procedure BottomReact
begin
set_local_var(1, 1);
set_local_var(0, 1);
end
procedure TopReact
begin
set_local_var(0, 100);
set_local_var(1, 3);
end
procedure BigUpReact
begin
set_local_var(0, local_var(0) + 25);
call ReactToLevel;
end
procedure BigDownReact
begin
set_local_var(0, local_var(0) - 25);
call ReactToLevel;
end
procedure UpReactLevel
begin
set_local_var(1, local_var(1) + 1);
if (local_var(1) > 3) then begin
set_local_var(1, 3);
end
call LevelToReact;
end
procedure DownReactLevel
begin
set_local_var(1, local_var(1) - 1);
if (local_var(1) < 1) then begin
set_local_var(1, 1);
end
call LevelToReact;
end
procedure Goodbyes
begin
exit_line := message_str(634, random(100, 105));
end