Govilku Posted June 24, 2016 Share Posted June 24, 2016 Alright so I've been working on a spell where the player "possesses" another npc and the camera and player controls are switched to that NPC through the story manager. It is broken down into 3 scripts: **akTarget and akCaster were added to a Script Event Quest, then a Story Manager Node thingy-ma-bob was added to "Listen" for the Keyword to be sent. However when I start the game, I notice the Image Space Modifier activates on my Character as soon as it loads, which means the scripts are activating without waiting for the keyword. Both aliases had the "optional" condition checked but their scripts still activate prematurely. The Magic Effect (Fire and Forget): Scriptname DAEPossessScript extends activemagiceffect {Script for the Possession ability of the Daedric Princess.} Keyword Property STARTPOSSESSION Auto GlobalVariable Property ISDAEDRAPOSSESED Auto GlobalVariable Property ISDAEDRAGHOST Auto Spell Property FamiliarVisuals Auto ImageSpaceModifier Property EtherealIMOD Auto ReferenceAlias Property Alias_akTarget Auto ReferenceAlias Property Alias_akCaster Auto Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget = Alias_akTarget.GetActorReference() akCaster = Alias_akCaster.GetActorReference() STARTPOSSESSION.SendStoryEvent(akref1=akCaster,akref2=akTarget) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget = Alias_akTarget.GetActorReference() akCaster = Alias_akCaster.GetActorReference() if(ISDAEDRAGHOST.GetValueInt()==0&&ISDAEDRAPOSSESED.GetValueInt()==0) akCaster.SetAlpha(1,true) utility.wait(1) akcaster.SetGhost(False) akcaster.RemoveSpell(FamiliarVisuals) akcaster.DispelAllSpells() EtherealIMOD.Remove() ISDAEDRAGHOST.SetValueInt(0) endif EndEvent The akTarget Alias' attached Script GlobalVariable Property ISDAEDRAPOSSESED Auto ReferenceAlias Property Alias_akTarget Auto {Alias to the akTarget of the spell} Event OnInit() Actor akTarget=Alias_akTarget.GetActorReference() Game.SetCameraTarget(Alias_akTarget.GetActorReference()) akTarget.SetPlayerControls(True) akTarget.EnableAI(True) ISDAEDRAPOSSESED.SetValueInt(1) EndEvent The akCaster Alias' attached Script Scriptname DAEPOSSCRIPTCASTER extends ReferenceAlias {The Caster Side of the effects for the Daedra Possesion Spell} Actor Property PlayerRef Auto ReferenceAlias Property Alias_akCaster Auto GlobalVariable Property ISDAEDRAPOSSESED Auto GlobalVariable Property ISDAEDRAGHOST Auto ImageSpaceModifier Property EtherealIMOD Auto Spell Property FamiliarVisuals Auto Event OnInit() Actor akCaster = Alias_akCaster.GetActorReference() EtherealIMOD.ApplyCrossFade(3.0) akCaster.SetAlpha(0.1, true) utility.wait(2) akCaster.SetAlpha(0, true) utility.wait(1) akCaster.SetGhost(True) akCaster.SetAlpha(0.5, true) akCaster.AddSpell(FamiliarVisuals, false) ISDAEDRAGHOST.SetValueInt(1) akCaster.SetPlayerControls(False) EtherealIMOD.Remove() if(ISDAEDRAPOSSESED.GetValueInt()) akCaster.SetAlpha(1,true) utility.wait(1) akCaster.SetGhost(False) akCaster.RemoveSpell(FamiliarVisuals) akCaster.DispelAllSpells() akCaster.SetPlayerControls(True) akCaster.EnableAI(true) Game.SetCameraTarget(akCaster) EtherealIMOD.Remove() ISDAEDRAGHOST.SetValueInt(0) ISDAEDRAPOSSESED.SetValueInt(0) endif EndEvent Link to comment Share on other sites More sharing options...
lofgren Posted June 24, 2016 Share Posted June 24, 2016 (edited) Aliases run the init events as soon as the quest starts, regardless of whether there is anything in them. Edit: Sorry, I misunderstood. So the quest is starting before the keyword is sent. Sounds like maybe you didn't filter your story event for your keyword? Should be GetEventData keyword getid yourkeyword == 1 Edited June 24, 2016 by lofgren Link to comment Share on other sites More sharing options...
Govilku Posted June 24, 2016 Author Share Posted June 24, 2016 But the quest doesn't actually start until it receives the keyword from when the magic effect starts. But for some reason these things run at the beginning of the game. Link to comment Share on other sites More sharing options...
lofgren Posted June 24, 2016 Share Posted June 24, 2016 I guess aliases initialize whenever you start a game, regardless of whether or not the quest is running. (Yet another reason to avoid init blocks whenever possible.) Link to comment Share on other sites More sharing options...
Govilku Posted June 25, 2016 Author Share Posted June 25, 2016 I got it to stop initializing start game but I can't get the alias' to fill with the Target and Caster of the spell.. Link to comment Share on other sites More sharing options...
lofgren Posted June 25, 2016 Share Posted June 25, 2016 (edited) Post a screenshot of the aliases. How did you get them to stop initializing at the start of the game? Edited June 25, 2016 by lofgren Link to comment Share on other sites More sharing options...
Govilku Posted June 25, 2016 Author Share Posted June 25, 2016 (edited) Post a screenshot of the aliases. How did you get them to stop initializing at the start of the game? The aliases: akCaster Alias Properties akTarget Alias Properties I changed the code for the Aliases for Event OnInit() to Event OnStoryScript(Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, \ int aiValue1, int aiValue2) The code for the Magic Effect: Scriptname DAEPossessScript extends activemagiceffect {Script for the Possession ability of the Daedric Princess.} Keyword Property STARTPOSSESSION Auto GlobalVariable Property ISDAEDRAPOSSESED Auto GlobalVariable Property ISDAEDRAGHOST Auto Spell Property FamiliarVisuals Auto ImageSpaceModifier Property EtherealIMOD Auto ReferenceAlias Property Alias_akTarget Auto ReferenceAlias Property Alias_akCaster Auto Event OnEffectStart(Actor akTarget, Actor akCaster) STARTPOSSESSION.SendStoryEvent(akref1=akCaster,akref2=akTarget) EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget = Alias_akTarget.GetActorReference() akCaster = Alias_akCaster.GetActorReference() if(ISDAEDRAGHOST.GetValueInt()==0&&ISDAEDRAPOSSESED.GetValueInt()==0) akCaster.SetAlpha(1,true) utility.wait(1) akcaster.SetGhost(False) akcaster.RemoveSpell(FamiliarVisuals) akcaster.DispelAllSpells() EtherealIMOD.Remove() ISDAEDRAGHOST.SetValueInt(0) endif EndEvent The Script for The akCaster Alias Scriptname DAEPOSSCRIPTCASTER extends ReferenceAlias {The Caster Side of the effects for the Daedra Possesion Spell} Actor Property PlayerRef Auto ReferenceAlias Property Alias_akCaster Auto GlobalVariable Property ISDAEDRAPOSSESED Auto GlobalVariable Property ISDAEDRAGHOST Auto ImageSpaceModifier Property EtherealIMOD Auto Spell Property FamiliarVisuals Auto Keyword Property STARTPOSSESSION Auto Event OnStoryScript(Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, \ int aiValue1, int aiValue2) Actor akCaster = Alias_akCaster.GetActorReference() akRef1 = akCaster EtherealIMOD.ApplyCrossFade(3.0) akCaster.SetAlpha(0.1, true) utility.wait(2) akCaster.SetAlpha(0, true) utility.wait(1) akCaster.SetGhost(True) akCaster.SetAlpha(0.5, true) akCaster.AddSpell(FamiliarVisuals, false) ISDAEDRAGHOST.SetValueInt(1) akCaster.SetPlayerControls(False) EtherealIMOD.Remove() if(ISDAEDRAPOSSESED.GetValueInt()) akCaster.SetAlpha(1,true) utility.wait(1) akCaster.SetGhost(False) akCaster.RemoveSpell(FamiliarVisuals) akCaster.DispelAllSpells() akCaster.SetPlayerControls(True) akCaster.EnableAI(true) Game.SetCameraTarget(akCaster) EtherealIMOD.Remove() ISDAEDRAGHOST.SetValueInt(0) ISDAEDRAPOSSESED.SetValueInt(0) endif EndEvent The Script attached to the akTarget Alias: Scriptname DAEPOSALIASTARGSCRIPT extends ReferenceAlias {Script Effects for the Possession Spell} GlobalVariable Property ISDAEDRAPOSSESED Auto ReferenceAlias Property Alias_akTarget Auto {Alias to the akTarget of the spell} Event OnStoryScript(Keyword akKeyword, Location akLocation, ObjectReference akRef1, ObjectReference akRef2, \ int aiValue1, int aiValue2) Actor akTarget=Alias_akTarget.GetActorReference() akRef2 = akTarget Game.SetCameraTarget(Alias_akTarget.GetActorReference()) akTarget.SetPlayerControls(True) akTarget.EnableAI(True) ISDAEDRAPOSSESED.SetValueInt(1) EndEvent Story Manager Setup: When I hit an actor with the spell, nothing happens. I checked to see if the quest was running in the console and it wasn't. Hrmm. Edited June 25, 2016 by Govilku Link to comment Share on other sites More sharing options...
Govilku Posted June 25, 2016 Author Share Posted June 25, 2016 LOOOL I just realized I kept the OnEffectFinish thing in when i meant to delete it. Gonna test this Link to comment Share on other sites More sharing options...
Recommended Posts