procedure start;
procedure critter_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure flee_dude;
procedure Patrick01;
procedure Patrick02;
procedure Patrick03;
procedure Patrick04;
procedure Patrick05;
procedure Patrick06;
procedure Patrick06a;
procedure Patrick07;
procedure Patrick08;
procedure Patrick09;
procedure Patrick10;
procedure Patrick11;
procedure Patrick12;
procedure Patrick13;
procedure Patrick14;
procedure Patrick15;
procedure Patrick16;
procedure Patrick17;
procedure PatrickCombat;
procedure PatrickEnd;
variable hostile;
variable initialized;
variable known;
variable scared;
procedure start
begin
if (not(initialized)) then begin
critter_add_trait(self_obj, 1, 6, 87);
critter_add_trait(self_obj, 1, 5, 2);
initialized := 1;
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 == 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
end
end
end
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;
scared := 1;
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
end
end
procedure destroy_p_proc
begin
set_global_var(297, 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;
known := global_var(330);
if (known) then begin
display_msg(message_str(667, 101));
end
else begin
display_msg(message_str(667, 100));
end
end
procedure pickup_p_proc
begin
hostile := 1;
end
procedure talk_p_proc
begin
known := global_var(330);
if (scared) then begin
float_msg(self_obj, message_str(669, random(100, 105)), 2);
end
else begin
start_gdialog(667, self_obj, 4, -1, -1);
gsay_start;
if (known) then begin
call Patrick17;
end
else begin
call Patrick01;
end
gsay_end;
end_dialogue;
end
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
procedure Patrick01
begin
known := 1;
set_global_var(330, known);
gsay_reply(667, 102);
giq_option(4, 667, 103, Patrick02, 50);
giq_option(4, 667, 104, Patrick03, 50);
if ((global_var(101) == 0) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 667, 105, Patrick04, 50);
end
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, 667, 106, PatrickCombat, 51);
end
giq_option(-3, 667, 107, PatrickEnd, 50);
end
procedure Patrick02
begin
gsay_reply(667, 108);
giq_option(4, 667, 109, Patrick05, 50);
giq_option(4, 667, 110, Patrick06, 50);
giq_option(4, 667, 111, Patrick05, 50);
giq_option(4, 667, 112, PatrickEnd, 50);
end
procedure Patrick03
begin
gsay_reply(667, 113);
giq_option(4, 667, 114, PatrickEnd, 50);
giq_option(4, 667, 115, Patrick05, 50);
end
procedure Patrick04
begin
gsay_reply(667, 116);
if (get_critter_stat(dude_obj, 4) > 6) then begin
giq_option(7, 667, 117, Patrick07, 50);
end
else begin
giq_option(4, 667, 118, Patrick07, 50);
end
end
procedure Patrick05
begin
gsay_reply(667, 119);
giq_option(4, 667, 120, Patrick08, 50);
giq_option(4, 667, 121, Patrick09, 50);
giq_option(4, 667, 110, Patrick06, 50);
giq_option(4, 667, 122, PatrickEnd, 50);
end
procedure Patrick06
begin
gsay_reply(667, 123);
if (global_var(68) < 1) then begin
set_global_var(68, 1);
end
if (global_var(71) < 1) then begin
set_global_var(71, 1);
end
if (global_var(73) < 1) then begin
set_global_var(71, 1);
end
if (global_var(72) < 1) then begin
set_global_var(72, 1);
end
call Patrick06a;
end
procedure Patrick06a
begin
giq_option(4, 667, 124, Patrick10, 50);
giq_option(4, 667, 125, Patrick11, 50);
giq_option(4, 667, 126, Patrick12, 50);
giq_option(4, 667, 127, Patrick13, 50);
giq_option(4, 634, 100, PatrickEnd, 50);
end
procedure Patrick07
begin
gsay_reply(667, 128);
giq_option(4, 634, 100, PatrickEnd, 50);
giq_option(4, 667, 115, Patrick05, 50);
end
procedure Patrick08
begin
gsay_reply(667, 129);
if ((global_var(101) == 0) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 667, 130, Patrick07, 50);
end
giq_option(4, 667, 110, Patrick05, 50);
giq_option(4, 667, 112, PatrickEnd, 50);
end
procedure Patrick09
begin
gsay_reply(667, 131);
if (is_success(roll_vs_skill(dude_obj, 14, 0))) then begin
giq_option(7, 667, 132, Patrick15, 49);
end
giq_option(4, 667, 133, Patrick05, 50);
giq_option(4, 667, 122, PatrickEnd, 50);
end
procedure Patrick10
begin
if (global_var(13) == 1) then begin
gsay_reply(667, 141);
end
else begin
if (global_var(26) == 27) then begin
gsay_reply(667, 135);
end
else begin
gsay_reply(667, 134);
end
end
call Patrick06a;
end
procedure Patrick11
begin
if (global_var(13) == 1) then begin
gsay_reply(667, 141);
end
else begin
if (global_var(37)) then begin
if (global_var(38)) then begin
gsay_reply(667, 138);
end
else begin
gsay_reply(667, 137);
end
end
else begin
gsay_reply(667, 136);
end
end
call Patrick06a;
end
procedure Patrick12
begin
if (global_var(13) == 1) then begin
gsay_reply(667, 141);
end
else begin
gsay_reply(667, 139);
end
call Patrick06a;
end
procedure Patrick13
begin
if (global_var(13) == 1) then begin
gsay_reply(667, 141);
end
else begin
gsay_reply(667, 140);
end
if (get_critter_stat(dude_obj, 4) > 5) then begin
giq_option(6, 667, 142, Patrick14, 50);
end
else begin
call Patrick06a;
end
end
procedure Patrick14
begin
gsay_reply(667, 143);
call Patrick06a;
end
procedure Patrick15
begin
gsay_reply(667, 144);
giq_option(4, 667, 145, Patrick16, 49);
giq_option(4, 667, 146, PatrickEnd, 50);
end
procedure Patrick16
begin
gfade_out(600);
set_critter_stat(dude_obj, 3, 1);
gfade_in(600);
gsay_message(667, 147, 49);
end
procedure Patrick17
begin
gsay_reply(667, 148);
giq_option(4, 667, 149, Patrick06, 50);
giq_option(4, 667, 150, PatrickEnd, 50);
giq_option(-3, 667, 107, PatrickEnd, 50);
end
procedure PatrickCombat
begin
hostile := 1;
end
procedure PatrickEnd
begin
end