Is there a way to run On Update on a token?

Post » Thu Jun 21, 2012 5:34 am

so I have tried a few On "start" type events and they all work to START this concussion effect but my On Update event never runs. The following script is on a token (armor with no slot nor weight and is not playable) that is only given to the player:


Scriptname aadpHeadHitEffect extends ObjectReferencefloat soundvolint instanceIDSound Property aadpConcussionSound  AutoSoundCategory Property AllSounds  AutoImageSpaceModifier Property aadpConcussion  AutoArmor Property aadpConcussionToken  AutoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)if akNewContainer == Game.GetPlayer()RegisterForSingleUpdate(2)aadpConcussion.ApplyCrossFade()allsounds.Mute()instanceID = aadpConcussionSound.play(game.getplayer())soundvol = 1.0endifendeventEVENT onUpdate()if soundvol > 0  RegisterForSingleUpdate(0.1)  soundvol = soundvol - 0.1  Sound.SetInstanceVolume(instanceID, soundvol)  debug.messagebox("working")else  Sound.StopInstance(instanceID)  Allsounds.unMute()  game.getplayer().removeitem(aadpConcussionToken, 1, true)endifendevent
User avatar
^_^
 
Posts: 3394
Joined: Thu May 31, 2007 12:01 am

Post » Thu Jun 21, 2012 1:47 am

You could use aliases instead of tokens.
User avatar
sw1ss
 
Posts: 3461
Joined: Wed Nov 28, 2007 8:02 pm

Post » Wed Jun 20, 2012 10:55 pm

You are probably experiencing the problems described in these http://www.gamesas.com/topic/1349382-event-in-script-attached-to-misc-item-only-firing-once/ http://www.gamesas.com/topic/1358006-scripted-objects-in-inventory/. I am not sure if the conclusions I drew were correct, but the test results I posted are what I experienced.
User avatar
sarah
 
Posts: 3430
Joined: Wed Jul 05, 2006 1:53 pm

Post » Wed Jun 20, 2012 11:32 pm

Wow...you really cannot run update in a script on items?

wow...

ok so here is how I solved my issue, I will fake the updates:


Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
if akNewContainer == Game.GetPlayer()
aadpConcussion.ApplyCrossFade()
instanceID = aadpConcussionSound.play(game.getplayer())
allsounds.Mute()
VolNum = 1
Utility.wait(2)
endif

while VolNum > 0
VolNum = VolNum - 0.1
Sound.SetInstanceVolume(instanceID, VolNum)
Utility.wait(0.1)
endWhile

Sound.StopInstance(instanceID)
Allsounds.unMute()
game.getplayer().removeitem(aadpConcussionToken, 1, true)

endevent
User avatar
Bek Rideout
 
Posts: 3401
Joined: Fri Mar 02, 2007 7:00 pm


Return to V - Skyrim