Doubt in Script of money.

Post » Sat Nov 17, 2012 9:00 pm

Hey folks, I have a simple question in the implementation of my mod. I've done all the magic, to be placed in a book and everything else, but I realized there was a bug. I put this book to sell with major retailers, such as Farengar, but have mods that modify the inventory of these same traders, covering my mod and vise versa.

So I decided, in this update, putting the book on the table of the leading merchants and that when the person picked up the book for her will spend around 100 golds.

So, I want to know the script to remove the 100 golds of player. Attention: It will only withdraw the money at first time; if the player drops the book unintentionally, and when he take back again and put in inventory, will not spend this money again because it was "bought" before.

Script must be a fairly easy, but do not know how to do. If someone could help me will be great. Thank you :biggrin:
User avatar
Patrick Gordon
 
Posts: 3366
Joined: Thu May 31, 2007 5:38 am

Post » Sat Nov 17, 2012 7:19 pm

Scriptname BookScript extends ObjectReferenceboolean Property BookBought auto;Default is false. Set it up in editor?ObjectReference Property CustomBook auto;Points to the book.ObjectReference Property Money auto;Points to gold, obviously.Message InsufficientFunds auto;A small notification. Might be another way. Make sure MessageBox is unticked.Event OnInit()if (BookBought == false) ;Stop the player from adding it to his inventory before bought. Should happen only once for this particular object. self.BlockActivation()endifEndEventEvent OnActivate(ObjectReference akActionRef)if (akActionRef == Game.GetPlayer())  if (BookBought == false)   if (Game.GetPlayer().GetItemCount(Money) >= 100)	;Do not want him to steal it now, do we?	Game.GetPlayer().RemoveItem(Money, 100)	Game.GetPlayer().AddItem(CustomBook)	BookBought = true	;Is this the proper procedure to remove the object from the world?	self.Disable()	self.Delete()   else	InsufficientFunds.Show()	;No money.   endif  endifendifEndEvent
Something along those lines, maybe?
User avatar
Jennifer Munroe
 
Posts: 3411
Joined: Sun Aug 26, 2007 12:57 am

Post » Sat Nov 17, 2012 2:09 pm

Hey, thx for the solution Da Nang! Really, thx a lot! I gonna check this now :biggrin:
User avatar
scorpion972
 
Posts: 3515
Joined: Fri Mar 16, 2007 11:20 am


Return to V - Skyrim