OnLocationChange - Not always reliable?

Post » Mon May 05, 2014 12:45 am

So I'm trying to come up with a different way to detect a dragon attack. Having exhausted plenty of other methods because too many mods have too many variations on a lot of things for dragons, I settled on hijacking a spot in MGRitual05DragonScript.

Everything got coded up nice and quick, but then when I went to test in game, the dragon was not "detected" until he landed on the ground.

Is it REALLY true what this comment says in DragonActorScript?

    ;USED TO GET DIALOGUE CONDITIONED ON DRAGON HAVING ATTACKED A TOWN    -- only happens if he lands on the ground in a location - ie death, or to land to fight (not on a perch)    ;see also DragonPerchScript

Does OnLocationChange seriously not register anything until an actor touches the ground at some point? Cause if so this isn't going to be terribly useful to me. NPCs can't afford to be waiting for dragons to actually land before deciding to run away.

Here's the code in case someone sees something I can tweak to make this work as I'm hoping:

Scriptname MGRitual05DragonScript extends actormiscobject Property Scales  Auto  weapon Property MGRitual05Dagger  Auto  int DoOnceEvent OnActivate (ObjectReference ActionRef)	if DoOnce == 0		if Self.IsDead()			if Game.GetPlayer().IsEquipped(MGRitual05Dagger)				Game.GetPlayer().AddItem(Scales,1)				DoOnce=1			endif		endif	endifEndEvent;Take Cover - Additional code for detecting dragon attacks against habitation locations.Keyword LocTypeHabitationKeyword ARTHTCDragonDetectionARTH_TC_DragonHandlingScript ARTHTCCitizensFleeAttackEvent OnInit()	debug.trace( "TC: Dragon initialized - setting properties" )		LocTypeHabitation = Game.GetFormFromFile( 0x00039793, "Skyrim.esm" ) as Keyword	ARTHTCDragonDetection = Game.GetFormFromFile( 0x0000C9E1, "Take Cover.esp" ) as Keyword	ARTHTCCitizensFleeAttack = Game.GetFormFromFile( 0x00010D62, "Take Cover.esp" ) as ARTH_TC_DragonHandlingScriptEndEventEvent OnLocationChange( Location akOldLoc, Location akNewLoc )		if( akNewLoc != None )		debug.trace( "TC: Dragon location change detected." )		if( akNewLoc.HasKeyword(LocTypeHabitation) )			debug.trace( "TC: Habitation detected. Pinging quest." )						if( !ARTHTCCitizensFleeAttack.IsRunning() )				ARTHTCDragonDetection.SendStoryEvent( akLoc = akNewLoc, akRef1 = Self )			Else				ARTHTCCitizensFleeAttack.RegisterAdditionalDragon( Self )			EndIf		EndIf	EndIfEndEvent

My testing area was the middle of Falkreath if that matters somehow.
User avatar
Krystina Proietti
 
Posts: 3388
Joined: Sat Dec 23, 2006 9:02 pm

Return to V - Skyrim