procedure Start;
procedure look_at_p_proc;
procedure description_p_proc;
procedure talk_p_proc;
procedure critter_p_proc;
procedure damage_p_proc;
procedure destroy_p_proc;
procedure timed_event_p_proc;
procedure pickup_p_proc;
variable Initialize := 1;
variable PsstTime;
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 (Initialize) then begin
if (obj_is_carrying_obj_pid(self_obj, 41) == 0) then begin
item_caps_adjust(self_obj, random(10, 100));
end
critter_add_trait(self_obj, 1, 6, 47);
critter_add_trait(self_obj, 1, 5, 27);
add_timer_event(self_obj, game_ticks(random(3, 5)), 1);
if (local_var(4) == 0) then begin
set_local_var(4, tile_num(self_obj));
end
Initialize := 0;
end
end
procedure look_at_p_proc
begin
script_overrides;
display_msg(message_str(279, 100));
end
procedure description_p_proc
begin
script_overrides;
display_msg(message_str(279, 100));
end
procedure talk_p_proc
begin
if (global_var(253) == 1) then begin
float_msg(self_obj, message_str(669, random(100, 105)), 2);
end
else begin
if (global_var(613) == 2) then begin
float_msg(self_obj, message_str(279, random(101, 115)), 0);
end
else begin
float_msg(self_obj, message_str(279, random(101, 111)), 0);
end
end
end
procedure critter_p_proc
begin
variable LVar0 := 0;
LVar0 := global_var(345);
if ((((game_time / 10) - LVar0) >= 10) and (tile_distance_objs(self_obj, dude_obj) <= 4) and (global_var(253) == 0)) then begin
if (global_var(613) == 2) then begin
float_msg(self_obj, message_str(279, random(101, 115)), 0);
end
else begin
float_msg(self_obj, message_str(279, random(101, 111)), 0);
end
LVar0 := game_time / 10;
set_global_var(345, LVar0);
end
if (obj_can_see_obj(self_obj, dude_obj)) then begin
if (global_var(253) == 1) then begin
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
end
end
procedure damage_p_proc
begin
if (source_obj == dude_obj) then begin
set_global_var(253, 1);
end
end
procedure destroy_p_proc
begin
if (source_obj == dude_obj) then begin
set_global_var(253, 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
end
procedure timed_event_p_proc
begin
variable LVar0 := 0;
LVar0 := tile_num_in_direction(local_var(4), random(0, 5), random(1, 5));
animate_move_obj_to_tile(self_obj, LVar0, 0);
add_timer_event(self_obj, game_ticks(random(3, 5)), 1);
end
procedure pickup_p_proc
begin
set_global_var(253, 1);
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