procedure start;
procedure combat_p_proc;
procedure critter_p_proc;
procedure destroy_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure GenPalB00;
procedure GenPalB01;
procedure GenPalB02;
procedure GenPalB03;
procedure GenPalB04;
procedure GenPalB05;
procedure GenPalB06;
procedure GenPalB07;
procedure GenPalB08;
procedure GenPalB09;
procedure GenPalB10;
procedure GenPalB10a;
procedure GenPalB11;
procedure GenPalB12;
procedure GenPalB13;
procedure GenPalB14;
procedure GenPalB15;
procedure GenPalB16;
procedure GenPalB17;
procedure GenPalB18;
procedure GenPalB19;
procedure GenPalB20;
procedure GenPalB20a;
procedure GenPalB21;
procedure GenPalB22;
procedure GenPalB23;
procedure GenPalB24;
procedure GenPalB25;
procedure flee_dude;
variable annoyed;
variable hostile;
variable initialized;
variable known;
variable round_counter;
variable scared;
import variable random_seed_1;
procedure start
begin
if (not(initialized)) then begin
critter_add_trait(self_obj, 1, 6, 44);
critter_add_trait(self_obj, 1, 5, 65);
hostile := global_var(334);
initialized := 1;
end
else begin
if (script_action == 13) then begin
call combat_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
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
end
end
end
end
end
end
procedure combat_p_proc
begin
if (fixed_param == 4) then begin
round_counter := round_counter + 1;
if (get_critter_stat(self_obj, 35) < 10) then begin
scared := 1;
end
end
end
procedure critter_p_proc
begin
if (scared) then begin
if (tile_distance_objs(self_obj, dude_obj) < 8) then begin
call flee_dude;
end
end
else begin
if (hostile) then begin
hostile := 0;
random_seed_1 := 1;
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
end
end
procedure destroy_p_proc
begin
if (source_obj == dude_obj) then begin
random_seed_1 := 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
set_global_var(250, 1);
end
end
procedure pickup_p_proc
begin
if (not(scared)) then begin
hostile := 1;
set_global_var(334, 1);
end
end
procedure talk_p_proc
begin
if (known) then begin
if (annoyed) then begin
call GenPalB23;
end
else begin
start_gdialog(759, self_obj, 4, -1, -1);
gsay_start;
call GenPalB24;
gsay_end;
end_dialogue;
end
end
else begin
if (scared) then begin
call GenPalB01;
end
else begin
if ((random_seed_1 == 1) or (global_var(250) == 1)) then begin
call GenPalB00;
end
else begin
start_gdialog(759, self_obj, 4, -1, -1);
gsay_start;
if (global_var(45) == 2) then begin
call GenPalB02;
end
else begin
if (global_var(74) >= 1) then begin
if (global_var(155) >= 20) then begin
call GenPalB03;
end
else begin
call GenPalB04;
end
end
else begin
if ((global_var(155) < 20) or (((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
call GenPalB06;
end
else begin
call GenPalB05;
end
end
end
gsay_end;
end_dialogue;
end
end
end
end
procedure GenPalB00
begin
float_msg(self_obj, message_str(759, 100), 2);
hostile := 1;
set_global_var(334, 1);
end
procedure GenPalB01
begin
float_msg(self_obj, message_str(759, 101), 2);
end
procedure GenPalB02
begin
known := 1;
gsay_reply(759, 102);
giq_option(7, 759, 103, GenPalB07, 50);
giq_option(4, 759, 104, GenPalB08, 50);
giq_option(4, 759, 105, GenPalB09, 50);
giq_option(4, 759, 106, GenPalB10, 50);
giq_option(-3, 759, 107, GenPalB11, 50);
end
procedure GenPalB03
begin
known := 1;
gsay_reply(759, 108);
giq_option(7, 759, 109, GenPalB12, 50);
giq_option(4, 759, 110, GenPalB13, 50);
giq_option(4, 759, 111, GenPalB14, 50);
giq_option(4, 759, 112, GenPalB15, 50);
giq_option(4, 759, 113, GenPalB16, 50);
giq_option(-3, 759, 114, GenPalB11, 50);
end
procedure GenPalB04
begin
known := 1;
annoyed := 1;
gsay_message(759, 115, 51);
end
procedure GenPalB05
begin
known := 1;
gsay_reply(759, 116);
if ((global_var(101) == 0) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 759, message_str(759, 117) + proto_data(obj_pid(dude_obj), 1) + message_str(759, 118), GenPalB17, 50);
end
giq_option(4, 759, message_str(759, 117) + proto_data(obj_pid(dude_obj), 1) + message_str(759, 119), GenPalB18, 50);
giq_option(4, 759, message_str(759, 117) + proto_data(obj_pid(dude_obj), 1) + message_str(759, 120), GenPalB19, 50);
giq_option(4, 759, message_str(759, 117) + proto_data(obj_pid(dude_obj), 1) + message_str(759, 121), GenPalB21, 50);
giq_option(4, 759, 122, GenPalB21, 51);
giq_option(-3, 759, 123, GenPalB22, 50);
end
procedure GenPalB06
begin
known := 1;
annoyed := 1;
gsay_message(759, 124, 51);
end
procedure GenPalB07
begin
gsay_message(759, 125, 50);
end
procedure GenPalB08
begin
gsay_message(759, 126, 50);
end
procedure GenPalB09
begin
gsay_message(759, 127, 50);
end
procedure GenPalB10
begin
gsay_reply(759, 128);
giq_option(0, 634, 106, GenPalB10a, 50);
end
procedure GenPalB10a
begin
gsay_message(759, 129, 50);
end
procedure GenPalB11
begin
gsay_message(759, 130, 50);
end
procedure GenPalB12
begin
gsay_reply(759, 131);
if ((global_var(101) == 0) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 759, 132, GenPalB17, 50);
end
giq_option(4, 759, 133, GenPalB18, 50);
giq_option(4, 759, 134, GenPalB19, 50);
giq_option(4, 759, 135, GenPalB20, 50);
giq_option(4, 759, 122, GenPalB21, 50);
end
procedure GenPalB13
begin
known := 1;
annoyed := 1;
gsay_message(759, 136, 51);
end
procedure GenPalB14
begin
gsay_message(759, 137, 50);
end
procedure GenPalB15
begin
gsay_message(759, 138, 50);
end
procedure GenPalB16
begin
gsay_message(759, 139, 50);
gfade_out(600);
game_time_advance(game_ticks(random(86400, 172800)));
load_map(13, 0);
gfade_in(600);
end
procedure GenPalB17
begin
gsay_message(759, 140, 50);
end
procedure GenPalB18
begin
gsay_message(759, 141, 50);
end
procedure GenPalB19
begin
annoyed := 1;
gsay_message(759, 142, 51);
end
procedure GenPalB20
begin
gsay_reply(759, 143);
giq_option(0, 634, 106, GenPalB20a, 50);
end
procedure GenPalB20a
begin
gsay_message(759, 144, 50);
end
procedure GenPalB21
begin
hostile := 1;
set_global_var(334, 1);
if (get_critter_stat(dude_obj, 34) == 0) then begin
gsay_message(759, 145, 51);
end
else begin
gsay_message(759, 146, 51);
end
end
procedure GenPalB22
begin
gsay_message(759, 147, 50);
end
procedure GenPalB23
begin
float_msg(self_obj, message_str(759, 148), 2);
end
procedure GenPalB24
begin
gsay_reply(759, 149);
if ((global_var(101) == 0) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 759, 132, GenPalB17, 50);
end
giq_option(4, 759, 133, GenPalB18, 50);
giq_option(4, 759, 150, GenPalB25, 50);
giq_option(4, 759, 135, GenPalB20, 50);
giq_option(4, 759, 122, GenPalB21, 51);
end
procedure GenPalB25
begin
annoyed := 1;
gsay_message(759, 151, 51);
end
procedure flee_dude
begin
variable LVar0 := 0;
variable LVar1 := 0;
variable LVar2 := 0;
while(LVar1 < 5) do begin
if (tile_distance(tile_num(dude_obj), tile_num_in_direction(tile_num(self_obj), LVar1, 3)) > LVar2) then begin
LVar0 := tile_num_in_direction(tile_num(self_obj), LVar1, 3);
LVar2 := tile_distance(tile_num(dude_obj), LVar0);
end
LVar1 := LVar1 + 1;
end
animate_move_obj_to_tile(self_obj, LVar0, 1);
end