Item Prices during barter

Discussion in 'Fallout General Modding' started by Zorchar, Mar 24, 2020 at 7:34 AM.

  1. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    for this scripting i dont think, hooks will be best,it would allow to set it to 0 but not reset to proto value,ie money would be 0 and not reset to 1,best to use the script that starts th barter session

    edit : should read the docs that come with sfall mod pack,hook script is an sfall over ride that over rides specific vanilla engine events
     
    Last edited: Mar 26, 2020 at 10:24 PM
  2. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    Im trying to think of examples of using hooks and all I can think of are hooks that are used globally, like every time u kill someone, hook a bonus to endurance for ten minutes. I probably don't understand them quite well, so can u give me just a simple example, like a simpler version of my example?

    Edit: The only reason I understand regular scripts is because I saw how it is in the Fallout 2 files. Can u maybe tell me where can I find a working example of the use of hook scripts, so I can understand how they are used?
     
  3. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    dont think u can simulate drug effects with scripts
     
  4. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    Lol. Can u do the script which changes the value to 0, and it remains as 0, even though it is not useful?
     
  5. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    BTW. I have read about hook scripts. Just dont understand exactly how to implement them. seriously like where to even put the INT file?

    Edit:

    The information I found about using hooks was not a complete, step-by-step guide. It was bits and pieces on how to use them script wise.
     
  6. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    Donno why u dont change the proto but this will set caps and rope to 0 if the file is named gl_ w/e

    Code:
    #include "E:\Game Files\Fallout 2\HEADERS\sFall\define_extra.h"
    #include "E:\Game Files\Fallout 2\HEADERS\ITEMPID.h"
    
    procedure start;
    
    procedure start
    begin
       if (game_loaded) then begin
          set_proto_data(PID_BOTTLE_CAPS, PROTO_IT_COST, 0);
          set_proto_data(PID_ROPE, PROTO_IT_COST, 0);
       end
    end
    my test i named it "GL_Item_Prices.int"

    edit : be sure and set the paths to ur header files as ur settup is

    edit : hooks are placed in the reg script folder,they are identified by file name or init_hook in the file for instance : my barter hook is named HS_Barterprice.int,this (HS) identifies it as a hook to barter and is run when barter event happens,can also be identified by
    Code:
    #define HOOK_BARTERPRICE      (10)
    which is used as
    Code:
       if game_loaded then begin
          register_hook(HOOK_BARTERPRICE);
       end
    
    set in the start procedure in a global script(ie named GL_ w/e)
     
    Last edited: Mar 26, 2020 at 11:02 PM
  7. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    I think I got it. It's late in here, but I will try it out tomorrow. This seems very reassuring I think it might be the missing link I had in understanding hooks. Thanks again. I'll post an update later :)
     
  8. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    yes so yea your welcome
     
  9. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    That's so awesome @Nirran. I've tried it out and it works.

    my barterprice.int looks like this:
    Code:
    procedure start;
    
    procedure start begin
       display_msg("Hook");
    end
    
    The hook is called upon when neccecery, but also when starting a new game. I get the "Hook" massage first thing, before registering even. Which condition do I need to add so it wont do at the start of the game?

    Also, are the only possible hooks are the following?

    #define HOOK_TOHIT (0)
    #define HOOK_AFTERHITROLL (1)
    #define HOOK_CALCAPCOST (2)
    #define HOOK_DEATHANIM1 (3)
    #define HOOK_DEATHANIM2 (4)
    #define HOOK_COMBATDAMAGE (5)
    #define HOOK_ONDEATH (6)
    #define HOOK_FINDTARGET (7)
    #define HOOK_USEOBJON (8)
    #define HOOK_REMOVEINVENOBJ (9)
    #define HOOK_BARTERPRICE (10)
    #define HOOK_MOVECOST (11)
    #define HOOK_HEXMOVEBLOCKING (12)
    #define HOOK_HEXAIBLOCKING (13)
    #define HOOK_HEXSHOOTBLOCKING (14)
    #define HOOK_HEXSIGHTBLOCKING (15)
    #define HOOK_ITEMDAMAGE (16)

    So like, I can only use hooks when one out of these 16 actions occur? Can I just add another action and make a new hs_* hook? (I have a feeling that this is a really silly question, so sorry in advance)

    Edit:

    added
    Code:
    if init_hook == 0 then
    
    Now it works perfectly.
     
    Last edited: Mar 27, 2020 at 10:26 PM
  10. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    for that script u should use global script,as it is that wont fire at all except on game start,do this instead name it gl_*

    Code:
    procedure start
    begin
       if (game_loaded) then begin
          set_global_script_repeat(60);\\ this is how many frames per cycle,script will be repeated that many frames
       end else begin
          display_msg("Hook");
       end
    end
    as for the hooks themselves can use as many as u wnat scripot will fire when any and all of the match,loook at this script for ideas

    edit : also hs_ is begining of all hook scrits,tho that doesnt define them,the entire name does,global in the other hand are defiend with name starting GL,for hook nams look in hookscripts.txt' that comes with sfall modders pack
     

    Attached Files:

    Last edited: Mar 27, 2020 at 11:00 PM
  11. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    That explains a lot. Thanks.
     
  12. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    yes it is defined by sfall devs

    can use them as i stated above,but adding new defines wont do anything,needs code in sfall dll to activate it