procedure start;
procedure combat;
procedure critter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure goto00;
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 goto16b;
procedure goto17;
procedure goto18;
procedure goto19;
procedure goto20;
procedure goto20b;
procedure goto21;
procedure anger;
procedure gotoend;
procedure gotostory;
variable hostile;
variable item;
variable Pick;
variable only_once := 1;
variable message;
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, 63);
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 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
call get_reaction;
start_gdialog(319, self_obj, 4, -1, -1);
gsay_start;
if (local_var(4)) then begin
if (local_var(1) < 2) then begin
call goto20;
end
else begin
call goto16;
end
end
else begin
set_local_var(4, 1);
if (map_var(0) == 1) then begin
call goto14;
end
else begin
call goto00;
end
end
gsay_end;
end_dialogue;
end
procedure destroy_p_proc
begin
set_global_var(250, 1);
rm_timer_event(self_obj);
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;
display_msg(message_str(319, 100));
end
procedure goto00
begin
gsay_reply(319, 301);
giq_option(-3, 319, 302, goto01, 50);
giq_option(4, 319, 303, goto02, 50);
giq_option(4, 319, 304, goto03, 50);
giq_option(4, 319, 305, goto02, 50);
giq_option(4, 319, 306, anger, 51);
end
procedure goto01
begin
gsay_message(319, 307, 51);
end
procedure goto02
begin
gsay_reply(319, 308);
if (global_var(30) != 1) then begin
giq_option(4, 319, 309, goto04, 50);
end
giq_option(4, 319, 310, goto05, 50);
giq_option(4, 319, 311, goto06, 50);
giq_option(4, 319, 312, gotoend, 50);
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
giq_option(4, 319, 313, anger, 51);
end
end
procedure goto03
begin
gsay_reply(319, 314);
giq_option(4, 319, 315, gotoend, 50);
giq_option(4, 319, 316, goto07, 50);
end
procedure goto04
begin
gsay_reply(319, 317);
giq_option(4, 319, 318, goto07, 50);
giq_option(4, 319, 319, goto06, 50);
giq_option(4, 319, 320, anger, 51);
giq_option(4, 319, 321, gotoend, 50);
end
procedure goto05
begin
gsay_reply(319, 322);
giq_option(4, 319, 323, gotoend, 50);
giq_option(4, 319, 324, goto08, 50);
giq_option(4, 319, 325, goto09, 50);
end
procedure goto06
begin
gsay_reply(319, 326);
giq_option(4, 319, 327, goto11, 50);
giq_option(4, 319, 328, goto11, 50);
if (local_var(6) != 1) then begin
giq_option(4, 319, 329, goto12, 50);
end
giq_option(4, 319, 330, goto07, 50);
end
procedure goto07
begin
gsay_reply(319, 331);
if (local_var(6) != 1) then begin
giq_option(4, 319, 332, goto12, 50);
end
giq_option(4, 319, 333, goto09, 50);
if (((global_var(160) + global_var(159)) >= 25) and ((global_var(159) > (2 * global_var(160))) or (global_var(156) == 1))) then begin
giq_option(4, 319, 334, goto01, 51);
end
giq_option(4, 319, 335, goto05, 50);
end
procedure goto08
begin
gsay_message(319, 336, 50);
end
procedure goto09
begin
gsay_reply(319, 337);
if (local_var(6) != 1) then begin
giq_option(4, 319, 338, goto12, 49);
end
giq_option(4, 319, 339, DownReact, 51);
giq_option(4, 319, 341, goto01, 51);
giq_option(4, 319, 342, goto10, 50);
end
procedure goto10
begin
gsay_message(319, 343, 50);
end
procedure goto11
begin
gsay_reply(319, 344);
giq_option(4, 319, 345, gotoend, 50);
giq_option(4, 319, 346, goto13, 50);
giq_option(4, 319, 347, DownReact, 51);
end
procedure goto12
begin
set_local_var(6, 1);
item := create_object_sid(215, 0, 0, -1);
add_obj_to_inven(dude_obj, item);
gsay_reply(319, 348);
giq_option(4, 319, 349, gotoend, 50);
giq_option(4, 319, 350, DownReact, 51);
end
procedure goto13
begin
gsay_reply(319, 351);
if (local_var(6) != 1) then begin
giq_option(4, 319, 352, goto12, 49);
end
giq_option(4, 319, 349, gotoend, 50);
giq_option(4, 319, 353, anger, 51);
end
procedure goto14
begin
gsay_reply(319, 301);
giq_option(-3, 319, 302, goto01, 50);
giq_option(4, 319, 303, goto02, 50);
giq_option(4, 319, 330, goto15, 50);
giq_option(4, 319, 306, anger, 51);
end
procedure goto15
begin
gsay_reply(319, 359);
giq_option(4, 319, 360, goto07, 50);
giq_option(4, 319, 361, anger, 51);
giq_option(4, 319, 362, DownReact, 51);
end
procedure goto16
begin
gsay_reply(319, 364);
giq_option(4, 319, 365, goto17, 50);
giq_option(4, 319, 366, goto16b, 50);
giq_option(4, 319, 367, gotoend, 50);
giq_option(-3, 319, 302, goto01, 50);
end
procedure goto16b
begin
if (local_var(6) != 1) then begin
call goto12;
end
else begin
call goto18;
end
end
procedure goto17
begin
gsay_reply(319, 368);
giq_option(4, 319, 369, gotoend, 50);
giq_option(4, 319, 316, goto07, 50);
end
procedure goto18
begin
gsay_reply(319, 374);
giq_option(4, 319, 369, gotoend, 50);
giq_option(4, 319, 350, DownReact, 51);
end
procedure goto19
begin
gsay_reply(319, 374);
giq_option(4, 319, 369, gotoend, 50);
giq_option(4, 319, 350, DownReact, 51);
end
procedure goto20
begin
gsay_reply(319, 377);
giq_option(4, 319, 378, gotoend, 50);
giq_option(4, 319, 379, goto20b, 49);
giq_option(-3, 319, 302, goto01, 50);
end
procedure goto20b
begin
if (is_success(roll_vs_skill(dude_obj, 14, -10))) then begin
call goto21;
end
else begin
call goto01;
end
end
procedure goto21
begin
call UpReact;
gsay_reply(319, 380);
giq_option(4, 319, 381, goto17, 50);
giq_option(4, 319, 382, goto16b, 50);
giq_option(4, 319, 383, gotoend, 50);
end
procedure anger
begin
call DownReact;
call goto01;
end
procedure gotoend
begin
end
procedure gotostory
begin
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