Edit: Working solution found. I'll just paste the relevant bits:
Code: Select all
Actor 64Arachnotron : Arachnotron replaces Arachnotron
{
...
+SEEINVISIBLE // See ShadowMissile for custom inaccuracy state
var int user_angle;
States
{
...
Missile:
TNT1 A 0 A_SetUserVar("user_angle", 0)
BSPI A 20 Bright A_FaceTarget
TNT1 A 0 A_CheckFlag("SHADOW", "ShadowMissile", AAPTR_TARGET) // Check to see if the target is invisible
TNT1 A 0 A_PlaySound("weapons/plasmaf", CHAN_WEAPON)
TNT1 A 0 A_CustomMissile(ArachnotronPlasma, 25, -12, 0, CMF_AIMOFFSET)
TNT1 A 0 A_CustomMissile(ArachnotronPlasma, 25, 12, 0, CMF_AIMOFFSET)
BSPI E 8 Bright A_FaceTarget
TNT1 A 0 A_SpidRefire
Goto Missile + 2
// Custom inaccuracy state since A_CustomMissile recalculates the angle each call, making multiple projectiles a nightmare
ShadowMissile:
TNT1 A 0 A_SetUserVar("user_angle", random(-40, 40))
TNT1 A 0 A_FaceTarget // Reset the enemy angle
TNT1 A 0 A_PlaySound("weapons/plasmaf", CHAN_WEAPON)
TNT1 A 0 A_CustomMissile(ArachnotronPlasma, 25, -12, user_angle, CMF_AIMOFFSET)
TNT1 A 0 A_CustomMissile(ArachnotronPlasma, 25, 12, user_angle, CMF_AIMOFFSET)
BSPI E 8 Bright A_SetAngle(angle + user_angle) // Random turning to match aim (should come after A_CustomMissile calls)
TNT1 A 0 A_SpidRefire
Goto Missile + 2
...
}
}
Why do it this way? Zandronum compatibility, mostly. It's also easier than messing around with ZScript, but I'd still just recommend using ZScript if you don't care about Zandronum.