Such a lack of hostility...

holodog

First time out of the vault
Hey all, after many, many years of enjoying Fallout, I've decided to try my hand at modding FO2. So far everything's working out well.

I've been using the Fanmade Fallout Dialog Editor for the NPC interactions, and that works very well. However I can't get a hostile conversational response to touch off combat.

The code:
--------------------------------------------------------------------------------
procedure Node001
begin
// [200] "Get the hell off my lawn, you damn tribal! Doncha see what happened to the *last* tribal that wandered onto my lawn? (He gestures contemptuously at the rotting corpse nearby and pats the muzzle of the ancient, rusted pistol in his hand)"
Reply(200);
// [201] "Alright already, I'm going. (leave)"
NOption(201,Node999,4);
// [202] "I just wanted to get directions..."
NOption(202,Node002,4);
// [203] "Heh. Angry douchebags amuse me."
BOption(203,Node998,4);
// [204] "Heh. Heh. Hehehehhe. Old man mad."
NOption(204,Node003,-3);
end
-----------------------------------------------------------------------------------

And of course, Node998 is defined as:

----------------------------------------------------------------------------------
procedure Node998 begin
set_local_var(LVAR_Hostile,2);
end
-----------------------------------------------------------------------------------

The conversational thread code is outputted by the FMDialog tool.

Whenever I select a hostile answer, the dialog sequence just closes itself - it doesn't crash the editor, or anything.

Does anyone see anything obviously wrong?
 
Make sure you have something in critter_proc like this:

IF LVAR_Hostile THEN Nuke_Dude;
 
I do, I think:

Code:
procedure critter_p_proc begin

if ((local_var(LVAR_Hostile) != 0) and (obj_can_see_obj(self_obj,dude_obj))) then begin
set_local_var(LVAR_Hostile,1);
end

LVAR_HOSTILE is instantiated with a value of 5.

I'm new to FO2 scripting, obviously, so I'm trying to piece what I can together from existing code sample and what I can find online.
 
Not if that's all of it. You need some attack command (probably Attack or Attack_setup or some such), just shuffling around the hostility variable won't do anything in itself.
 
Holodog, did you test the script in game? You need to edit the mapper configuration file to have critters attack you: there is an entry wihich says something like "run mapper as game = 0". Change the value.
 
Heh, I'm an idiot.

The reason this wasn't working, I think, was because of a combination of the mapper cfg settings, like Sirren suggested, and me neglecting to define the # of localvars for each new file in SCRIPTS.lst

Thank you both - all seems well now.
 
Ok, so this problem hasn't entirely gone away.

Now, when I test the map in the editor, the first time I trigger the hostile response the NPC attacks me, like he's supposed to. However, if I hit F8 again to close out the test, and then relaunch the test, he won't attack me again. The conversation just closes out.

If I shut down the map editor entirely, then relaunch it and test the map, he does what he's supposed to.

So what gives? Any ideas?

The only thing I can think of is that the NPCs hostility LVAR doesn't get reset correctly when I run the tester more than once.
 
Here's the entire character code:

Code:
/* Include Files */


//Overrides the pickup p proc.

#include ".\headers\define.h"

#define NAME                    SCRIPT_RUFUS
#define TOWN_REP_VAR            0

#include ".\headers\command.h"
#include ".\headers\ModReact.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;

/* Script Specific Procedure Calls */
procedure Node998;                                      // This Node is Always Combat
procedure Node999;                                      // This Node is Always Ending


procedure Node001;
procedure Node002;
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 Node016;
procedure Node017;
procedure Node018;
procedure Node019;
procedure Node020;
procedure Node021;
procedure Node022;
procedure Node023;
procedure Node024;
procedure Node025;
procedure Node026;
procedure Node027;
procedure Node028;
procedure Node029;
procedure Node030;
procedure Node031;
procedure Node032;
procedure Node033;
procedure Node034;
procedure Node035;
procedure Node036;
procedure Node037;


#define LVAR_Herebefore                 (0)
#define LVAR_Hostile			(5)
#define LVAR_Personal_Enemy             (6)
#define LVAR_Caught_Thief               (7)

variable Only_Once:=0;

procedure start begin
end

procedure map_enter_p_proc begin
   Only_Once:=0;
//   critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_);
//   critter_add_trait(self_obj,TRAIT_OBJECT,OBJECT_AI_PACKET,AI_);
end

procedure critter_p_proc begin

   if ((local_var(LVAR_Hostile) == 1) and (obj_can_see_obj(self_obj,dude_obj))) then begin
       self_attack_dude;
   end

end

procedure damage_p_proc begin

   if (obj_in_party(source_obj)) then begin
       set_local_var(LVAR_Personal_Enemy,1);
   end
end

procedure pickup_p_proc begin
   if (source_obj == dude_obj) then begin
       set_local_var(LVAR_Hostile,2);
   end
end

procedure talk_p_proc begin
   Evil_Critter:=0;
   Slavery_Tolerant:=SLAVE_TOLERANT;
   Karma_Perception:=KARMA_PERCEPTION1;
   CheckKarma;
   GetReaction;
   if (1) then begin
      start_gdialog(NAME,self_obj,4,-1,-1);
      gSay_Start;
      call Node001;
      gSay_End;
      end_dialogue;
   end
end

procedure timed_event_p_proc begin
end

procedure destroy_p_proc begin

/* Increment the aligned critter counter*/
   inc_good_critter
/* inc_evil_critter */
/* inc_neutral_critter */

/* Set global_variable for Enemy status*/
end


procedure look_at_p_proc begin
   script_overrides;
   if (local_var(LVAR_Herebefore) == 0) then
      display_mstr(100);
   else
      display_mstr(101);
end

procedure description_p_proc begin
   script_overrides;
   display_mstr(102);
end


procedure use_skill_on_p_proc begin
end


procedure Node998 begin
set_local_var(LVAR_Hostile,1);
end

procedure Node999 begin
debug_msg("LVAR_Herebefore == "+local_var(LVAR_Herebefore));
if (local_var(LVAR_Herebefore)==0) then
begin
set_local_var(LVAR_Herebefore,1);
end
end

The relevant dialog that triggers combat is:

Code:
BOption(203, Node998, 4);
[/code]
 
Now, when I test the map in the editor, the first time I trigger the hostile response the NPC attacks me, like he's supposed to. However, if I hit F8 again to close out the test, and then relaunch the test, he won't attack me again. The conversation just closes out.

If I shut down the map editor entirely, then relaunch it and test the map, he does what he's supposed to.

Your dialog is ok, its just a mapper fault i think, it happened many times for me too.
If you test this script in game(not mapper) then it will work fine.
 
Back
Top