Hi Everyone,
Relatively new modder here, but I'm currently working on a mod that allows the player to operate a caravan. It would basically work like this: the player would give anything that they want to sell to a specific NPC, that NPC would then disappear and then reappear in a given number of days with their total inventory value converted to caps. I'm currently trying to get the basics of the script working, but so far I'm having no luck. If someone can tell me where I'm going wrong with the below script, I would appreciate it!
scn AACaravan1Script
array_var aCaravan
short iCaravanStatus
int iIndex
int iCaravanValue
int iItemValue
ref rItem
Begin Gamemode
if iCaravanStatus == 1
Let aCaravan := MojaveOutpostCaravaneerREF.GetAllItemRefs 0 0 0 1
let iIndex := ar_size aCaravan
while (iIndex -= 1) >= 0
let rItem := aCaravan[iIndex]
let iItemValue := rItem.GetItemValue
let iCaravanValue += iItemValue
MojaveOutpostCaravaneerREF.RemoveItem rItem 1
loop
endif
player.additem caps001 iCaravanValue
set iCaravanStatus to 0
set iCaravanValue to 0
MojaveOutpostCaravaneerREF.enable
End
Once I get this working, I'm planning on adding a delay of a few in-game days, and the caps will be added to a container to be collected by the player manually.
Thanks in advance for anyone's help!