Jump to content

Recommended Posts

Posted

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 nothing
EndState
Posted

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.

Posted

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 Scan
Event 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
Posted

@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 OnEquipped

  • When 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.

Posted

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.

  • Recently Browsing   0 members

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