Jump to content

Problems with a short script


sleekblind

Recommended Posts

I am trying to implement a script that hides a companion's caps until they die, so that the player can't just steal it all after the companion gets paid for services, and yet those caps CAN at some point be retrieved.

 

So far, this is what it looks like.

 

 

short DoOnce

short CapStash

 

 

;____________________________________________

 

 

BEGIN GameMode

 

 

;____________________________________________

 

If ( DoOnce == 0 )

Set CapStash to 100

Set DoOnce to 1

;_____________________________________________

if ( HazelREF.GetItemCount Caps001 >= 100 )

HazelREF.RemoveItem caps001 100

set CapStash to CapStash +100

EndIf

;_____________________________________________

 

END

 

 

BEGIN OnDeath

 

;_____________________________________________

 

HazelREF.Additem Caps001 Capstash

;_____________________________________________

 

 

END

 

 

 

 

 

 

 

With this last line I have tried CapStash*1, (CapStash*1), CapStash, all trying to add a number of caps equal to the value of the CapStash variable. Nothing seems to work. I only have one cycle OnDeath to make it happen, so it needs to be some kind of multiplication. Do I need to set CapStash to a new variable before I can multiply it? What is going on?

Link to comment
Share on other sites

I use a similar script to add playable versions of her equipment after she dies, then remove the non-playable versions. Is it just simply not possible to add caps to a NPC during the OnDeath segment? Because the equipment gets added and removed flawlessly running the same script, minus the attempt at multiplication.

Edited by sleekblind
Link to comment
Share on other sites

I also tried making a secondary inventory, moving the caps there and moving them back OnDeath. I actually had a 3rd inventory for player item storage, which transferred everything flawlessly- but the 2nd inventory failed to transfer the caps. It seems like caps just don't like being moved OnDeath.

Link to comment
Share on other sites

It just occurred to me to test this, and the 3rd inventory fails to transfer any caps stored in it- only the items are moved OnDeath.

 

Using a container, as one would for a merchant, also failed to transfer caps OnDeath.

Edited by sleekblind
Link to comment
Share on other sites

Maybe I will just add a container somewhere and move the caps there, and leave a note on her corpse to give the player a little side-quest to find her stash. It doesn't really make sense that a companion would have time to constantly hide things if they are following you, but... meh.

Edited by sleekblind
Link to comment
Share on other sites

I ended up just converting the caps to NCR $100 bills at a 40:1 rate as I removed them, and they transfer flawlessly OnDeath. It seems Caps just can't be added to a corpse?

Link to comment
Share on other sites

Yeah that is weird. Did you try just adding the caps in the gamemode section - it still runs on a dead actor

if HazelREF.GetDead && DoOnce == 1
HazelREF.Additem Caps001 Capstash
set DoOnce to 2
endif

Link to comment
Share on other sites

  • 2 weeks later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...