Fallout Wiki
Advertisement
Fallout Wiki
Details
Type Source file
SCRIPTS.LST comment San Fran Shi Kids
MSG file N/A
Transcript

/*
        Copyright 1998-2003 Interplay Entertainment Corp. All rights reserved.
*/
/*
        Name: Shi Kids
        Location: San Francisco
        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\<TownName.h>"
#define NAME SCRIPT_FCSKIDS
#define TOWN_REP_VAR (GVAR_TOWN_REP_SAN_FRANCISCO)
#include "..\headers\command.h"
#include "..\headers\ModReact.h"
#include "..\headers\sanfran.h"
/* 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 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 Node002;
procedure Node003;
procedure Node004;
#define STATE_ASLEEP 1
#define STATE_RUN 2
#define STATE_FOLLOW 3
#define TIMER_TALK 1
#define TIMER_FOLLOW 2
#define TIMER_RUN 3
#define TIMER_MOVE 4
#define CHILD_RUN_DISTANCE 8
//~~~~~~~~~~~~~~~~ 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_State (7)
/* 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_) */
/* Local variables which do not need to be saved between map changes. */
variable Only_Once:=0;
variable pickupWarning;
variable starttile;
procedure push_p_proc begin
end
procedure start begin
end
procedure timed_event_p_proc begin
   debug_msg("FCSKIDS: timer fixed_param: " + fixed_param);
   if (fixed_param == TIMER_TALK) then begin
      if (not combat_is_initialized and local_var(LVAR_State) != STATE_RUN) then begin
         if (obj_can_see_obj(self_obj, dude_obj)) then
            call talk_p_proc;
      end
      add_timer_event(self_obj, game_ticks(Random(5, 100)), TIMER_TALK);
   end else if (fixed_param == TIMER_FOLLOW) then begin
      variable tile;
      if (local_var(LVAR_State) == STATE_FOLLOW) then begin
         tile := tile_num_in_direction(dude_tile, Random(0, 5), Random(1, 4));
         debug_msg("FCKIDS: tile: " + tile + " self_tile: " + self_tile);
         if (self_tile != tile) then begin
            debug_msg("FCKIDS: should be animating");
            reg_anim_clear(self_obj);
            reg_anim_begin();
            animate_run_to_tile(tile);
            reg_anim_end();
         end
         if (stat_success(dude_obj, STAT_ch, 0)) then begin
            debug_msg("FCKIDS: should be following");
            add_timer_event(self_obj, game_ticks(Random(1, 3)), TIMER_FOLLOW);
         end else begin
            set_local_var(LVAR_State, 0);
         end
      end
   end else if (fixed_param == TIMER_RUN) then begin
      if (local_var(LVAR_State) == STATE_RUN) then begin
         if (tile_distance_objs(self_obj, dude_obj) < CHILD_RUN_DISTANCE) then begin
            Flee_From_Dude
            add_timer_event(self_obj, game_ticks(Random(1, 3)), TIMER_RUN);
         end else begin
            set_local_var(LVAR_State, 0);
         end
      end
   end else if (fixed_param == TIMER_MOVE) then begin
      if (local_var(LVAR_State) == 0 and not combat_is_initialized) then begin
         reg_anim_clear(self_obj);
         reg_anim_begin();
         animate_run_to_tile(tile_num_in_direction(starttile, Random(0, 5), Random(5, 20)));
         reg_anim_end();
      end
      add_timer_event(self_obj, game_ticks(Random(1, 120)), TIMER_MOVE);
   end
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_SAN_FRAN_SHI);
   critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_AI_PACKET,AI_CHILD);
   add_timer_event(self_obj, game_ticks(Random(1, 120)), TIMER_MOVE);
   add_timer_event(self_obj, game_ticks(Random(5, 100)), TIMER_TALK);
   starttile := self_tile;
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 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_Hostile) == 2) and (obj_can_see_obj(self_obj,dude_obj))) then begin
       set_local_var(LVAR_Hostile,1);
       attack(dude_obj);
   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 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) 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
/* 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 () then begin
       start_gdialog(NAME,self_obj,4,-1,-1);
       gSay_Start;
           call Node001;
       gSay_End;
       end_dialogue;
   end
   */
   debug_msg("FCKIDS: party_size: " + party_size);
   if (has_rep_childkiller or san_fran_flag(SF_SHI_ENEMY)) then begin
      call Node004;
   end else if (dude_wearing_power_armor) then begin
      call Node003;
   end else if (party_size > 1) then begin
      call Node002;
   end else begin
      call Node001;
   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*/
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;
   display_msg(mstr(100));
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;
   if (local_var(LVAR_Herebefore) == 0) then
      display_msg(mstr(101));
   else
      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
   float_msg(self_obj, mstr(103 + Random(0, 7)), FLOAT_MSG_YELLOW);
end
procedure Node002 begin
   variable pickon;
   variable count;
   if (Myron_In_Party) then
      count += 1;
   if (Marcus_In_Party) then
      count += 1;
   if (MacRae_In_Party) then
      count += 1;
   if (Sulik_In_Party) then
      count += 1;
   if (Lenny_In_Party) then
      count += 1;
   if (Cyberdog_In_Party) then
      count += 1;
   if (Goris_In_Party) then
      count += 1;
   if (Davin_In_Party) then
      count += 1;
   if (Miria_In_Party) then
      count += 1;
   if (Robobrain_In_Party) then
      count += 1;
   pickon := Random(0, count);
#define PARTYCHK(whocheck, msg, nummax) \
   if (whocheck) then begin \
      if (pickon == 0) then begin \
         float_msg(self_obj, mstr(msg + Random(0, nummax)), FLOAT_MSG_NORMAL); \
      end else begin \
         pickon -= 1; \
      end \
   end
   PARTYCHK(Myron_In_Party, 111, 1)
   PARTYCHK(Marcus_In_Party, 113, 1)
   PARTYCHK(MacRae_In_Party, 115, 1)
   PARTYCHK(Sulik_In_Party, 117, 1)
   PARTYCHK(Lenny_In_Party, 119, 1)
   PARTYCHK(Cyberdog_In_Party, 121, 0)
   PARTYCHK(Goris_In_Party, 122, 0)
   PARTYCHK(Davin_In_Party, 123, 0)
   PARTYCHK(Miria_In_Party, 124, 0)
   PARTYCHK(Robobrain_In_Party, 125, 0)
end
procedure Node003 begin
   variable val;
   val := Random(0, 3);
   if (val == 0) then begin
      set_local_var(LVAR_State, STATE_RUN);
      add_timer_event(self_obj, 0, TIMER_RUN);
   end else if (val == 2 or val == 3) then begin
      set_local_var(LVAR_State, STATE_FOLLOW);
      add_timer_event(self_obj, 0, TIMER_FOLLOW);
   end
   float_msg(self_obj, mstr(126 + val), FLOAT_MSG_NORMAL);
end
procedure Node004 begin
   set_local_var(LVAR_State, STATE_RUN);
   add_timer_event(self_obj, 0, TIMER_RUN);
   float_msg(self_obj, mstr(130 + Random(0, 3)), FLOAT_MSG_RED);
end
//xxxxxxxxxxxxxxxxxxxx

Advertisement