procedure start;
procedure critter_p_proc;
procedure destroy_p_proc;
procedure map_enter_p_proc;
procedure use_obj_on_p_proc;
procedure talk_p_proc;
procedure timed_event_p_proc;
procedure Katja01;
procedure Katja02;
procedure Katja03;
procedure Katja04;
procedure Katja05;
procedure Katja06;
procedure Katja07;
procedure Katja08;
procedure Katja09;
procedure Katja10;
procedure Katja11;
procedure Katja12;
procedure Katja13;
procedure Katja14;
procedure Katja15;
procedure Katja16;
procedure Katja17;
procedure Katja18;
procedure Katja19;
procedure Katja20;
procedure Katja21;
procedure Katja22;
procedure Katja23;
procedure Katja24;
procedure Katja25;
procedure Katja26;
procedure Katja27;
procedure Katja28;
procedure KatjaEnd;
procedure KatjaLeave;
procedure KatjaTactics;
procedure KatjaClose;
procedure KatjaModerate;
procedure KatjaFar;
procedure KatjaExit;
procedure follow_player;
procedure map_commentary;
procedure pick_lock;
procedure set_lock;
variable hostile;
variable item;
variable unwield_flag;
variable lock;
variable prev_tile := 7000;
variable dest_tile := 7000;
variable line173flag;
variable line174flag;
variable line176flag;
variable line184flag;
variable line186flag;
variable line187flag;
variable line188flag;
import variable Ian_ptr;
import variable Katja_ptr;
import variable Tycho_ptr;
procedure start
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 == 15) then begin
call map_enter_p_proc;
end
else begin
if (script_action == 7) then begin
call use_obj_on_p_proc;
end
else begin
if (script_action == 11) then begin
call talk_p_proc;
end
else begin
if (script_action == 22) then begin
call timed_event_p_proc;
end
end
end
end
end
end
end
procedure critter_p_proc
begin
if (hostile) then begin
hostile := 0;
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
else begin
call map_commentary;
end
end
procedure destroy_p_proc
begin
set_global_var(244, 3);
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 map_enter_p_proc
begin
if (global_var(244) < 2) then begin
critter_add_trait(self_obj, 1, 6, 49);
end
else begin
critter_add_trait(self_obj, 1, 6, 0);
add_timer_event(self_obj, game_ticks(2), 1);
end
Katja_ptr := self_obj;
end
procedure use_obj_on_p_proc
begin
if (global_var(244) == 2) then begin
item := obj_pid(obj_being_used_with);
if ((item != 40) and (item != 47) and (item != 91)) then begin
script_overrides;
if (obj_item_subtype(obj_being_used_with) == 3) then begin
if ((item == 4) or (item == 9) or (item == 22) or (item == 45) or (item == 7) or (item == 159) or (item == 25) or (item == 26) or (item == 27) or (item == 19) or (item == 21) or (item == 234) or (item == 235) or (item == 116) or (item == 236) or (item == 241)) then begin
rm_obj_from_inven(dude_obj, obj_being_used_with);
add_obj_to_inven(self_obj, obj_being_used_with);
end
else begin
float_msg(self_obj, message_str(634, 109), 5);
end
end
else begin
rm_obj_from_inven(dude_obj, obj_being_used_with);
add_obj_to_inven(self_obj, obj_being_used_with);
end
end
end
end
procedure talk_p_proc
begin
start_gdialog(623, self_obj, 4, -1, -1);
gsay_start;
if (global_var(244) == 3) then begin
call Katja28;
end
else begin
if (global_var(244) == 2) then begin
call Katja24;
end
else begin
if (global_var(244) == 1) then begin
call Katja25;
end
else begin
call Katja01;
end
end
end
gsay_end;
end_dialogue;
if (unwield_flag == 1) then begin
unwield_flag := 0;
inven_unwield;
end
if (lock) then begin
call pick_lock;
end
if (global_var(244) == 2) then begin
if (global_var(315) == 0) then begin
set_global_var(315, 1);
give_exp_points(200);
display_msg(message_str(623, 180));
end
end
end
procedure timed_event_p_proc
begin
if (global_var(244) == 2) then begin
call follow_player;
end
end
procedure Katja01
begin
set_global_var(244, 1);
gsay_reply(623, 102);
giq_option(4, 623, message_str(623, 103) + proto_data(obj_pid(dude_obj), 1) + message_str(623, 104), Katja02, 50);
giq_option(4, 623, 105, Katja02, 50);
giq_option(5, 623, 106, Katja05, 50);
giq_option(-3, 623, 189, KatjaExit, 50);
end
procedure Katja02
begin
gsay_reply(623, 107);
giq_option(5, 623, 108, Katja03, 50);
giq_option(5, 623, 109, Katja04, 50);
giq_option(4, 623, 110, Katja07, 50);
if ((global_var(101) != 2) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 623, 111, Katja06, 50);
end
end
procedure Katja03
begin
gsay_reply(623, 112);
giq_option(5, 623, 109, Katja04, 50);
giq_option(4, 623, 110, Katja07, 50);
if ((global_var(101) != 2) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 623, 111, Katja06, 50);
end
end
procedure Katja04
begin
gsay_reply(623, 113);
giq_option(5, 623, 114, Katja21, 50);
giq_option(4, 623, 116, Katja09, 50);
giq_option(4, 623, 115, KatjaEnd, 50);
end
procedure Katja05
begin
gsay_reply(623, 117);
giq_option(4, 623, message_str(623, 103) + proto_data(obj_pid(dude_obj), 1) + message_str(623, 104), Katja02, 50);
giq_option(4, 623, 118, Katja07, 50);
giq_option(4, 623, 115, KatjaEnd, 50);
end
procedure Katja06
begin
gsay_reply(623, 119);
giq_option(5, 623, 121, Katja11, 50);
giq_option(4, 623, 122, Katja10, 50);
giq_option(4, 623, 120, KatjaEnd, 50);
end
procedure Katja07
begin
gsay_reply(623, 123);
giq_option(4, 623, 124, Katja06, 50);
giq_option(4, 623, 125, Katja08, 50);
end
procedure Katja08
begin
gsay_message(623, 126, 51);
end
procedure Katja09
begin
gsay_reply(623, 127);
if ((global_var(101) != 2) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 623, 128, Katja06, 50);
end
giq_option(4, 623, 129, Katja10, 50);
giq_option(4, 623, 130, Katja17, 50);
end
procedure Katja10
begin
giq_option(4, 623, 131, Katja13, 50);
giq_option(4, 623, 133, Katja15, 50);
giq_option(4, 623, 134, Katja16, 50);
giq_option(4, 623, 135, Katja12, 50);
giq_option(4, 623, 130, Katja17, 50);
giq_option(4, 623, 136, KatjaEnd, 50);
end
procedure Katja11
begin
gsay_reply(623, 137);
giq_option(4, 623, 135, Katja12, 50);
giq_option(4, 623, 138, KatjaEnd, 50);
end
procedure Katja12
begin
gsay_reply(623, 139);
call Katja10;
end
procedure Katja13
begin
gsay_reply(623, 140);
call Katja10;
end
procedure Katja14
begin
gsay_reply(623, 141);
call Katja10;
end
procedure Katja15
begin
gsay_reply(623, 142);
call Katja10;
end
procedure Katja16
begin
gsay_reply(623, 143);
call Katja10;
end
procedure Katja17
begin
gsay_reply(623, 144);
if (not(global_var(77))) then begin
set_global_var(77, 1);
end
giq_option(4, 623, 145, Katja18, 50);
giq_option(4, 623, 147, Katja10, 50);
giq_option(4, 623, 146, KatjaEnd, 50);
end
procedure Katja18
begin
gsay_reply(623, 148);
giq_option(4, 623, 149, Katja20, 50);
giq_option(4, 623, 151, Katja10, 50);
giq_option(4, 623, 150, KatjaEnd, 50);
end
procedure Katja19
begin
gsay_reply(623, 152);
call Katja10;
end
procedure Katja20
begin
set_global_var(244, 2);
party_add(self_obj);
add_timer_event(self_obj, game_ticks(1), 1);
critter_add_trait(self_obj, 1, 6, 0);
gsay_message(623, 153, 50);
end
procedure Katja21
begin
gsay_reply(623, 154);
giq_option(4, 623, 156, Katja22, 50);
giq_option(6, 623, 157, Katja23, 50);
giq_option(4, 623, 155, KatjaEnd, 50);
end
procedure Katja22
begin
gsay_reply(623, 158);
call Katja10;
end
procedure Katja23
begin
gsay_reply(623, 159);
giq_option(4, 623, 160, Katja09, 50);
if ((global_var(101) == 0) and (obj_is_carrying_obj_pid(dude_obj, 55) == 0)) then begin
giq_option(4, 623, 161, Katja06, 50);
end
giq_option(4, 623, 162, KatjaEnd, 50);
end
procedure Katja24
begin
gsay_reply(623, 163);
if (cur_map_index == 30) then begin
if (map_var(3)) then begin
giq_option(4, 623, 164, set_lock, 50);
end
end
if ((cur_map_index == 10) and (elevation(dude_obj) == 1)) then begin
if (map_var(4)) then begin
giq_option(4, 623, 164, set_lock, 50);
end
end
giq_option(4, 389, 159, KatjaTactics, 49);
giq_option(4, 623, 177, Katja26, 50);
giq_option(4, 623, 174, Katja27, 50);
giq_option(4, 623, 167, KatjaLeave, 50);
giq_option(4, 623, 168, KatjaEnd, 50);
giq_option(-3, 623, 168, KatjaEnd, 50);
giq_option(-3, 623, 190, KatjaLeave, 50);
end
procedure Katja25
begin
gsay_reply(623, 169);
giq_option(4, 623, 171, Katja10, 50);
giq_option(4, 623, 170, KatjaEnd, 50);
giq_option(-3, 623, 189, KatjaExit, 50);
end
procedure Katja26
begin
gsay_message(623, 178, 50);
end
procedure Katja27
begin
unwield_flag := 1;
gsay_message(623, 179, 50);
call Katja24;
end
procedure Katja28
begin
gsay_reply(623, 181);
giq_option(4, 623, 182, Katja20, 50);
giq_option(4, 623, 183, KatjaEnd, 50);
giq_option(-3, 623, 189, KatjaExit, 50);
end
procedure KatjaEnd
begin
end
procedure KatjaLeave
begin
set_global_var(244, 3);
party_remove(self_obj);
rm_timer_event(self_obj);
end
procedure KatjaTactics
begin
gsay_reply(389, 160);
giq_option(4, 389, 161, KatjaClose, 49);
giq_option(4, 389, 162, KatjaModerate, 49);
giq_option(4, 389, 163, KatjaFar, 49);
end
procedure KatjaClose
begin
set_global_var(279, 0);
end
procedure KatjaModerate
begin
set_global_var(279, 1);
end
procedure KatjaFar
begin
set_global_var(279, 2);
end
procedure KatjaExit
begin
gsay_message(623, 191, 50);
end
procedure follow_player
begin
variable LVar0 := 0;
prev_tile := dest_tile;
LVar0 := (has_trait(1, dude_obj, 10) + random(2, 4)) % 6;
dest_tile := tile_num_in_direction(tile_num(dude_obj), LVar0, (global_var(279) * 2) + random(1, 2));
if ((tile_distance_objs(self_obj, dude_obj) > ((global_var(279) + 1) * 2)) or (random(0, 3) == 3)) then begin
if (tile_distance(prev_tile, tile_num(dude_obj)) > tile_distance(dest_tile, tile_num(dude_obj))) then begin
if (tile_distance_objs(self_obj, dude_obj) > 8) then begin
animate_move_obj_to_tile(self_obj, dest_tile, 1 bwor 16);
end
else begin
animate_move_obj_to_tile(self_obj, dest_tile, 0 bwor 16);
end
end
else begin
if (tile_distance_objs(self_obj, dude_obj) > 8) then begin
animate_move_obj_to_tile(self_obj, dest_tile, 1);
end
else begin
animate_move_obj_to_tile(self_obj, dest_tile, 0);
end
end
end
add_timer_event(self_obj, game_ticks(1), 1);
end
procedure map_commentary
begin
if (cur_map_index == 33) then begin
if ((tile_distance(tile_num(self_obj), 27317) < 4) and (line173flag == 0)) then begin
float_msg(self_obj, message_str(623, 173), 5);
line173flag := 1;
end
end
else begin
if (cur_map_index == 6) then begin
if (elevation(self_obj) == 1) then begin
if (tile_distance(tile_num(self_obj), 19111) < 4) then begin
if ((line174flag == 0) and (global_var(238) != 2) and (Ian_ptr != 0)) then begin
float_msg(self_obj, message_str(623, 172), 5);
line174flag := 1;
end
end
end
end
else begin
if (cur_map_index == 38) then begin
if ((tile_distance(tile_num(self_obj), 28104) < 5) and (line176flag == 0)) then begin
float_msg(self_obj, message_str(623, 176), 5);
if (global_var(121) == 2) then begin
float_msg(Tycho_ptr, message_str(389, 167), 12);
end
line176flag := 1;
end
end
else begin
if (cur_map_index == 32) then begin
if (line184flag == 0) then begin
float_msg(self_obj, message_str(623, 184), 5);
if (global_var(118) == 2) then begin
float_msg(Ian_ptr, message_str(235, 175), 0);
end
line184flag := 1;
end
end
else begin
if (cur_map_index == 34) then begin
if (line186flag == 0) then begin
float_msg(self_obj, message_str(623, 186), 5);
line186flag := 1;
end
end
else begin
if (cur_map_index == 3) then begin
if ((tile_distance(tile_num(self_obj), 17274) < 4) and (line187flag == 0)) then begin
float_msg(self_obj, message_str(623, 187), 5);
line187flag := 1;
end
end
else begin
if (cur_map_index == 45) then begin
if (line188flag == 0) then begin
float_msg(self_obj, message_str(623, 188), 5);
line188flag := 1;
end
end
end
end
end
end
end
end
end
procedure pick_lock
begin
reg_anim_func(2, self_obj);
reg_anim_func(1, 1);
reg_anim_obj_move_to_obj(self_obj, lock, -1);
reg_anim_animate(self_obj, 11, -1);
reg_anim_func(3, 0);
use_obj(lock);
obj_unlock(lock);
lock := 0;
end
procedure set_lock
begin
if (cur_map_index == 30) then begin
lock := map_var(3);
end
else begin
if (cur_map_index == 10) then begin
lock := map_var(4);
end
end
end