shavkacagarikia Posted July 20, 2016 Author Share Posted July 20, 2016 yes i think so too, can you make the script when you will have time for that? Link to comment Share on other sites More sharing options...
NexusComa Posted July 20, 2016 Share Posted July 20, 2016 Guess #4 Scriptname _BaseAspectRingScript extends ObjectReference Armor Property RingPower Auto int RingState = 0 Event OnEquipped(Actor akActor) GotoState("Scanning")EndEvent Event OnUnEquipped(Actor akActor) RingState = 0 GotoState("Pause")EndEvent State Scanning Event OnBeginState() if (Game.Getplayer().IsWeaponDrawn() == 1) if(RingState == 0) Game.GetPlayer().EquipItem(RingPower) RingState = 1 endif elseif (Game.Getplayer().IsWeaponDrawn() != 1) if(RingState == 1) Game.GetPlayer().UnEquipItem(RingPower) RingState = 0 endif endif EndEvent EndState State Pause ; do nothingEndState Link to comment Share on other sites More sharing options...
shavkacagarikia Posted July 20, 2016 Author Share Posted July 20, 2016 same result as previous ones :( Link to comment Share on other sites More sharing options...
NexusComa Posted July 20, 2016 Share Posted July 20, 2016 Grrrr ... that on should be close ... guess i have to pull up the kit here ...brb Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 20, 2016 Share Posted July 20, 2016 Thought...Use a player alias script with the OnObjectEquipped and OnObjectUnequipped events. When the initial ring is equipped register for a single update. On the update check to see if a weapon is drawn. If so, do whatever, if not re-register. When the initial ring is unequipped, you'll unregister for the single update in case it had been registered but not yet run. Link to comment Share on other sites More sharing options...
NexusComa Posted July 20, 2016 Share Posted July 20, 2016 Well I'm at a loss here ... this should work but it isn't.For some reason the RegisterForSingleUpdate(3.0) will not fire from the Event OnEquipped(Actor akActor).I tried putting the Events in different order (shouldn't matter). I tried putting them in a State (with InEvent in and out).Just can't get it to fire at all ... If you remove the rem mark before the RegisterForSingleUpdate(3.0) in the OnInit() Event it will switch the ring when you pull out the sword. (any weapon)But I wanted it to start the RegisterForSingleUpdate(3.0) only when I Equipped the sword. I hope someone can tell me why the RegisterForSingleUpdate(3.0) will not fire from the Event OnEquipped(Actor akActor). Scriptname _BaseAspectRingScript extends ObjectReference Armor Property RingPower Auto Int RingState = 0 Event OnInit() Debug.MessageBox("test 8");RegisterForSingleUpdate(3.0);gotostate("Scan")EndEvent ;State Scan;Auto State ScanEvent OnEquipped(Actor akActor) RegisterForSingleUpdate(3.0) Debug.Notification("equiped weapon")EndEvent Event OnUnEquipped(Actor akActor) Game.GetPlayer().UnEquipItem(RingPower) RingState = 0 Debug.Notification("unequiped weapon")EndEvent Event OnUpdate() ;Debug.Notification("scanning") If(Game.GetPlayer().IsWeaponDrawn() == 1) if(RingState == 0) Debug.Notification("Player drawn weapon") Game.GetPlayer().EquipItem(RingPower) RingState = 1 endif ElseIf(Game.GetPlayer().IsWeaponDrawn() != 1) if(RingState == 1) Debug.Notification("Player undrawn weapon") Game.GetPlayer().UnEquipItem(RingPower) RingState = 0 endif EndIf RegisterForSingleUpdate(3.0)EndEvent;EndState Link to comment Share on other sites More sharing options...
NexusComa Posted July 20, 2016 Share Posted July 20, 2016 Wow, you must have posted that as i was posting this ... I hope you check back. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 20, 2016 Share Posted July 20, 2016 @NexusComa I hope someone can tell me why the RegisterForSingleUpdate(3.0) will not fire from the Event OnEquipped(Actor akActor). From the CK wiki page for OnEquippedWhen an object is equipped it is inside a container, which means that you cannot call Member Functions on it. (Unless it is a persistent reference) All the update stuff falls into this category. Link to comment Share on other sites More sharing options...
NexusComa Posted July 20, 2016 Share Posted July 20, 2016 (edited) So how can you get around this?I surly don't want to set a Onupdate() going all game all the time ... Edited July 20, 2016 by NexusComa Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 20, 2016 Share Posted July 20, 2016 So how can you get around this?You can't. Not without doing what I suggested earlier and moving the code off of the object itself and into another location. Link to comment Share on other sites More sharing options...
Recommended Posts