Item Prices during barter

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

  1. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    Hi guys.

    I'm trying to make it so certain characters, or areas, will not accept money, or will value it as zero.
    What do you think is the best way to approach this?

    I have tried changing the base price via script. Didn't work for me. I'm not certain why, so an explanation will be nice. (read-only proto?)

    Is there a way to make the NPC not accept a certain item on the barter screen? I think I have seen such a situation in one of the mods.

    Thanks.

    EDIT:

    I have found a specific easy solution for money. I can just replace the amount of money dude has, with the same amount of a different proto with base price zero. It would still be very useful for me if you'll give me a solution for items, as well.
     
    Last edited: Mar 24, 2020 at 4:50 PM
  2. MIB88

    MIB88 So Old I'm Losing Radiation Signs
    Modder

    Feb 22, 2005
    Don't know how you could do it from the barter screen. However, there are two options I can think of which would be easy to implement, as all it would take is an inventory check. Both are kind of sloppy, though.

    The first would be to simply have a float dialog with the character saying "Hey, take this stuff back" while the items are removed from the trader's box and added back to the player character's inventory.

    The second way would be to force a dialog box saying something similar, and giving only speech options which lead to opening the barter screen, forcing the character to eventually take the items or go through this process over and over.

    One more possibility. You know how when you try to trade with a character and the trade isn't equal to or greater than what is in the shopkeeper's trade box? It says something like "Not good enough" or something like that. Can that situation be forced with
    sfall, a global script, or a hook script if the specific items are in the trader's inventory?
     
  3. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    Thanks for the suggestions @MIB88. The first two options do not work for me specifically, since the NPC WILL be trading as if you give him the value of the items. The third option seems best, but I never used these sfall options so i'm not really sure how.

    Edit: Oh, ok. Now I get it. It will work, thanks. Not ideal, as you said.
     
  4. Lexx

    Lexx Background Radiant
    Moderator Modder

    Apr 24, 2005
    If they will never accept said money with value, just override the proto item value on dialog start and revert it at the end of the dialog? This way you can easily control which critter would give you > 0 for an item.
     
  5. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    as lex said,over ride the item price wiht
    Code:
    #define PROTO_IT_COST       (120)
    #define PID_BOTTLE_CAPS                     (41)
    set_proto_data(PID_BOTTLE_CAPS, PROTO_IT_COST, 0);
    
    before entering barter and

    Code:
    #define PROTO_IT_COST       (120)
    #define PID_BOTTLE_CAPS                     (41)
    set_proto_data(PID_BOTTLE_CAPS, PROTO_IT_COST, 1);
    
    after leaving barter

    edit: should work for items too,just replace caps proto id wiht the items id
     
    Last edited: Mar 25, 2020 at 10:14 PM
  6. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    @Lexx @Nirran I have tried this code in a different situtaion and it didnt change the price. have u ever experienced such a thing?
     
  7. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    Did a test,with bottle caps,was 1 even when set to 0,with rope set to 0 ,it was 0 on barter table,so can use ur solution for caps and this method for items
     
  8. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    I tried a few weeks ago the following:

    Code:
    procedure description_p_proc begin
    
       script_overrides;
       set_proto_data(PID_MEAT_JERKY,it_weight,(0));
       set_proto_data(PID_MEAT_JERKY,it_cost,(55));
       display_msg(""+(proto_data(PID_MEAT_JERKY,it_weight)));
       display_msg(""+(proto_data(PID_MEAT_JERKY,it_cost)));
    
    end
    
    
    It didn't work also. wish I knew why. Thanks a lot.
     
  9. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    what script is code on?i used barter hook script
     
  10. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    I just used it on a random critter when asking for description. Don't know how to use hooks.
     
  11. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    best place is to add it to the merchant script and as lex said set to desired cost right before barter in the dialog,then reset it to desired when barter closes.
     
  12. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    I see what I did wrong.
    you defined proto_it_cost to 120. why so? how did u know? whats the number for size? i used it_cost which is defined as 14. can u explain the diffrence between proto_data's data member and set_proto_data's offset int?
     
    Last edited: Mar 26, 2020 at 2:11 AM
  13. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    i copied from the header file 'define_extra.h' that comes with sfall modders pack

    this is the list
    Code:
    // items
    #define PROTO_IT_FLAGS       (24)
    #define PROTO_IT_TYPE        (32)
    #define PROTO_IT_MATERIAL   (108)
    #define PROTO_IT_SIZE       (112)
    #define PROTO_IT_WEIGHT     (116)
    #define PROTO_IT_COST       (120)
    #define PROTO_IT_INV_FID    (124)
     
  14. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    Awesome. Thank you very much.
     
  15. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    in case u are looking for specific proto data that isnt included with sfall this code will spam and if u set

    Code:
    ;Set this to a valid path to save a copy of the console contents
    ConsoleOutputPath="console.txt"
    in ddraw.ini and compile this in gl_test,int

    Code:
    procedure start;
    procedure Check_Proto_Data;
    
    procedure start
    begin
          if (game_loaded) then begin
              call Check_Proto_Data;
          end
    end
    
    procedure Check_Proto_Data
    begin
       variable LVar0 := 0;
       while(LVar0 < 500) do begin
          LVar0 := LVar0 + 1;
          display_msg(LVar0 + " " + get_proto_data(obj_pid(dude_obj), LVar0));
       end
    end
    then logg out and u can ,by elimination,find the data ur looking for in fo2\console.txt
     
  16. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    Wow. That's very useful info. Also regarding global scripts. Much appreciated.
     
  17. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    actualy i redid my test and it was my hook script causing the cpas to be value 1 irregardless,when i removed the relavent code from my hookscript,setting caps to 0 works on the table to,so this can b used for caps as well
     
  18. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    Do you mind sharing the script and explaining how to install it?
     
  19. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    sure thing,what exactly u looking for?have one mechant in mind?can use a barter hook script for that
     
  20. Zorchar

    Zorchar First time out of the vault

    64
    Jun 18, 2018
    I basically want to know how to use hook scripts, so let's say a merchant who will value money as 0 on barter screen, using a hook script (barter, or otherwise) would be sufficient for me.

    If you can do the same merchant valuing all weapons, for example, as 0, or not accepting weapons on barter screen once you click "offer" then it would be ideal. I guess this is too much work, though, and I can figure it out myself actually. The REALLY essential thing for me is understanding how to implement a hook script.