procedure start;
procedure do_dialogue;
procedure dialog;
procedure airgrd00;
procedure airgrd01;
procedure airgrd02;
procedure airgrd03;
procedure airgrd03a;
procedure airgrd04;
procedure airgrd04a;
procedure airgrd04b;
procedure airgrd05;
procedure airgrd06;
procedure airgrd07;
procedure airgrd08;
procedure airgrd09;
procedure airgrd10;
procedure airgrd11;
procedure airgrd12;
procedure airgrd13;
procedure airgrd14;
procedure airgrd15;
procedure bluff_end;
procedure dialog_end;
procedure airgrdtim;
procedure combat;
variable HOSTILE;
variable only_once := 1;
variable Weapons;
variable DISGUISED;
variable again;
variable first;
variable rndx;
variable jumpcode;
variable indialog;
variable temp;
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, 34);
critter_add_trait(self_obj, 1, 5, 46);
end
else begin
if (script_action == 14) then begin
if (global_var(245) == 0) then begin
set_global_var(245, 1);
end
end
else begin
if (script_action == 11) then begin
call do_dialogue;
end
else begin
if (script_action == 4) then begin
HOSTILE := 1;
end
else begin
if (script_action == 22) then begin
if ((obj_item_subtype(critter_inven_obj(dude_obj, 1)) == 3) or (obj_item_subtype(critter_inven_obj(dude_obj, 2)) == 3)) then begin
call combat;
end
end
else begin
if (script_action == 12) then begin
if (HOSTILE) then begin
HOSTILE := 0;
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
if (obj_can_see_obj(self_obj, dude_obj) and (tile_distance_objs(self_obj, dude_obj) < 6)) then begin
if ((obj_item_subtype(critter_inven_obj(dude_obj, 1)) == 3) or (obj_item_subtype(critter_inven_obj(dude_obj, 2)) == 3)) then begin
if (Weapons == 0) then begin
Weapons := 1;
again := 1;
dialogue_system_enter;
end
end
DISGUISED := 0;
if (obj_pid(critter_inven_obj(dude_obj, 0)) == 113) then begin
if (metarule(16, 0) > 1) then begin
DISGUISED := 0;
end
else begin
DISGUISED := 1;
end
end
if (DISGUISED == 0) then begin
again := 1;
dialogue_system_enter;
end
if (again == 0) then begin
again := 1;
dialogue_system_enter;
end
end
end
else begin
if ((script_action == 21) or (script_action == 3)) then begin
script_overrides;
end
else begin
if (script_action == 18) then begin
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(160, global_var(160) + 1);
if ((global_var(160) % 6) == 0) then begin
set_global_var(155, global_var(155) + 1);
end
end
end
end
end
end
end
end
end
end
end
procedure do_dialogue
begin
if (obj_pid(critter_inven_obj(dude_obj, 0)) == 113) then begin
if (metarule(16, 0) > 1) then begin
DISGUISED := 0;
end
else begin
DISGUISED := 1;
end
end
if ((map_var(1) == 1) and (global_var(231) == 1)) then begin
call airgrd00;
end
else begin
if (DISGUISED) then begin
if (Weapons) then begin
jumpcode := 1;
call dialog;
end
else begin
if (first == 0) then begin
first := 1;
jumpcode := 2;
call dialog;
end
else begin
if (first == 1) then begin
call airgrd08;
end
end
end
end
else begin
if (Weapons) then begin
call airgrd15;
end
else begin
jumpcode := 3;
call dialog;
end
end
end
end
procedure dialog
begin
set_local_var(3, 1);
call get_reaction;
start_gdialog(673, self_obj, 4, -1, -1);
gsay_start;
indialog := 1;
if (jumpcode < 2) then begin
call airgrd01;
end
else begin
if (jumpcode == 2) then begin
call airgrd03;
end
else begin
if (jumpcode > 2) then begin
call airgrd09;
end
end
end
indialog := 0;
gsay_end;
end_dialogue;
end
procedure airgrd00
begin
float_msg(self_obj, message_str(673, random(102, 104)), 2);
end
procedure airgrd01
begin
gsay_reply(673, 105);
giq_option(-3, 673, 106, airgrd02, 51);
giq_option(4, 673, 107, airgrdtim, 50);
giq_option(4, 673, 108, airgrd02, 51);
giq_option(4, 673, 109, airgrdtim, 50);
end
procedure airgrd02
begin
gsay_message(673, 110, 51);
call combat;
end
procedure airgrd03
begin
gsay_reply(673, 111);
giq_option(-3, 673, 112, airgrd02, 51);
giq_option(4, 673, 113, airgrd04, 50);
giq_option(4, 673, 114, airgrd03a, 50);
giq_option(4, 673, 115, airgrd02, 51);
end
procedure airgrd03a
begin
if (is_success(roll_vs_skill(dude_obj, 14, 0))) then begin
call airgrd06;
end
else begin
call airgrd08;
end
end
procedure airgrd04
begin
gsay_reply(673, 116);
giq_option(4, 673, 117, airgrd04a, 50);
giq_option(6, 673, 118, airgrd04b, 50);
end
procedure airgrd04a
begin
if (is_success(roll_vs_skill(dude_obj, 14, -30))) then begin
call airgrd06;
end
else begin
call airgrd05;
end
end
procedure airgrd04b
begin
if (is_success(roll_vs_skill(dude_obj, 14, -15))) then begin
call airgrd06;
end
else begin
call airgrd05;
end
end
procedure airgrd05
begin
gsay_message(673, 119, 51);
call combat;
end
procedure airgrd06
begin
gsay_reply(673, 120);
giq_option(4, 673, 121, bluff_end, 50);
giq_option(4, 673, 122, airgrd07, 51);
giq_option(4, 673, 123, bluff_end, 50);
end
procedure airgrd07
begin
gsay_message(673, 124, 51);
call combat;
end
procedure airgrd08
begin
if (indialog == 1) then begin
gsay_message(673, random(125, 127), 50);
end
else begin
float_msg(self_obj, message_str(673, random(125, 127)), 2);
end
call bluff_end;
end
procedure airgrd09
begin
gsay_reply(673, 128);
giq_option(-3, 673, 129, airgrd10, 51);
giq_option(4, 673, 130, airgrd10, 51);
giq_option(4, 673, 131, airgrd11, 51);
giq_option(4, 673, 132, airgrd02, 51);
end
procedure airgrd10
begin
gsay_message(673, 133, 51);
call combat;
end
procedure airgrd11
begin
gsay_reply(673, 134);
giq_option(4, 673, 135, airgrd02, 51);
giq_option(4, 673, 136, airgrd12, 51);
end
procedure airgrd12
begin
gsay_reply(673, 137);
giq_option(4, 673, 138, airgrd13, 51);
giq_option(6, 673, 139, airgrd14, 51);
end
procedure airgrd13
begin
gsay_message(673, 140, 51);
call combat;
end
procedure airgrd14
begin
gsay_message(673, 141, 51);
call combat;
end
procedure airgrd15
begin
gsay_message(673, 142, 51);
call combat;
end
procedure bluff_end
begin
if (local_var(4) == 0) then begin
set_local_var(4, 1);
temp := 750;
display_msg(message_str(673, 200) + temp + message_str(673, 201));
give_exp_points(temp);
end
end
procedure dialog_end
begin
end
procedure airgrdtim
begin
add_timer_event(self_obj, game_ticks(10), 1);
end
procedure combat
begin
HOSTILE := 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