Jump to content

Detect player in combat


Recommended Posts

Hey, so I was wondering if anybody might help me figure something out...

 

I need an event to fire when the player enters combat. Ideally, it would detect other combat states. Unfortunately, the event OnCombatStageChanged specifically doesn't work on the player.

 

My script is attached to a constant effect,self magic effect.

 

I am aware of the method of using OnUpdate and the Actor function, but this creates polling which I don't want.

 

Is anybody aware of any other means of detecting combat for the player? (Apocalypse magic had a spell that did - Ocato's recital, so I know it can be done.)

Link to comment
Share on other sites

A shot in the dark... But try this

 

Event OnCombatStateChanged(actor target, int cstate)

 

Actor Player = Target.getcombattarget()

If Player.GetCombatstate() = xx

 

Followed by your script.

 

Again just a shot in the dark. I'm at work so can't really test the theory to see if it would even compile.

 

Another possibility is making another script with a function containing what you want, with the OnCombatStateChanged event redirecting to the function. Again, theoretical. With your script I would have a better idea of what you're trying to do and help out more

Link to comment
Share on other sites

Thanks a ton for your suggestion!

 

Good thinking, but the event would never fire as my script is on a magicEffect attached to the player.

 

I did ultimately find a workaround - By registering for animation state events and then testing conditions and using the function for detecting combat state (as you said above.)

 

(The OnCombatStateChanged event specifically doesn't work when called on the PlayerCharacter. I speculate it might be because it detects the state of the unit's AI , which by default the player has none. The Reference.GetCombatState() == xx does work on everything including the player.)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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