Get Coins every 24 hours script

Post » Thu Feb 04, 2016 9:36 am

Im working on artifact, that will give you money every 24 hours from equip



Scriptname CoinEquip extends ObjectReference

MiscObject Property Gold001 Auto
Armor Property Sack Auto

Event OnEquipped(Actor akActor)
RegisterForSingleUpdateGameTime(24.0)
EndEvent

Event OnUpdateGameTime()
if(Game.GetPlayer().IsEquipped(Sack))
Game.GetPlayer().AddItem(Gold001, 500)
RegisterForSingleUpdateGameTime(24.0)
endif
EndEvent



Sack Property is that artifact itself



Please help me


It compiles fine, but does nothing

User avatar
Mrs Pooh
 
Posts: 3340
Joined: Wed Oct 24, 2007 7:30 pm

Post » Thu Feb 04, 2016 10:08 am

You don't need to check if the object is equipped(Hopefully you attached the script to the armor), since the event is attached to the very object it's listening for. Other than that, your code looks fine. But keep in mind, waiting, menu mode, sleeping will affect OnUpdateGameTime where it will run later than expected.

User avatar
Kitana Lucas
 
Posts: 3421
Joined: Sat Aug 12, 2006 1:24 pm

Post » Thu Feb 04, 2016 7:45 am

I'd suggest adding a function to un-register when you unequip. The way you have it, it looks like you could put in on once a day at the right time, rather than use it continuously. Or the OnEquip would fail, because it was left registered from last time. Neither seem to be what you intended.

User avatar
lucy chadwick
 
Posts: 3412
Joined: Mon Jul 10, 2006 2:43 am


Return to V - Skyrim