/*
Copyright 1998-2003 Interplay Entertainment Corp. All rights reserved.
*/
/*
Name:
Location:
Description:
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:
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\ARCaves.h"
#define NAME SCRIPT_ACTEMVIL
#define TOWN_REP_VAR (GVAR_TOWN_REP_ARROYO)
#include "..\headers\command.h"
#include "..\headers\ModReact.h"
#define Spear_Location (20329)
/* 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 combat_p_proc;
procedure timed_event_p_proc;
/* Script Specific Procedure Calls */
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 Node001;
procedure Node001a;
procedure Node002;
procedure Node002a;
procedure Node002b;
procedure Node002c;
procedure Node003;
procedure Node004;
procedure Node005;
procedure Node006;
procedure Node007;
procedure Node008;
procedure Node009;
procedure Node010;
procedure Node011;
procedure Node012;
procedure Node013;
procedure Node014;
procedure Node015;
procedure Node015a;
procedure Node012a;
procedure Node016;
procedure Node016a;
procedure Node017;
procedure Node018;
//~~~~~~~~~~~~~~~~ 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_Asked_1 (7)
#define LVAR_Asked_2 (8)
#define LVAR_Asked_3 (9)
#define LVAR_Looked_Before (10)
#define LVAR_Prepared (11)
#define LVAR_Defeated (12)
#define LVAR_Start_Trial (13)
#define LVAR_Waypoint (14)
#define LVAR_Talked_Before (15)
#define LVAR_Trained (16)
/* Imported variables from the Map scripts. These should only be
pointers and variables that need not be saved. If a variable
Needs to be saved, make it a map variable (MVAR_) */
import variable temple_chest_ptr;
/* Local variables which do not need to be saved between map changes. */
variable Only_Once:=0;
procedure start 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_DUMAR);
if ((cur_map_index == MAP_ARROYO_VILLAGE) and (global_var(GVAR_DUMAR_STATUS) == 1) and (not(is_loading_game))) then begin
set_obj_visibility(self_obj,1);
end
if ((cur_map_index == MAP_ARROYO_CAVES) and (global_var(GVAR_START_ARROYO_TRIAL) > TRIAL_NONE) and (not(is_loading_game))) then
set_obj_visibility(self_obj,1);
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
variable door;
/* If the critter is mad at the player for any reason, it will attack and remember to attack
the player should the game be saved and loaded repeatedly. Additionally, if any special
actions need to be taken by the critter based on previous combat, the critter will remember
this as well. */
if (local_var(LVAR_Start_Trial) == 1) then begin
attack(dude_obj);
end
if ((local_var(LVAR_Hostile) == 2) and (obj_can_see_obj(self_obj,dude_obj))) then begin
set_local_var(LVAR_Hostile,1);
call Node013;
attack(dude_obj);
end
if ((local_var(LVAR_Talked_Before) == 0) and (tile_distance_objs(dude_obj,self_obj) < 6) and (cur_map_index == MAP_ARROYO_CAVES)) then begin
set_local_var(LVAR_Talked_Before,1);
dialogue_system_enter;
end
if (local_var(LVAR_Start_Trial) == 2) then begin
if ((local_var(LVAR_Waypoint) == 0) and (tile_num(self_obj) != 19728)) then begin
door:=tile_contains_pid_obj(19928,2,PID_ARROYO_CAVE_DOOR);
obj_unlock(door);
animate_run_to_tile(19728);
end
else if ((local_var(LVAR_Waypoint) == 0) and (tile_num(self_obj) == 19728)) then begin
set_local_var(LVAR_Waypoint,1);
door:=tile_contains_pid_obj(19928,2,PID_ARROYO_CAVE_DOOR);
obj_open(door);
add_timer_event(self_obj,game_ticks(2),1);
end
else if ((local_var(LVAR_Waypoint) == 2) and (tile_num(self_obj) != 22712)) then
animate_run_to_tile(22712);
else if ((local_var(LVAR_Waypoint) == 2) and (tile_num(self_obj) == 22712)) then
set_local_var(LVAR_Waypoint,3);
else if ((local_var(LVAR_Waypoint) == 3) and (tile_num(self_obj) != 28715)) then
animate_run_to_tile(28715);
else if ((local_var(LVAR_Waypoint) == 3) and (tile_num(self_obj) == 28715)) then begin
set_local_var(LVAR_Waypoint,4);
set_obj_visibility(self_obj,1);
end
end
end
procedure timed_event_p_proc begin
if (fixed_param == 1) then
set_local_var(LVAR_Waypoint,2);
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 the player causes damage to this critter, then he will instantly consider the player
his personal enemy. In Critter_Proc or through dialog, actions will be taken against
the player for his evil acts. */
if ((source_obj == dude_obj) and (local_var(LVAR_Start_Trial) != 1)) then begin
set_local_var(LVAR_Personal_Enemy,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
procedure combat_p_proc begin
variable item;
if (fixed_param == COMBAT_SUBTYPE_TURN) then begin
if ((get_critter_stat(self_obj,STAT_current_hp) <= (get_critter_stat(self_obj,STAT_max_hit_points)/2)) and (local_var(LVAR_Start_Trial) == 1)) then begin
terminate_combat;
script_overrides;
item:=create_object(PID_HEALING_POWDER,0,0);
use_obj_on_obj(item,self_obj);
set_local_var(LVAR_Defeated,1);
set_local_var(LVAR_Start_Trial,2);
floater(161);
set_map_var(MVAR_Passed_Fighting,Fighting_Finished);
set_global_var(GVAR_START_ARROYO_TRIAL,TRIAL_FIGHT);
end
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
Evil_Critter:=0;
Slavery_Tolerant:=SLAVE_TOLERANT;
Karma_Perception:=KARMA_PERCEPTION1;
CheckKarma;
GetReaction;
if (local_var(LVAR_Start_Trial) == 2) then begin
script_overrides;
end
else if (cur_map_index == MAP_ARROYO_VILLAGE) then begin
start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
call Node010;
gSay_End;
end_dialogue;
end
else if (local_var(LVAR_Prepared) == 1) then begin
start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
call Node008;
gSay_End;
end_dialogue;
end
else begin
start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
call Node001;
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
/* Set global_variable for Enemy status*/
set_global_var(GVAR_DUMAR_STATUS,1);
if (map_var(MVAR_Passed_Fighting) != Fighting_Started) then begin
set_global_var(GVAR_ENEMY_ARROYO,1);
end
if (cur_map_index == MAP_ARROYO_CAVES) then begin
set_map_var(MVAR_Passed_Fighting,Fighting_Finished);
set_global_var(GVAR_START_ARROYO_TRIAL,TRIAL_FIGHT);
end
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 (local_var(LVAR_Looked_Before) == 0) then begin
set_local_var(LVAR_Looked_Before,1);
display_msg(mstr(100));
end
else
display_msg(mstr(101));
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(102));
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
end
/* Should the Player ever cause the NPC too much discomfort that he desires to attack the player,
this call will be made. Essentially, it stores the Hostile vaule so that the critter remembers
he was once hostile towards the player.*/
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
// Not lines are allowed to be added below here
// The Following lines are from the Design Tool
//~~~~~~~~~~~~~~~~ DESIGN TOOL STARTS HERE
procedure Node001 begin
Reply(mstr(103)+obj_name(dude_obj)+mstr(104));
NLowOption(105,Node002);
NLowOption(106,Node006);
NLowOption(107,Node001a);
NOption(108,Node002,004);
NOption(109,Node006,004);
NOption(110,Node001a,004);
end
procedure Node001a begin
set_local_var(LVAR_Prepared,1);
call Node007;
end
procedure Node002 begin
Reply(111);
if (local_var(LVAR_Asked_1) == 0) then begin
NLowOption(112,Node002a);
NOption(117,Node002a,004);
end
if (local_var(LVAR_Asked_2) == 0) then begin
NLowOption(113,Node002b);
NOption(118,Node002b,004);
end
if (local_var(LVAR_Asked_3) == 0) then begin
NLowOption(114,Node002c);
NOption(119,Node002c,004);
end
NLowOption(115,Node006);
NLowOption(116,Node001a);
NOption(120,Node006,004);
NOption(121,Node001a,004);
end
procedure Node002a begin
set_local_var(LVAR_Asked_1,1);
call Node003;
end
procedure Node002b begin
set_local_var(LVAR_Asked_2,1);
call Node004;
end
procedure Node002c begin
set_local_var(LVAR_Asked_3,1);
call Node005;
end
procedure Node003 begin
Reply(mstr(122)+obj_name(dude_obj)+mstr(123));
NLowOption(124,Node002);
NOption(125,Node002,004);
if (is_skill_tagged(SKILL_CONVERSANT)) then
NOption(165,Node014,004);
end
procedure Node004 begin
Reply(126);
NLowOption(127,Node002);
NOption(128,Node002,004);
end
procedure Node005 begin
Reply(mstr(129)+obj_name(dude_obj)+mstr(130));
NLowOption(131,Node002);
NOption(132,Node002,004);
end
procedure Node006 begin
Reply(133);
NLowOption(134,Node009);
NLowOption(135,Node001a);
NOption(136,Node009,004);
NOption(137,Node001a,004);
end
procedure Node007 begin
NMessage(138);
end
procedure Node008 begin
Reply(mstr(139)+obj_name(dude_obj)+mstr(140));
NLowOption(141,Node009);
NLowOption(142,Node007);
NOption(143,Node009,004);
NOption(144,Node007,004);
end
procedure Node009 begin
variable door;
move_obj_inven_to_obj(dude_obj,temple_chest_ptr);
door:=tile_contains_pid_obj(19928,2,PID_ARROYO_CAVE_DOOR);
obj_close(door);
obj_lock(door);
set_map_var(MVAR_Passed_Fighting,Fighting_Started);
set_local_var(LVAR_Start_Trial,1);
NMessage(mstr(145)+obj_name(dude_obj)+mstr(146));
gfade_out(600);
gfade_in(600);
end
procedure Node010 begin
Reply(147);
NLowOption(148,Node011);
NLowOption(149,Node012);
NLowOption(150,Node999);
NOption(151,Node011,004);
NOption(152,Node012,004);
NOption(153,Node999,004);
end
procedure Node011 begin
Reply(154);
NLowOption(155,Node999);
NOption(156,Node999,004);
end
procedure Node012 begin
if (global_var(GVAR_START_ARROYO_TRIAL) == TRIAL_FIGHT) then
Reply(157);
else if (global_var(GVAR_START_ARROYO_TRIAL) == TRIAL_TALK) then
Reply(201);
else
Reply(200);
NLowOption(158,Node012a);
NOption(159,Node012a,004);
end
procedure Node012a begin
if (local_var(LVAR_Trained) == 0) then begin
inc_local_var(LVAR_Trained);
call Node016;
end
end
procedure Node013 begin
floater(160);
end
procedure Node014 begin
Reply(mstr(166)+obj_name(dude_obj)+mstr(167));
NOption(168,Node015,004);
end
procedure Node015 begin
variable skill;
skill:=roll_vs_skill(dude_obj,SKILL_CONVERSANT,0);
if ((is_skill_tagged(SKILL_CONVERSANT)) or (is_success(skill))) then begin
Reply(169);
NOption(171,Node015a,004);
end
else begin
Reply(170);
NOption(172,Node002,004);
end
end
procedure Node015a begin
set_local_var(LVAR_Defeated,1);
set_local_var(LVAR_Start_Trial,2);
set_map_var(MVAR_Passed_Fighting,Fighting_Finished);
set_global_var(GVAR_START_ARROYO_TRIAL,TRIAL_TALK);
end
procedure Node016 begin
if ((is_skill_tagged(SKILL_SMALL_GUNS)) or (is_skill_tagged(SKILL_BIG_GUNS)) or
(is_skill_tagged(SKILL_ENERGY_WEAPONS)) or (is_skill_tagged(SKILL_UNARMED_COMBAT)) or
(is_skill_tagged(SKILL_MELEE)) or (is_skill_tagged(SKILL_THROWING)) or (dude_agility > 6)) then begin
Reply(300);
NOption(301,Node999,004);
end
else begin
Reply(302);
NLowOption(303,Node016a);
NLowOption(304,Node018);
NOption(305,Node016a,004);
NOption(306,Node018,004);
end
end
procedure Node016a begin
variable temp;
gfade_out(600);
gfade_in(600);
game_time_advance(ONE_GAME_HOUR);
critter_mod_skill(dude_obj,SKILL_UNARMED_COMBAT,10);
critter_mod_skill(dude_obj,SKILL_MELEE,10);
call Node017;
end
procedure Node017 begin
Reply(307);
NLowOption(308,Node999);
NOption(309,Node999,004);
end
procedure Node018 begin
Reply(310);
NLowOption(311,Node999);
NOption(312,Node999,004);
end
//xxxxxxxxxxxxxxxxxxxx