/*
Copyright 1998-2003 Interplay Entertainment Corp. All rights reserved.
*/
/*
Name: Arroyo Villager
Location: Arroyo
Description: Generic villager in Arroyo. No weapons, flees if confronted.
Log:
Please note any changes that have been made to the file in Updated. Then comment
the code which you have changed/altered/commented out. Please, do not delete any
code which was written.
Created: December 01, 1997
Updated:
*/
/* Include Files */
/* Note, the Following Lines need to be in this order so that
the script will be compilable. The define Name is referenced
in a module from define.h and used in command.h. Please do
not change the ordering.
-rwh2 11/13/97
*/
#include "..\headers\define.h"
#include "..\headers\ArVillag.h"
#define NAME SCRIPT_ACVILLGR
#define TOWN_REP_VAR GVAR_TOWN_REP_ARROYO
#include "..\headers\command.h"
#include "..\headers\ModReact.h"
#define MAX_TRAVEL (30)
/* Standard Script Procedures */
procedure start;
procedure critter_p_proc;
procedure pickup_p_proc;
procedure talk_p_proc;
procedure destroy_p_proc;
procedure look_at_p_proc;
procedure description_p_proc;
procedure use_skill_on_p_proc;
procedure damage_p_proc;
procedure map_enter_p_proc;
procedure timed_event_p_proc;
procedure push_p_proc;
/* Script Specific Procedure Calls */
procedure Node997; // this Node handles the basic START CONDITIONS
procedure Node998; // This Node is Always Combat
procedure Node999; // This Node is Always Ending
// The next lines are added in by the Designer Tool.
// Do NOT add in any lines here.
//~~~~~~~~~~~~~~~~ DESIGNER TOOL STARTS HERE
procedure Node000;
procedure Node001;
procedure Node002;
procedure Node003;
procedure Node004;
procedure Node005;
procedure Node006;
procedure Node007;
procedure Node008;
procedure Node009;
procedure Node010;
//~~~~~~~~~~~~~~~~ DESIGN TOOL ENDS HERE
// The Following lines are for anything that is not needed to be
// seen by the design Tool
/* Local Variables which are saved. All Local Variables need to be
prepended by LVAR_ */
#define LVAR_Herebefore (4)
#define LVAR_Hostile (5)
#define LVAR_Personal_Enemy (6)
#define LVAR_Home_Tile (7)
/* Local variables which do not need to be saved between map changes. */
variable Only_Once:=0;
variable In_Timed_Event;
procedure start begin
if (local_var(LVAR_Home_Tile) == 0) then begin
set_local_var(LVAR_Home_Tile,tile_num(self_obj));
end
end
procedure push_p_proc begin
end
/* This procedure will get called each time that the map is first entered. It will
set up the Team number and AI packet for this critter. This will override the
default from the prototype, and needs to be set in scripts. */
procedure map_enter_p_proc begin
Only_Once:=0;
critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_ARROYO);
critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_AI_PACKET,AI_ARROYO_VILLAGER);
end
/* Every heartbeat that the critter gets, this procedure will be called. Anything from
Movement to attacking the player on sight can be placed in here.*/
procedure critter_p_proc begin
if (((local_var(LVAR_Hostile) == 2)or(local_var(LVAR_Personal_Enemy) == 1)) and (obj_can_see_obj(self_obj,dude_obj))) then begin
set_local_var(LVAR_Hostile,1);
Flee_From_Dude
end
if (REP_ENEMY_ARROYO) then begin
attack(dude_obj);
end
if ((random(0,100) == 1) and (In_Timed_Event == 0)) then begin
In_Timed_Event:=1;
add_timer_event(self_obj,game_ticks(random(5,9)),1);
end
end
procedure timed_event_p_proc begin
if (fixed_param == 1) then begin
if (tile_distance(tile_num(self_obj),local_var(LVAR_Home_Tile)) < MAX_TRAVEL) then begin
animate_move_to_tile(tile_num_in_direction(tile_num(self_obj),random(0,5),random(3,7)));
end
else begin
animate_move_to_tile(tile_num_in_direction(local_var(LVAR_Home_Tile),random(0,5),random(3,7)));
end
In_Timed_Event:=0;
end
end
/* Whenever the critter takes damage of any type, this procedure will be called. Things
like setting ENEMY_ and LVAR_Personal_Enemy can be set here. */
procedure damage_p_proc begin
if (source_obj == dude_obj) then begin
set_local_var(LVAR_Personal_Enemy,1);
set_global_var(GVAR_ENEMY_ARROYO,1);
end
end
/* Any time that the player is caught stealing from this critter, Pickup_proc will be called.
In here, various things can happen. The most common response is instant hostility which
will be remembered. */
procedure pickup_p_proc begin
if (source_obj == dude_obj) then begin
set_local_var(LVAR_Hostile,2);
end
end
/* The dialog system is setup and prepares the player to talk to this NPC. Where To Go
written by designers are placed in here. Additionally, Reactions are generated and
stored which affects player interactions. */
procedure talk_p_proc begin
GetReaction;
if ((REP_ENEMY_ARROYO) or (local_var(LVAR_Personal_Enemy) == 1)) then begin
call Node009;
end else begin
start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
// if (map_var(MVAR_Talked_Villager) == 0) then begin
// set_map_var(MVAR_Talked_Villager,1);
// call Node000;
// end
// else
call Node997;
gSay_End;
end_dialogue;
end
end
/* This procedure gets called only on the death of this NPC. Special things like
incrementing the death count for reputation purposes and Enemy Counters are placed
in here. */
procedure destroy_p_proc begin
/* Increment the aligned critter counter*/
inc_good_critter
end
/* Look_at_p_proc gets called any time that the player passes the cursor over any object.
This should only hold the most cursory of glances for the player. */
procedure look_at_p_proc begin
script_overrides;
if (critter_is_male) then begin
display_msg(mstr(100));
end else begin
display_msg(mstr(101));
end
end
/* The player will see more indepth descriptions from this procedure. They are actively
looking at the critter and want more information. Things like names can be added here
if the critter is known to the player. */
procedure description_p_proc begin
script_overrides;
display_msg(mstr(150));
end
/* Any time a skill is used on a critter this call is made. This can be to give examinations
for things like Doctor skill or messages for various other skills. */
procedure use_skill_on_p_proc begin
if (action_being_used == SKILL_STEAL) then begin
if (is_success(roll_vs_skill(dude_obj,action_being_used,0))) then begin
inc_general_rep(REP_BONUS_ARROYO_MONEY_THEFT);
end
end
end
// nodes
procedure Node000 begin
Reply(150);
NOption(151,Node997,001);
end
procedure Node001 begin
// Reply(152);
if (reached_tl_4) then
Reply(303);
else if (reached_tl_3) then
Reply(302);
else if (reached_tl_2) then
Reply(301);
else if (reached_tl_1) then
Reply(300);
else
Reply(mstr(152));
NOption(153,Node003,004);
NOption(154,Node004,004);
NOption(155,Node999,004);
end
procedure Node002 begin
Reply(156);
NOption(157,Node004,004);
NOption(158,Node999,004);
end
procedure Node003 begin
Reply(159);
NOption(164,Node006,004);
NOption(160,Node999,004);
end
procedure Node004 begin
Reply(161);
NOption(162,Node999,004);
NOption(163,Node005,004);
NOption(164,Node006,004);
end
procedure Node005 begin
Reply(165);
NOption(166,Node999,004);
NOption(167,Node006,004);
end
procedure Node006 begin
Reply(168);
NOption(169,Node003,004);
NOption(170,Node010,004);
NOption(171,Node999,004);
end
procedure Node007 begin
Reply(172);
NLowOption(173,Node008);
end
procedure Node008 begin
Reply(174);
NLowOption(175,Node999);
end
procedure Node009 begin
floater(random(176,182));
end
procedure Node010 begin
Reply(183);
NOption(184,Node003,004);
NOption(186,Node006,004);
NOption(185,Node999,004);
end
procedure Node997 begin
if (get_critter_stat(dude_obj,STAT_iq) <= (0-LOW_IQ)) then begin
call Node007;
end else if (local_var(LVAR_Herebefore) == 0) then begin
call Node001;
end else begin
call Node001;
end
end
procedure Node998 begin
set_local_var(LVAR_Hostile,2);
end
/* Anytime that there is a need for an ending to dialog, this node is to be called. It will just
exit from the dialog system without any reprisals from the NPC. */
procedure Node999 begin
end