procedure start;
procedure do_dialogue;
procedure pre_dialogue;
procedure childend;
procedure childcbt;
procedure child_heal;
procedure child_pois;
procedure child00;
procedure child01;
procedure child02;
procedure child03;
procedure child04;
procedure child04a;
procedure child05;
procedure child05a;
procedure child06;
procedure child07;
procedure child08;
procedure child09;
procedure child09a;
procedure child10;
procedure child11;
procedure child12;
procedure child13;
procedure child14;
procedure child15;
procedure child16;
variable init_teams;
variable hostile;
variable max_hp;
variable current_hp;
variable cur_pois;
variable hp_injured;
variable cost;
variable pois_cost;
variable cheat;
variable RADCOUNT;
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 (not(init_teams)) then begin
critter_add_trait(self_obj, 1, 6, 20);
critter_add_trait(self_obj, 1, 5, 67);
init_teams := 1;
end
max_hp := get_critter_stat(dude_obj, 7);
current_hp := get_critter_stat(dude_obj, 35);
RADCOUNT := 0;
if (script_action == 11) then begin
if (local_var(5) == 0) then begin
call pre_dialogue;
end
else begin
call childend;
end
end
else begin
if (script_action == 14) then begin
set_local_var(4, 1);
end
else begin
if (script_action == 21) then begin
script_overrides;
display_msg(message_str(41, 100));
end
else begin
if (script_action == 4) then begin
hostile := 1;
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
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(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
end
end
end
end
end
procedure do_dialogue
begin
call get_reaction;
start_gdialog(41, self_obj, 4, -1, -1);
gsay_start;
call child00;
gsay_end;
end_dialogue;
end
procedure pre_dialogue
begin
if (local_var(4)) then begin
call child16;
end
else begin
if (global_var(35) > 0) then begin
call child15;
end
else begin
call do_dialogue;
end
end
end
procedure childend
begin
end
procedure childcbt
begin
hostile := 1;
end
procedure child_heal
begin
game_time_advance(game_ticks(600 * hp_injured));
critter_heal(dude_obj, hp_injured);
set_global_var(154, global_var(154) - 1);
end
procedure child_pois
begin
game_time_advance(game_ticks(1800));
cur_pois := get_poison(dude_obj);
poison(dude_obj, -cur_pois);
set_global_var(154, global_var(154) - 1);
end
procedure child00
begin
gsay_reply(41, 101);
giq_option(4, 41, 102, child04, 50);
giq_option(5, 41, 103, child11, 50);
giq_option(-3, 41, 104, child01, 50);
end
procedure child01
begin
gsay_message(41, 105, 50);
if (current_hp < max_hp) then begin
hp_injured := max_hp - current_hp;
call child_heal;
call child03;
end
else begin
call child02;
end
end
procedure child02
begin
gsay_message(41, 106, 50);
call childend;
end
procedure child03
begin
gsay_message(41, 107, 50);
call childend;
end
procedure child04
begin
variable LVar0 := 0;
if (local_var(1) >= 3) then begin
LVar0 := 5;
pois_cost := 12;
end
else begin
if (local_var(1) < 2) then begin
LVar0 := 20;
pois_cost := 50;
end
else begin
LVar0 := 10;
pois_cost := 25;
end
end
hp_injured := max_hp - current_hp;
cost := (hp_injured * LVar0) + pois_cost;
cheat := 3 * cost / 4;
if (hp_injured > 0) then begin
gsay_message(41, 108, 50);
end
else begin
gsay_message(41, 109, 50);
end
if (get_poison(dude_obj)) then begin
gsay_message(41, 110, 50);
end
if (RADCOUNT > 50) then begin
gsay_message(41, 111, 50);
end
if ((hp_injured > 0) or get_poison(dude_obj)) then begin
gsay_reply(41, message_str(41, 113) + cost + message_str(41, 114));
giq_option(3, 41, 115, child04a, 50);
giq_option(3, 41, 116, childend, 50);
giq_option(3, 41, 117, child09, 50);
giq_option(3, 41, message_str(41, 118) + cheat + message_str(41, 119), child05, 50);
end
end
procedure child04a
begin
if (cost > item_caps_total(dude_obj)) then begin
call child08;
end
else begin
call child06;
end
end
procedure child05
begin
gsay_reply(41, 120);
giq_option(3, 41, 121, child05a, 50);
giq_option(3, 41, 122, childend, 50);
end
procedure child05a
begin
set_local_var(5, 1);
call childend;
end
procedure child06
begin
if (get_critter_stat(dude_obj, 34) == 0) then begin
gsay_message(41, 123, 50);
end
else begin
gsay_message(41, 124, 50);
end
item_caps_adjust(dude_obj, -cost);
gfade_out(400);
gfade_in(400);
if (hp_injured > 0) then begin
call child_heal;
end
if (get_poison(dude_obj)) then begin
call child_pois;
end
call child07;
end
procedure child07
begin
gsay_message(41, 125, 50);
call childend;
end
procedure child08
begin
if (cost > item_caps_total(dude_obj)) then begin
cost := item_caps_total(dude_obj);
end
gsay_reply(41, 126);
giq_option(3, 41, 127, child06, 50);
giq_option(3, 41, 128, childend, 50);
end
procedure child09
begin
gsay_reply(41, 129);
giq_option(3, 41, 130, child09a, 50);
giq_option(3, 41, 131, childend, 50);
end
procedure child09a
begin
if (item_caps_total(dude_obj) >= cost) then begin
call child10;
end
else begin
cost := item_caps_total(dude_obj);
call child06;
end
end
procedure child10
begin
gsay_message(41, 132, 50);
call child06;
end
procedure child11
begin
gsay_reply(41, 133);
giq_option(3, 41, 134, childend, 50);
giq_option(3, 41, 135, child12, 50);
end
procedure child12
begin
gsay_reply(41, 136);
giq_option(3, 41, 137, child14, 50);
giq_option(3, 41, 138, child13, 50);
end
procedure child13
begin
gsay_message(41, 139, 50);
call childend;
end
procedure child14
begin
gsay_reply(41, 140);
giq_option(3, 41, 141, childend, 50);
end
procedure child15
begin
float_msg(self_obj, message_str(41, 142), 7);
call childend;
end
procedure child16
begin
float_msg(self_obj, message_str(41, 143), 7);
call childcbt;
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