Jump to content

Photo

Getting CombatStateChange to work with Actor Alias

skyrim actor alias quest combat

  • Please log in to reply
3 replies to this topic

#1
SirBeastling

SirBeastling

    Journeyman

  • Premium Member
  • 35 posts

I am having trouble getting a scene to play when the player starts combat with an actor alias - in this case Anise. The scene is meant to be a none intrusive commentary before the invisible activator backs out. I am also trying to get a different scene to play when Anise dies through the same method. I have gotten scenes like these to work before, so I am not sure what I am doing wrong with this one:

 

The code is posted below:

Scriptname SirBeastXM01AniseRefScript extends ReferenceAlias  
 
 
;-----Properties
Actor Property Player  Auto  
 
Scene Property AniseAliveScene  Auto  
 
Scene Property AniseDeadScene  Auto  
 
ReferenceAlias Property XhiivAct  Auto  
 
ObjectReference Property ActReturnMarker  Auto  
 
ReferenceAlias Property Anise  Auto 
 
Int Property FightingAnise = -1 Auto
 
;-----Events
 
Event OnCombatStateChange(actor Target, int CS)
if Target == Player
if CS == 1
FightingAnise = 1
debug.messagebox("Event has triggered")
PlayAniseAliveScene()
elseIf CS == 0
if Anise.GetActorReference().IsDead()
PlayAniseDeadScene()
endif
endif
endif
EndEvent
 
;-----Functions
 
Function PlayAniseAliveScene()
XhiivAct.GetReference().MoveTo(Player, -90.0 * Math.Sin(Player.GetAngleZ()), -90.0 * Math.Cos(Player.GetAngleZ()))
AniseAliveScene.start()
while AniseAliveScene.IsPlaying()
utility.wait(1.0)
endWhile
XhiivAct.GetReference().MoveTo(ActReturnMarker)
EndFunction
 
Function PlayAniseDeadScene()
XhiivAct.GetReference().MoveTo(Player, -90.0 * Math.Sin(Player.GetAngleZ()), -90.0 * Math.Cos(Player.GetAngleZ()))
AniseDeadScene.start()
while AniseDeadScene.IsPlaying()
utility.wait(1.0)
endWhile
XhiivAct.GetReference().MoveTo(ActReturnMarker)
EndFunction
 
----------------
 
I also have a different problem for the same mod where the dialogue box with the next options shows up when I have a character forcegreet the player, even as they are trying to do their intro speech.
 
The details are at this page:


#2
IsharaMeradin

IsharaMeradin

    The Pale Redguard

  • Members
  • PipPipPipPipPip
  • 10,443 posts

According to the CK wiki, OnCombatStateChanged does not work when the player changes combat states.  It needs to be used with other actors.  In your case then you will probably need to check if Anise has changed combat state.



#3
SirBeastling

SirBeastling

    Journeyman

  • Premium Member
  • 35 posts

This script is attached to the Anise reference alias.

However, the debug messagebox function never fires that I have added to see if it works, so I am not sure if Anise ever does change combat states. This is when she is waiting outside of her cabin for the player to come out of the basement. She is just standing idle, so I believe that she is not in combat with anything. 



#4
ReDragon2013

ReDragon2013

    Old hand

  • Members
  • PipPipPip
  • 740 posts

You wrote: "I am having trouble getting a scene to play". That can be of different causes. Cause and effect, you know!

Use Debug.Trace() inside to monitor your scripts. It is more valid.

 

SirBeastXM01AniseRefScript

Spoiler






Also tagged with one or more of these keywords: skyrim, actor, alias, quest, combat

IPB skins by Skinbox
Page loaded in: 0.992 seconds