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
Thx for help.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.
check_restock_item(532, 2, 2, 100)
As i've just checked the script DIFFLKBOX.ssl isn't even triggered (run) by game engine...Thx for help.
I've added a line
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...Code:check_restock_item(532, 2, 2, 100)
Sorry, but i've changed testing to sajag trader in KLAMATH. Now I've added the line: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.
check_restock_item(PID_SHOTGUN_SHELLS_FMJ, 2, 2, 100)
procedure in sajagmap_enter_p_proc
box script and no succeed. Moreover to the test purpose i've added simple text printing msg function to thekisbox.int
procedure and it's not called at all so that means that as i said before the script isn't even called.start
PS.Sorry, but i've changed testing to sajag trader in KLAMATH. Now I've added the line:
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.Code:check_restock_item(PID_SHOTGUN_SHELLS_FMJ, 2, 2, 100)
When does the box traders scripts have to be called by game engine? When i click "trade" when talking to the guy?
inPID_SHOTGUN_SHELLS_FMJ
, compiled the script to KISBOX.int and moved to F2/data/scripts.ITEMPID.H
As i've just checked the script DIFFLKBOX.ssl isn't even triggered (run) by game engine...
Ok, thx for Your help. Now all worksI 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?
Yes, becouse as i said i've changed from flix to sajag so the script for him I'll be KISBOX.int.diFliBox is the correct spelling,ur using the wrong script name
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...
Can I understand these linesIn 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.
The game rolls a d100 dice (random number generator), and if the number is less or equal to the chance value, restock the item.If so, what determine this 10% chance? Random number generator or some stat check?
Is there any other factor affect the check versus that d100:The game rolls a d100 dice (random number generator), and if the number is less or equal to the chance value, restock the item.
Too hard for me.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.
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?)
I am reading the code...Not sure if I'm slightly amused or tired of it... No, there is no luck involved.It's a simple random(1,100) and that's all there is.
/Edit: Here is the code.