Fallout 2 mod Balthas/Happy harry's restocking scripts

Discussion in 'Fallout General Modding' started by Question2, Jul 12, 2017.

  1. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    Im trying to fix the problem where they never stock leather armor mk2, the scripts that come with the mapper2 program are easy enough to understand, but they dont bear any resemblance to the ones that the RP uses.

    Original script :

    Code:
    procedure map_enter_p_proc begin
    /* Set up the door state when the player first enters the map */
       modoc_balthas_box_obj := self_obj;
       if (is_loading_game == false) then begin
          if (local_var(LVAR_Restock_Time) < game_time) then begin
             check_restock_item(PID_BOTTLE_CAPS, 475, 525, 100)
             check_restock_item(PID_LEATHER_ARMOR, 1, 1, 100)
             check_restock_item(PID_LEATHER_JACKET, 1, 1, 100)
              check_restock_item(PID_LEATHER_ARMOR_MK_II, 1, 1, 100)
             set_local_var(LVAR_Restock_Time, (random(5,10) * ONE_GAME_DAY) + game_time);
          end
       end
    end
    
    The mibalbox.int script that the RP uses looks completely different however.

    Part of the script :

    Code:
    procedure map_enter_p_proc
    begin
       variable LVar0 := 0;
       variable LVar1 := 0;
       modoc_balthas_box_obj := self_obj;
       if (metarule(22, 0) == 0) then begin
           if ((game_time < 0) and (local_var(1) == 0)) then begin
               set_local_var(0, game_time - 1);
               set_local_var(1, 1);
           end
           if (local_var(0) < game_time) then begin
               LVar0 := create_object_sid(128, 5, 0, -1);
               if (obj_is_carrying_obj_pid(self_obj, 479) > 0) then begin
                   LVar1 := obj_carrying_pid_obj(self_obj, 479);
                   rm_obj_from_inven(self_obj, LVar1);
                   add_obj_to_inven(LVar0, LVar1);
               end
               if (obj_is_carrying_obj_pid(self_obj, 479) > 0) then begin
                   LVar1 := obj_carrying_pid_obj(self_obj, 479);
                   rm_obj_from_inven(self_obj, LVar1);
                   add_obj_to_inven(LVar0, LVar1);
               end
    I dont get how this works. The PIDs dont even make sense, PID 479 are the navcomm parts according to the weapon editor, why does the balthas restocking script have them?
     
  2. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    It's for preventing player from accidentally selling key/quest items to traders and those items would be lost forever when traders restock.
    And killap has already released script source for both UP and RP, why not checking them instead of the decompiled ones that variables are vague?
     
  3. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    Ah, okay. I think I see the bits that affect restocking, but it seems unnecessarily complex.

    Are the script sources installed with the RP? I dont see any folders for them. I dont see them listed as a seperate download on his site either.
     
  4. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    I guess you never check the first post of RP 2.3.3 thread.
     
  5. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    Oh, got the script sources now. OK, these ones make more sense. But for some reason the sfall compiler keeps throwing tons of errors everytime I try to compile them. For example, "condition.h line 107 expecting top-level statement". Am i supposed to do something else to the source scripts to get them to compile?
     
  6. Darek

    Darek is currently unavailable

    Jan 7, 2008
    That is what the code really looks like. :lol:
    Anyway I don't use Headers myself so I haven't seen that error, but I would guess the sfall editor is having trouble finding them. Check if the Headers are located where the script is pointing to.
     
  7. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    Code:
    /* Include Files */
    #include "..\headers\define.h"
    #define NAME                    SCRIPT_MIBALBOX
    #include "..\headers\command.h"
    The headers are in Fallout 2\RP scripts\headers, I moved the mibalbox script to Fallout 2\RP scripts\ and most of the errors are now gone, but now i have two errors : it complains that it cannot open defines.h and command.h, even though the scripts are in the headers subfolder...
     
  8. Magnus

    Magnus Water Chip? Been There, Done That
    Modder

    953
    Dec 6, 2007
    You need to remove all trailing whitespaces in every line in the script.
     
  9. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    What do you mean by trailing white spaces?
     
  10. Magnus

    Magnus Water Chip? Been There, Done That
    Modder

    953
    Dec 6, 2007
    Spaces after the last character in a line.
     
  11. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    I dont see any trailing white spaces though...

    Am i supposed to put the files in some sort of special folder arrangement?

    This is what happens when i try to compile hioutbox.ssl :

    http://i.imgur.com/dwrb2tC.jpg

    This is when HITOUTBOX is in D:\Fallout 2\RP scripts and define.h is in both D:\Fallout 2\RP scripts and D:\Fallout 2\RP scripts\headers.

    I get different errors if HIOUTBOX is in D:\Fallout 2\RP scripts\BROKHILL : http://i.imgur.com/fj8OcQV.jpg

    No clue what those errors are talking about, i didn't modify line 345 or the other scripts, how was killap able to get them to compile without those errors?

    Edit : Okay I found a trailing white space but it wasnt at line 107, it was at line 98.

    The new line errors seem to be that you have to press enter after the last entry in the script.

    The macro undefined error is confusing, in EXPPOINT.H :

    #define EXP_CURED_FANNIE (500)

    Whats wrong with this?

    Same for the macro is redefined error :

    #define FID_MACYBR (16777291) // Added Cyber Dog

    I dont get how killap managed to get those scripts to compile with those errors...
     
    Last edited: Jul 15, 2017
  12. burn

    burn Mildly Dipped
    Modder

    557
    Apr 22, 2012
    If you're not able to get those working with relative paths, you can specify absolute ones.
     
  13. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    The paths arent a problem now, its the macro undefined/redefined parts.
     
  14. Magnus

    Magnus Water Chip? Been There, Done That
    Modder

    953
    Dec 6, 2007
    You're not supposed to put Define.h in multiple folders.

    Are you at all familiar with Windows file path syntax?

    The line "../headers/define.h" means "go back one folder, then find the Headers folder, then find define.h in that folder. So obviously if your .ssl is in RP Scripts that will fail, you need to put it in a subfolder. Basically, leave the folder structure as it is in the RP sources download, and don't move files around.

    The errors you get when you have correct folder structure (top-level statement etc) are due to trailing white-space.

    As for the macro redefinition, are you including multiple define.h's in your script? Are you forgetting an #ifndef block somewhere?
     
  15. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    These are the default RP source scripts. All im doing is editing the items that a merchant stocks, so unless killap included those errors in his scripts, they shouldnt have them.

    I dont see multiple define.hs in the merchant scripts. You dont get any of those macro errors with the RP source scripts?
     
  16. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    The macro redefinition is only a warning. You can comment out "#define EXP_CURED_FANNIE (500)" line and ignore the FID_MACYBR part.
     
  17. Magnus

    Magnus Water Chip? Been There, Done That
    Modder

    953
    Dec 6, 2007
    What I'm wondering is, why is OP getting errors for a Redding macro when he's trying to compile a script for a Vault City merchant box?

    Are you trying to compile all scripts or just the one for the box?
     
  18. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    Because ExpPoint.h is included in Define.h, which is called by nearly every script.
     
  19. Magnus

    Magnus Water Chip? Been There, Done That
    Modder

    953
    Dec 6, 2007
    Oh good lord, you're right. Every time I get back into Fallout 2 scripting it takes a while before I realize how spaghetti it is.
     
  20. Question2

    Question2 It Wandered In From the Wastes

    143
    Jun 20, 2017
    Thanks, commenting out those lines work, im just confused why they need to be commented out if these are the source scripts.