Adding new item to merchant store.

In DIFFLKBOX.ssl, it's Flick 'box', so his store, you should find this procedure:
Code:
procedure map_enter_p_proc begin
   den_flick_box_obj := self_obj;
/* Set up the locked state when the player first enters the map */
   if (local_var(LVAR_Set_Door_Status) == 0) then begin
       set_local_var(LVAR_Set_Door_Status,1);
       set_local_var(LVAR_Locked,LOCKED_STATUS);
       set_local_var(LVAR_Trapped,TRAPPED_STATUS);
   end

   if (local_var(LVAR_Restock_Time) < game_time) then begin
      check_restock_item(PID_BOTTLE_CAPS, 148, 3512, 100)
      check_restock_item(PID_LEATHER_ARMOR, 1, 1, 80)
      check_restock_item(PID_KNIFE, 1, 2, 100)
      check_restock_item(PID_10MM_PISTOL, 1, 2, 95)
      check_restock_item(PID_10MM_JHP, 5, 10, 100)
      check_restock_item(PID_10MM_AP, 1, 2, 20)
      check_restock_item(PID_STIMPAK, 1, 2, 80)
      check_restock_item(PID_BUFFOUT, 1, 1, 20)
      check_restock_item(PID_JET, 3, 7, 100)
      check_restock_item(PID_GUNS_AND_BULLETS, 1, 1, 10)
      check_restock_item(PID_FLARE, 3, 9, 100)
      set_local_var(LVAR_Restock_Time, (random(7,14) * ONE_GAME_DAY) + game_time);
   end

   if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
       obj_lock(self_obj);
   end
 
   else begin
       obj_unlock(self_obj);
   end
end

Add your new item, you can use check_restock_item and define the ramdom percentage with the last number , or if you always want it to appear you can also use give_pid_qty(self_obj, PID_ITEM, Quantity number).

Your item pid must be registered in your itempid.h, and the proto in the item.lst, but sfall script editor should report a error in case you forgot.
 
In DIFFLKBOX.ssl, it's Flick 'box', so his store, you should find this procedure:
Code:
procedure map_enter_p_proc begin
   den_flick_box_obj := self_obj;
/* Set up the locked state when the player first enters the map */
   if (local_var(LVAR_Set_Door_Status) == 0) then begin
       set_local_var(LVAR_Set_Door_Status,1);
       set_local_var(LVAR_Locked,LOCKED_STATUS);
       set_local_var(LVAR_Trapped,TRAPPED_STATUS);
   end

   if (local_var(LVAR_Restock_Time) < game_time) then begin
      check_restock_item(PID_BOTTLE_CAPS, 148, 3512, 100)
      check_restock_item(PID_LEATHER_ARMOR, 1, 1, 80)
      check_restock_item(PID_KNIFE, 1, 2, 100)
      check_restock_item(PID_10MM_PISTOL, 1, 2, 95)
      check_restock_item(PID_10MM_JHP, 5, 10, 100)
      check_restock_item(PID_10MM_AP, 1, 2, 20)
      check_restock_item(PID_STIMPAK, 1, 2, 80)
      check_restock_item(PID_BUFFOUT, 1, 1, 20)
      check_restock_item(PID_JET, 3, 7, 100)
      check_restock_item(PID_GUNS_AND_BULLETS, 1, 1, 10)
      check_restock_item(PID_FLARE, 3, 9, 100)
      set_local_var(LVAR_Restock_Time, (random(7,14) * ONE_GAME_DAY) + game_time);
   end

   if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
       obj_lock(self_obj);
   end
 
   else begin
       obj_unlock(self_obj);
   end
end

Add your new item, you can use check_restock_item and define the ramdom percentage with the last number , or if you always want it to appear you can also use give_pid_qty(self_obj, PID_ITEM, Quantity number).

Your item pid must be registered in your itempid.h, and the proto in the item.lst, but sfall script editor should report a error in case you forgot.
Thx for help.
I've added a line
Code:
check_restock_item(532, 2, 2, 100)
where 532 is my new item pid, 00000532.pro is on the item.lst list and in F2/data/proto/items but when i ask flick to show his store inventory or just barter with him my new ammo doesn't shows...
 
Thx for help.
I've added a line
Code:
check_restock_item(532, 2, 2, 100)
where 532 is my new item pid, 00000532.pro is on the item.lst list and in F2/data/proto/items but when i ask flick to show his store inventory or just barter with him my new ammo doesn't shows...
As i've just checked the script DIFFLKBOX.ssl isn't even triggered (run) by game engine...
 
Did you register your new PID in the itempid.h? Use that, like the vanilla script does, not the pro file number. Sorry if it seem obvious to say but you compiled the script ? The game launch INT files, compiled script format, and when they are in the appropriate script folder of your game or mod. SSL is decompiled script format.

Edit, and since the barter inventory is on map_enter_p_proc procedure, you need to change map then come back to the Den to be sure the merchant update his inventory, if you load a save directly in the Den.

Edit2, and it seem Flick has 2 barter box script, the other one being DIFLIBOX apparently. Add your item to this one too.
 
Last edited:
Did you register your new PID in the itempid.h? Use that, like the vanilla script does, not the pro file number. Sorry if it seem obvious to say but you compiled the script ? The game launch INT files, compiled script format, and when they are in the appropriate script folder of your game or mod. SSL is decompiled script format.

Edit, and since the barter inventory is on map_enter_p_proc procedure, you need to change map then come back to the Den to be sure the merchant update his inventory, if you load a save directly in the Den.

Edit2, and it seem Flick has 2 barter box script, the other one being DIFLIBOX apparently. Add your item to this one too.
Sorry, but i've changed testing to sajag trader in KLAMATH. Now I've added the line:
Code:
check_restock_item(PID_SHOTGUN_SHELLS_FMJ, 2, 2, 100)
to the
map_enter_p_proc
procedure in sajag
kisbox.int
box script and no succeed. Moreover to the test purpose i've added simple text printing msg function to the
procedure and it's not called at all so that means that as i said before the script isn't even called.
When does the box traders scripts have to be called by game engine? When i click "trade" when talking to the guy?
 
Sorry, but i've changed testing to sajag trader in KLAMATH. Now I've added the line:
Code:
check_restock_item(PID_SHOTGUN_SHELLS_FMJ, 2, 2, 100)
to the procedure in sajag box script and no succeed. Moreover to the test purpose i've added simple text printing msg function to the procedure and it's not called at all so that means that as i said before the script isn't even called.
When does the box traders scripts have to be called by game engine? When i click "trade" when talking to the guy?
PS.
Of course i've defined
PID_SHOTGUN_SHELLS_FMJ
in
ITEMPID.H
, compiled the script to KISBOX.int and moved to F2/data/scripts.
 
I just added a cat's paw to Sajag kisbox inventory for testing and it work, NMA won't let me upload a ssl file for some reason so:
https://mega.nz/file/OI0SwQyI#fruWyDddjYFKZ6UcM8S1DMFEfJTkuHHmcm8FhYz38DI

If you did exactly the same thing as in the file, Mulligun, then all I can think of is that there is something wrong with your item? Can you upload your proto file for testing?
Ok, thx for Your help. Now all works:-)

diFliBox is the correct spelling,ur using the wrong script name
Yes, becouse as i said i've changed from flix to sajag so the script for him I'll be KISBOX.int.


Maybe You guys know how to use B-team mod with f2 v 1.02. The mod tell to rename B-team.dat to patch000.dat while i already have patch000.dat frm 1.02 patch...
 
Maybe You guys know how to use B-team mod with f2 v 1.02. The mod tell to rename B-team.dat to patch000.dat while i already have patch000.dat frm 1.02 patch...


unpack b-team to fo2\ main folder(with tool such as 'dat explorer')
 
Oh god, no. Don't use the B-Team mod. This thing is ages old and outdated. Besides, Sfall offers exactly the same functionality with the party armor mod ...
 
In DIFFLKBOX.ssl, it's Flick 'box', so his store, you should find this procedure:
Code:
procedure map_enter_p_proc begin
   den_flick_box_obj := self_obj;
/* Set up the locked state when the player first enters the map */
   if (local_var(LVAR_Set_Door_Status) == 0) then begin
       set_local_var(LVAR_Set_Door_Status,1);
       set_local_var(LVAR_Locked,LOCKED_STATUS);
       set_local_var(LVAR_Trapped,TRAPPED_STATUS);
   end

   if (local_var(LVAR_Restock_Time) < game_time) then begin
      check_restock_item(PID_BOTTLE_CAPS, 148, 3512, 100)
      check_restock_item(PID_LEATHER_ARMOR, 1, 1, 80)
      check_restock_item(PID_KNIFE, 1, 2, 100)
      check_restock_item(PID_10MM_PISTOL, 1, 2, 95)
      check_restock_item(PID_10MM_JHP, 5, 10, 100)
      check_restock_item(PID_10MM_AP, 1, 2, 20)
      check_restock_item(PID_STIMPAK, 1, 2, 80)
      check_restock_item(PID_BUFFOUT, 1, 1, 20)
      check_restock_item(PID_JET, 3, 7, 100)
      check_restock_item(PID_GUNS_AND_BULLETS, 1, 1, 10)
      check_restock_item(PID_FLARE, 3, 9, 100)
      set_local_var(LVAR_Restock_Time, (random(7,14) * ONE_GAME_DAY) + game_time);
   end

   if (local_var(LVAR_Locked) == STATE_ACTIVE) then begin
       obj_lock(self_obj);
   end
 
   else begin
       obj_unlock(self_obj);
   end
end

Add your new item, you can use check_restock_item and define the ramdom percentage with the last number , or if you always want it to appear you can also use give_pid_qty(self_obj, PID_ITEM, Quantity number).

Your item pid must be registered in your itempid.h, and the proto in the item.lst, but sfall script editor should report a error in case you forgot.
Can I understand these lines
check_restock_item(PID_JET, 3, 7, 100)
check_restock_item(PID_GUNS_AND_BULLETS, 1, 1, 10)

Is to spawn with 100% chance (certainty) an amount from 3 to 7 jets in Flick's shop inventory.
And a certainty of 10% to spawn a guns and bullets magazine?

If so, what determine this 10% chance? Random number generator or some stat check?
 
The easiest is to open ssl scripts with sfall script editor, in most cases it provide a description of the lines functions when you pass the mouse on them. Very useful.
 
The game rolls a d100 dice (random number generator), and if the number is less or equal to the chance value, restock the item.
Is there any other factor affect the check versus that d100:
- Primary Stat like CHARISMA, LUCK, PERCEPTION.
- Secondary Stat like Barter
- Perk like Master Trader
- Misc data like amount of gold/bottlecap on PC's inventory.
- Misc data like the kind of weapons on the active hand (does wielding expensive weapons be a factor?)
The easiest is to open ssl scripts with sfall script editor, in most cases it provide a description of the lines functions when you pass the mouse on them. Very useful.
Too hard for me.
 
Not sure if I'm slightly amused or tired of it... No, there is no luck involved. :D It's a simple random(1,100) and that's all there is.

/Edit: Here is the code.
 
Is there any other factor affect the check versus that d100:
- Primary Stat like CHARISMA, LUCK, PERCEPTION.
- Secondary Stat like Barter
- Perk like Master Trader
- Misc data like amount of gold/bottlecap on PC's inventory.
- Misc data like the kind of weapons on the active hand (does wielding expensive weapons be a factor?)

When a action check conditions like the dude stats, the code has said conditions written.
if (dude_strength < 8), if (has_skill(dude_obj, SKILL_GAMBLING) >= 80), NOption(140, node16, 008);, ect
 
Not sure if I'm slightly amused or tired of it... No, there is no luck involved. :D It's a simple random(1,100) and that's all there is.

/Edit: Here is the code.
I am reading the code...

And while you are certain no luck affecting, I am having three games ET TU, and two games RP saying otherwise. I am believing you, as a matter of principle (no, really, I do), but I am also have my own data saying otherwise. This discrepancy is why I am so insistent on digging out the codes.

EDIT: okay, I am trying experiments. I will use two slightly different build with Luck 2 and Luck 8 and testing several times with Klamath's two shops. Excel list to count items. Will post data here.
 
Last edited:
Back
Top