Arctic Wind: why it malfunctions and an imperfect fix 

Moderator: Moderatoren

2 Beiträge Seite 1 von 1
tinylampe
Bettler
Bettler
Beiträge: 5
Registriert: 27.07.2018 11:46
Hat sich bedankt: 1 Mal
Danksagung erhalten: 1 Mal


Hi,

Sometimes, enemies affected by Arctic Wind neither shatter nor go back to normal. Instead, their bodies remain intact but motionless, and it's no longer possible to interact with those enemies (cannot be looted, etc). I posted a video of the bug in action here: https://forum.sureai.net/viewtopic.php?f=208&t=13159

The reason why this bug only happens sometimes has to do with the following script: _00E_FrozenMEScript

According to this script, an oppoent who has been frozen solid due to Arctic Wind may shatter in two possible situations:
1) if, after hitting him, his HP reaches zero.
2) if, after hitting him, his 'shattering chance' exceeds a certain threshold.

I'm going to argue that the bug with Arctic Wind only occurs in situation 2. Let's take a look at the code:

This is the code that covers situation 1 (the one that is not bugged):
Code: Alles auswählen
if FrozenActor.GetAV("Health") < 1
	FrozenActor.PlaceAtMe(_00E_FrostShatteringExplosion02)
	if FrozenActor.HasKeyword(ActorTypeNPC) || FrozenActor.GetRace() == DraugrRace
		FrozenActor.PlaceAtMe(_00E_FS_MAGIceGoreExplosion)
	Else
		FrozenActor.PlaceAtMe(_00E_FrostShatteringExplosion)
	EndIf		
	
	FrozenActor.SetAlpha (0.0, true)
	FrozenActor.SetCriticalStage(FrozenActor.CritStage_DisintegrateStart)
	FrozenActor.AttachAshPile(_00E_ShatteredEnemyPile)
	WPNImpactBladeVsIce.Play(FrozenActor)
	Game.ShakeCamera(afStrength = 0.3)
	Utility.Wait(0.5)
	FrozenActor.SetCriticalStage(FrozenActor.CritStage_DisintegrateEnd)
This is the code that covers situation 2 (the one that is bugged):
Code: Alles auswählen
If Utility.RandomFloat() < ShatterChance
	; Debug.MessageBox("Shatter!")
	HasBeenShattered = true
	ShatterEnemy()
	GoToState("Finished")
EndIf
Code: Alles auswählen
Function ShatterEnemy()
	FrozenActor.Kill(PlayerREF)
EndFunction
Code: Alles auswählen
State Finished
	; Do nothing
EndState
See the problem in situation 2? If the 'ShatterChance' exceeds a certain value, the script executes the 'ShatterEnemy()' function and, after that, it goes to the 'Finished' state. The problem is that neither the 'Finished' state nor the 'ShatterEnemy()' function contain the necessary code to make the frozen enemy shatter. The 'ShatterEnemy()' function kills the frozen enemy (FrozenActor.Kill(PlayerREF), but it is missing the explosions, alpha channel correction and disintegration effects that create the illusion that the opponent is turned into ice cubes.

If you expand the 'ShatterEnemy()' function so that it looks like this, the bug with Arctic Wind disappears:
Code: Alles auswählen
Function ShatterEnemy()
	FrozenActor.PlaceAtMe(_00E_FrostShatteringExplosion02)
	if FrozenActor.HasKeyword(ActorTypeNPC) || FrozenActor.GetRace() == DraugrRace
		FrozenActor.PlaceAtMe(_00E_FS_MAGIceGoreExplosion)
	Else
		FrozenActor.PlaceAtMe(_00E_FrostShatteringExplosion)
	EndIf		
		
	FrozenActor.Kill(PlayerREF)	
	FrozenActor.SetAlpha (0.0, true)
	FrozenActor.SetCriticalStage(FrozenActor.CritStage_DisintegrateStart)
	FrozenActor.AttachAshPile(_00E_ShatteredEnemyPile)
	WPNImpactBladeVsIce.Play(FrozenActor)
	Game.ShakeCamera(afStrength = 0.3)
	Utility.Wait(0.5)
	FrozenActor.SetCriticalStage(FrozenActor.CritStage_DisintegrateEnd)
EndFunction
Having said that, this is not a perfect fix. Mechanically it works, but visually it's not perfect. In particular, I couldn't get the body to become invisible (via alpha correction) fast enough. So the result is that the explosion kicks in, but the body is visible a second too long, which breaks the illusion that the body has turned into ice cubes. See here: https://filebin.net/7cte0j5ypz27ybzx

If you are fine with this shortcoming, find the edited script and the source code below. My hope however is that an Enderal dev will see this thread and improve on my fix, getting rid of the visual oddities.

https://filebin.net/ryx47eoxlaj6s532

Thanks in advance!
stuemper
Enderal Team
Enderal Team
Schwarzer Wächter
Schwarzer Wächter
Beiträge: 3298
Registriert: 14.07.2015 11:43
Hat sich bedankt: 127 Mal
Danksagung erhalten: 1240 Mal


Thanks, good find. I've adjusted the script in a way that the visiual problem shouldn't occur with your fix. Calling Kill() and SetAlpha() directly after each other was the problem according to my testing.
Code: Alles auswählen
Function ShatterEnemy()

	FrozenActor.Kill(PlayerREF)
	Utility.Wait(0.1)
	FrozenActor.PlaceAtMe(_00E_FrostShatteringExplosion02)
	
	if FrozenActor.HasKeyword(ActorTypeNPC) || FrozenActor.GetRace() == DraugrRace
		FrozenActor.PlaceAtMe(_00E_FS_MAGIceGoreExplosion)
	Else
		FrozenActor.PlaceAtMe(_00E_FrostShatteringExplosion)
	EndIf		
	
	FrozenActor.SetAlpha (0.0, true)
	FrozenActor.SetCriticalStage(FrozenActor.CritStage_DisintegrateStart)
	FrozenActor.AttachAshPile(_00E_ShatteredEnemyPile)
	WPNImpactBladeVsIce.Play(FrozenActor)
	Game.ShakeCamera(afStrength = 0.3)
	Utility.Wait(0.5)
	FrozenActor.SetCriticalStage(FrozenActor.CritStage_DisintegrateEnd)
	
EndFunction
2 Beiträge Seite 1 von 1

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste