procedure start;
procedure combat;
procedure critter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure timed_event_p_proc;
procedure damage_p_proc;
procedure Dan00;
procedure Dan01;
procedure Dan02;
procedure Dan03;
procedure Dan04;
procedure Dan05;
procedure Dan06;
procedure Dan07;
procedure Dan08;
procedure Dan09;
procedure Dan10;
procedure Dan11;
procedure Dan12;
procedure Dan13;
procedure Dan14;
procedure Dan15;
procedure Dan16;
procedure Dan17;
procedure Dan18;
procedure Dan19;
procedure Dan20;
procedure Dan21;
procedure Dan22;
procedure Dan23;
procedure Dan24;
procedure Dan25;
procedure Dan26;
procedure Dan27;
procedure Dan28;
procedure DanAtNight;
procedure SendToStart;
procedure SendToStreet;
procedure SendToCattle1;
procedure SendToCattle2;
procedure SendToSleep;
procedure DanEnd;
variable hostile;
variable Only_Once := 1;
variable SetDayNight;
variable NightCount;
variable Talky;
variable WalkToTalker;
variable Sleeping;
import variable Billy_ptr;
import variable Dan_ptr;
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, 62);
critter_add_trait(self_obj, 1, 5, 50);
Dan_ptr := self_obj;
end
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
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 == 22) then begin
call timed_event_p_proc;
end
end
end
end
end
end
end
procedure combat
begin
hostile := 1;
end
procedure critter_p_proc
begin
if (hostile) then begin
hostile := 0;
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
if ((game_time_hour >= 600) and (game_time_hour < 700)) then begin
if (SetDayNight == 0) then begin
add_timer_event(self_obj, game_ticks(30), 3);
SetDayNight := 1;
end
end
if (map_var(0) == 1) then begin
if (WalkToTalker == 0) then begin
reg_anim_func(2, self_obj);
reg_anim_func(1, 1);
reg_anim_obj_move_to_tile(self_obj, 13891, -1);
reg_anim_func(3, 0);
WalkToTalker := 1;
end
end
if (tile_num(self_obj) == 13891) then begin
if (map_var(0) == 1) then begin
if (Talky == 0) then begin
call Dan27;
Talky := 1;
add_timer_event(self_obj, game_ticks(60 * 2), 1);
end
end
end
end
procedure pickup_p_proc
begin
if (source_obj == dude_obj) then begin
hostile := 1;
end
end
procedure talk_p_proc
begin
call get_reaction;
if ((game_time_hour >= 1900) or (game_time_hour < 600)) then begin
call DanAtNight;
end
else begin
if (local_var(4) == 1) then begin
set_local_var(4, 2);
if ((map_var(0) == 2) and (local_var(8) == 0)) then begin
if (local_var(1) > 1) then begin
start_gdialog(562, self_obj, 4, -1, -1);
gsay_start;
call Dan15;
gsay_end;
end_dialogue;
end
else begin
call Dan28;
end
end
else begin
call Dan28;
end
end
else begin
if (local_var(4) == 2) then begin
if ((map_var(0) == 2) and (local_var(8) == 0)) then begin
if (local_var(1) == 1) then begin
start_gdialog(562, self_obj, 4, -1, -1);
gsay_start;
call Dan16;
gsay_end;
end_dialogue;
end
else begin
call Dan28;
end
end
else begin
call Dan28;
end
end
else begin
start_gdialog(562, self_obj, 4, -1, -1);
gsay_start;
call Dan00;
gsay_end;
end_dialogue;
set_local_var(4, 1);
end
end
end
end
procedure destroy_p_proc
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
set_global_var(280, 1);
end
procedure look_at_p_proc
begin
script_overrides;
display_msg(message_str(562, 100));
end
procedure timed_event_p_proc
begin
if ((game_time_hour >= 600) and (game_time_hour < 700) or ((game_time_hour >= 700) and (game_time_hour < 1800))) then begin
if (Sleeping == 1) then begin
reg_anim_func(2, self_obj);
reg_anim_func(1, 1);
reg_anim_obj_move_to_tile(self_obj, 12871, -1);
reg_anim_func(3, 0);
add_timer_event(self_obj, game_ticks(60 * 25), 2);
Sleeping := 0;
end
else begin
if (fixed_param == 1) then begin
call SendToStart;
end
else begin
if (fixed_param == 2) then begin
call SendToStreet;
end
else begin
if (fixed_param == 3) then begin
call SendToCattle1;
end
else begin
if (fixed_param == 4) then begin
call SendToCattle2;
end
end
end
end
end
end
else begin
call SendToSleep;
if (fixed_param == 4) then begin
if (tile_distance_objs(self_obj, dude_obj) <= 10) then begin
float_msg(self_obj, message_str(562, 215), 2);
end
end
else begin
if (fixed_param == 5) then begin
NightCount := 0;
if (tile_distance_objs(self_obj, dude_obj) <= 10) then begin
float_msg(self_obj, message_str(562, 216), 2);
hostile := 1;
end
end
end
end
end
procedure damage_p_proc
begin
variable LVar0 := 0;
LVar0 := obj_pid(source_obj);
if (party_member_obj(LVar0) != 0) then begin
set_global_var(248, 1);
end
end
procedure Dan00
begin
gsay_reply(562, 102);
giq_option(5, 562, 106, Dan11, 50);
giq_option(4, 562, 107, Dan01, 50);
if (map_var(0) == 2) then begin
giq_option(4, 562, 108, Dan14, 50);
set_local_var(8, 1);
end
giq_option(-3, 562, 109, Dan02, 50);
end
procedure Dan01
begin
gsay_reply(562, 110);
giq_option(4, 562, 111, Dan03, 50);
giq_option(4, 562, 112, Dan05, 50);
giq_option(5, 562, 113, Dan11, 50);
giq_option(4, 562, 114, DanEnd, 50);
end
procedure Dan02
begin
gsay_message(562, 115, 51);
end
procedure Dan03
begin
if (get_critter_stat(dude_obj, 34) == 0) then begin
gsay_reply(562, 118);
end
else begin
gsay_reply(562, 119);
end
giq_option(4, 562, 120, Dan04, 51);
giq_option(5, 562, 121, Dan11, 50);
giq_option(4, 562, 122, DanEnd, 50);
end
procedure Dan04
begin
gsay_reply(562, 123);
giq_option(4, 562, 124, Dan06, 51);
giq_option(4, 562, 125, DanEnd, 50);
end
procedure Dan05
begin
gsay_reply(562, 126);
giq_option(4, 562, 127, Dan06, 51);
giq_option(4, 562, 128, DanEnd, 50);
end
procedure Dan06
begin
set_local_var(5, 1);
gsay_reply(562, 129);
giq_option(4, 562, 130, Dan07, 51);
giq_option(4, 562, 131, Dan09, 50);
end
procedure Dan07
begin
gsay_reply(562, 132);
giq_option(4, 562, 133, Dan10, 51);
giq_option(4, 562, 134, Dan08, 50);
end
procedure Dan08
begin
gsay_reply(562, 135);
giq_option(4, 562, 136, Dan09, 50);
giq_option(4, 562, 137, Dan11, 50);
end
procedure Dan09
begin
if (get_critter_stat(dude_obj, 34) == 0) then begin
gsay_message(562, 138, 51);
end
else begin
gsay_message(562, 139, 51);
end
end
procedure Dan10
begin
gsay_message(562, 141, 51);
call combat;
end
procedure Dan11
begin
if (get_critter_stat(dude_obj, 34) == 0) then begin
gsay_reply(562, 142);
end
else begin
gsay_reply(562, message_str(562, 142) + " " + message_str(562, 143));
end
giq_option(7, 562, 144, Dan12, 50);
giq_option(4, 562, 145, Dan13, 50);
giq_option(4, 562, 146, DanEnd, 50);
end
procedure Dan12
begin
gsay_reply(562, 147);
giq_option(4, 562, 148, DanEnd, 50);
giq_option(4, 562, 149, DanEnd, 50);
giq_option(5, 562, 150, Dan13, 50);
end
procedure Dan13
begin
gsay_message(562, 151, 50);
end
procedure Dan14
begin
gsay_reply(562, 152);
giq_option(4, 562, 153, Dan17, 50);
giq_option(4, 562, 154, DanEnd, 50);
end
procedure Dan15
begin
gsay_reply(562, 155);
giq_option(5, 562, 156, Dan11, 50);
giq_option(4, 562, 157, Dan01, 50);
if (map_var(0) == 2) then begin
giq_option(4, 562, 158, Dan14, 50);
end
giq_option(4, 562, 159, DanEnd, 50);
giq_option(-3, 562, 160, Dan02, 50);
end
procedure Dan16
begin
gsay_reply(562, 161);
if (map_var(0) == 2) then begin
giq_option(4, 562, 162, Dan14, 50);
end
giq_option(4, 562, 163, DanEnd, 50);
giq_option(-3, 562, 164, Dan02, 50);
end
procedure Dan17
begin
gsay_reply(562, 168);
giq_option(4, 562, 169, Dan19, 50);
giq_option(4, 562, 170, Dan18, 50);
giq_option(4, 562, 171, DanEnd, 50);
end
procedure Dan18
begin
gsay_reply(562, 172);
giq_option(5, 562, 173, Dan19, 50);
giq_option(4, 562, 174, DanEnd, 50);
end
procedure Dan19
begin
gsay_reply(562, 175);
giq_option(4, 562, 176, Dan20, 51);
giq_option(4, 562, 177, DanEnd, 50);
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, 562, 178, Dan20, 51);
end
giq_option(4, 562, 179, Dan22, 50);
giq_option(4, 562, 180, Dan23, 50);
end
procedure Dan20
begin
gsay_reply(562, 181);
giq_option(4, 562, 182, Dan21, 51);
giq_option(4, 562, 183, Dan21, 51);
giq_option(4, 562, 184, Dan24, 50);
giq_option(4, 562, 185, Dan25, 50);
end
procedure Dan21
begin
gsay_reply(562, 186);
giq_option(4, 562, 187, DanEnd, 50);
giq_option(4, 562, 188, DanEnd, 50);
giq_option(4, 562, 189, DanEnd, 50);
end
procedure Dan22
begin
set_local_var(7, 1);
set_map_var(1, 1);
gsay_message(562, 190, 50);
end
procedure Dan23
begin
gsay_message(562, 191, 50);
end
procedure Dan24
begin
gsay_reply(562, 192);
giq_option(4, 562, 193, DanEnd, 51);
giq_option(4, 562, 194, DanEnd, 51);
giq_option(4, 562, 195, DanEnd, 51);
end
procedure Dan25
begin
gsay_message(562, 196, 50);
end
procedure Dan26
begin
if (tile_num(Billy_ptr) != 9858) then begin
float_msg(self_obj, message_str(562, random(197, 199)), 2);
end
end
procedure Dan27
begin
float_msg(self_obj, message_str(562, random(200, 203)), 2);
set_map_var(0, 2);
end
procedure Dan28
begin
float_msg(self_obj, message_str(562, random(208, 213)), 2);
end
procedure DanAtNight
begin
if (NightCount == 0) then begin
float_msg(self_obj, message_str(562, 214), 2);
NightCount := 1;
add_timer_event(self_obj, game_ticks(5), 4);
add_timer_event(self_obj, game_ticks(10), 5);
end
end
procedure SendToStart
begin
reg_anim_func(2, self_obj);
reg_anim_func(1, 1);
reg_anim_obj_move_to_tile(self_obj, 15522, -1);
reg_anim_func(3, 0);
add_timer_event(self_obj, game_ticks(60 * 12), 2);
end
procedure SendToStreet
begin
reg_anim_func(2, self_obj);
reg_anim_func(1, 1);
reg_anim_obj_move_to_tile(self_obj, 15295, -1);
reg_anim_func(3, 0);
add_timer_event(self_obj, game_ticks(60 * 2), 3);
end
procedure SendToCattle1
begin
reg_anim_func(2, self_obj);
reg_anim_func(1, 1);
reg_anim_obj_move_to_tile(self_obj, 12871, -1);
reg_anim_func(3, 0);
if (random(1, 10) >= 6) then begin
add_timer_event(self_obj, game_ticks(60 * 3), 4);
end
else begin
add_timer_event(self_obj, game_ticks(60 * 4), 1);
end
end
procedure SendToCattle2
begin
reg_anim_func(2, self_obj);
reg_anim_func(1, 1);
reg_anim_obj_move_to_tile(self_obj, 12871, -1);
reg_anim_func(3, 0);
add_timer_event(self_obj, game_ticks(60 * 4), 1);
end
procedure SendToSleep
begin
if (Sleeping == 0) then begin
reg_anim_func(2, self_obj);
reg_anim_func(1, 1);
reg_anim_obj_move_to_tile(self_obj, 14932, -1);
reg_anim_func(3, 0);
SetDayNight := 0;
Sleeping := 1;
end
end
procedure DanEnd
begin
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