×
Create a new article
Write your page title here:
We currently have 56,923 articles on Fallout Wiki. Type your article name above or click on one of the titles below and start writing!



Fallout Wiki
56,923Articles
Holiday Decor 2023.png
FO76 ui roleplay team.pngThis is the transcript of a script file, which runs certain tasks in the game upon execution.
Details
Type Source file
SCRIPTS.LST comment Generic Vault 15 Khan Guard
MSG file N/A
Transcript.png

/*
        Copyright 1998-2003 Interplay Entertainment Corp. All rights reserved.
*/
/*
        Name: Vault 15 Guard
        Location: Vault 15
        Description: Generic guard in vault 15
        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
*/
#define NPC_REACTION_TYPE REACTION_TG
#define NPC_REACTION_VAR 8 /* same as thief variable */
#include "..\headers\define.h"
#include "..\headers\vault15.h"
#define NAME SCRIPT_BCGENGRD
#define TOWN_REP_VAR GVAR_TOWN_REP_VAULT_15
#include "..\headers\command.h"
#include "..\headers\ModReact.h"
#include "..\headers\v15.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 combat_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;
procedure NodeIdleTalk;
procedure canISee;
#define TIMER_IDLE_TALK 1
#define NUMGUARDBLOCKS 5
#define GUARDFLOATSZ 6
//~~~~~~~~~~~~~~~~ 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_Power_Msg (7)
#define LVAR_Caught_Thief (8)
/* 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 i_Guard_Count;
/* Local variables which do not need to be saved between map changes. */
variable Only_Once:=0;
variable guardNum :=0;
variable guardFloatNum := 0;
variable lastCheckTime := 0;
procedure start begin
end
procedure combat_p_proc begin
   if (map_var(MVAR_Vault15_Guards_Attack) == 1) then begin
      if (not obj_in_party(target_obj)) then begin
         attack(dude_obj);
      end
   end
end
procedure timed_event_p_proc begin
   if (fixed_param == TIMER_IDLE_TALK) then begin
      if not combat_is_initialized then begin
         call NodeIdleTalk;
      end
      add_timer_event(self_obj, game_ticks(Random(15, 30)), TIMER_IDLE_TALK);
   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_KHAN_GUARD);
   critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_AI_PACKET,AI_V15_KHAN);
   add_timer_event(self_obj, game_ticks(Random(30, 50)), TIMER_IDLE_TALK);
   GuardNum := i_Guard_Count;
   i_Guard_Count += 1;
   guardFloatNum := GuardNum;
   if (guardFloatNum >= NUMGUARDBLOCKS) then begin
      while (guardFloatNum >= NUMGUARDBLOCKS) do begin
         guardFloatNum -= NUMGUARDBLOCKS;
      end
   end
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) != 0) and (obj_can_see_obj(self_obj,dude_obj))) then begin
      set_local_var(LVAR_Hostile,1);
      if (map_var(MVAR_Vault15_Guards_Attack) != 1) then begin
         set_map_var(MVAR_Vault15_Guards_Attack, 1);
         debug_msg("BCGENGRD: set guards to attack");
      end
      self_attack_dude;
   end
   if ((map_var(MVAR_Darion_Attack) == 1 or map_var(MVAR_Vault15_Guards_Attack)) and local_var(LVAR_Hostile) != 2) then begin
      if not combat_is_initialized then begin
         set_local_var(LVAR_Hostile, 2);
      end
      debug_msg("BCGENGRD: Darion Attack:" + map_var(MVAR_Darion_Attack) + " Guards Attack: " + map_var(MVAR_Vault15_Guards_Attack));
   end else if (map_var(MVAR_Grilled_Player) == 0) then begin
      if (canISee) then begin
         dialogue_system_enter;
      end
   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 (obj_in_party(source_obj)) then begin
      set_local_var(LVAR_Personal_Enemy,1);
      if (map_var(MVAR_Vault15_Guards_Attack) != 1) then begin
         set_map_var(MVAR_Vault15_Guards_Attack, 1);
         debug_msg("BCGENGRD: set guards to attack");
      end
   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:=1;
   Slavery_Tolerant:=SLAVE_PROUD;
   Karma_Perception:=KARMA_PERCEPTION0;
   CheckKarma;
   GetReaction;
   if (map_var(MVAR_Vault15_Guards_Attack) == 0) then begin
       start_gdialog(NAME,self_obj,4,-1,-1);
       gSay_Start;
           call Node001;
       gSay_End;
       end_dialogue;
   end else begin
      call Node002;
   end
   set_local_var(LVAR_Herebefore, 1);
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_evil_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;
   if (local_var(LVAR_Herebefore) == 0) then
      display_msg(mstr(100));
   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(103);
   NOption(104, Node002, 4);
   NOption(105, Node003, 4);
   NLowOption(110, Node998);
end
procedure Node002 begin
   Reply(106);
   ENDHOSTILE;
end
procedure Node003 begin
   if (skill_success(dude_obj, SKILL_CONVERSANT, 0)) then begin
      set_map_var(MVAR_Grilled_Player, 1);
      Reply(107);
      ENDOPTION;
   end else begin
      Reply(108);
      ENDHOSTILE;
   end
end
procedure Node004 begin
   float_msg(self_obj, mstr(109), FLOAT_MSG_RED);
   call Node998;
end
procedure NodeIdleTalk begin
/* variable tile  := 0;
   variable talk  := 0;
   variable count := 0;
   variable count1 := 1;
   while (count < 6 and talk == 0) do begin
      count1 := 1;
      while (count1 < 6 and talk == 0) do begin
         tile := tile_num_in_direction(self_tile, count, count1);
         if (tile_contains_obj_pid(tile, elevation(self_obj), KHAN_GUARD_PID1) or
             tile_contains_obj_pid(tile, elevation(self_obj), KHAN_GUARD_PID2)) then begin
             talk := 1;
         end
         count1 += 1;
      end
      count+= 1;
   end
   if (talk) then begin*/
   if (map_var(MVAR_Vault15_Power) == 1 and local_var(LVAR_Power_Msg) == 0) then begin
      set_local_var(LVAR_Power_Msg, 1);
      float_msg(self_obj, mstr(140 + guardFloatNum), FLOAT_MSG_NORMAL);
   end else begin
      float_msg(self_obj, mstr(110 + (guardFloatNum * GUARDFLOATSZ) + Random(0, 5)), FLOAT_MSG_NORMAL);
   end
// end
end
procedure canISee begin
   if (game_time > lastCheckTime) then begin
      if (obj_can_see_obj(self_obj, dude_obj)) then begin
         return 1;
      end
      lastCheckTime := game_time + (ONE_GAME_MINUTE / 2);
   end
   return 0;
end
//xxxxxxxxxxxxxxxxxxxx