Scripting isn't as easy as I thought...

Discussion in 'Fallout General Modding' started by Robert B, Jun 3, 2017.

  1. Robert B

    Robert B Kitty's got some rads!

    May 29, 2017
    Alright, I've spent the last 8 hours getting dialogs to work and have run into a problem. It's all good news, except... I call procedure Node998, but combat isn't starting.

    Here's the calling procedure and the called node...

    Code:
    
    procedure Node001
    begin
        gsay_reply(1312, 110);
        giq_option(4,1312,message_str(1312, 111) + obj_name(dude_obj) + message_str(1312, 112) ,Node002,50);
        giq_option(4,1312,114,Node999,50);
        giq_option(4,1312,115,Node998,50);
        giq_option(-3,1312,113,Node003,50);
    end
    
    procedure Node998
    begin
    end
    
    
    All other aspects of dialogs appear to be working. I just can't get this NPC to react to the dialog option that initiates combat. ...of course, if I punch him then combat occurs.

    I did review this thread (among others), but it isn't clear to me what the final resolution was for Jotisz.

    http://www.nma-fallout.com/threads/can-i-get-some-help-with-this-script.187077/page-6#post-3830243

    Thoughts?
     
  2. fffffffff

    fffffffff First time out of the vault

    Mar 20, 2017
    Code:
    procedure Node998 begin
       set_local_var(LVAR_Hostile,2);
    end
    Because your procedure is empty and that's how it should look like in template
     
  3. Lexx

    Lexx Lived Through the Heat Death
    Moderator

    Apr 24, 2005
    Uh, why don't you use the dialog macros?
    Code:
    procedure Node001 begin
       Reply(100);
      
       NOption(250,Node002,004);
       NLowOption(2501,Node002);
       NOption(g_bye,Node999,004);
       NLowOption(g_bye,Node999);
    end
    
    ...
    I've noticed that many new people aren't using them, but I have no idea why. They are all over the vanilla Fallout 2 scripts.
     
    • [Like] [Like] x 1
  4. NovaRain

    NovaRain Casual Modder

    Mar 10, 2007
    I'd guess most of them working with decompiled scripts instead of the original script source.
     
  5. Robert B

    Robert B Kitty's got some rads!

    May 29, 2017
    @NovaRain, you are correct. Before I knew to utilize the headers and the source scripts from the BIS Mapper, I created my first custom scripts (critter, dialog and location) from the decompiled scripts. This is the first problem I've run into using the decompiled reference scripts. All other critter/location scripts are running fine. Who knew that dialog would be a special case that required using the dialog macros?!?!?!

    @Lexx, I'll go ahead and re-write my dialog logic using the macros and see if that resolves the problem. I should probably review/rewrite all my other critter, dialog and location scripts correctly as well... ...I just dread how much effort that will be.

    @fffffffff, Understood. There are conflicting statements out on the forum that say that you need to set the hostile local variable and others that say you don't. Just adding the LVAR (along with the define command and updating the scripts.lst) doesn't solve the problem. I'll see how things work once I rewrite the dialog using the macro commands.

    Thank you for your feedback and support!
     
  6. Lexx

    Lexx Lived Through the Heat Death
    Moderator

    Apr 24, 2005
    "Node998" is nothing but a normal procedure. The comment in the script says "always ends in combat", but that's just a standard set by the developers. You can also make "Node1" end in combat or "ThisIsCombat". No difference here.

    It works like this: Once the procedure is called, you are setting a variable (usually LVAR_Hostile, like in the example above). The dialog screen only closes because there is nothing else in this procedure. Following this, the procedure critter_p_proc (runs constantly) then checks for the value of the variable and if it is X, it will start combat ( "attack(dude_obj);" ). It's that simple, really.
     
  7. Robert B

    Robert B Kitty's got some rads!

    May 29, 2017
    Ah, so that finally makes sense. I was confused in thinking that Node998 was somehow hard-coded with attack logic. I just added in the critter_p_proc statements and everything is now working as expected. Maybe I don't have to rewrite the current scripts and can just do it for all new ones... :)