<aside> ⚡ script "core_predicthome" (int spd, int ptr, int timeOffs)

</aside>

Usage


This script sets the pitch and angle of the calling projectile to predict the given pointer's position, essentially leading its aim towards that pointer, taking into account distance and speed.

Parameters

Example


Below is a fairly accurate Magnet Missile that only redirects a single time.

actor LoreAccurate_MagnetMissile : BasicProjectile
{
	Radius 8
	Height 5
	damagetype "MagnetMissile"
	Obituary "$OB_MAGNETMISSILE"
	damage (20)
	speed 47
	+SEEKERMISSILE
	+SCREENSEEKER
	var int user_speed;
	States
	{
		Spawn:
			MAGG A 0
			MAGG A 0 A_SetUserVar(user_speed, 47)
			MAGG A 0 ACS_NamedExecuteWithResult("core_SetVelPitch",0,0)
			MAGG A 8
		SpawnLoop:
			MAGG A 0 A_SeekerMissile (0, 0, SMF_LOOK|SMF_PRECISE, 256, 10)
			MAGG A 1 A_JumpIfTargetInLOS("SpawnChase", 0, JLOSF_PROJECTILE)
			loop
		SpawnChase:
			MAGG A 0 A_Stop
			MAGG A 0 ACS_NamedExecuteWithResult("core_predicthome", user_speed, AAPTR_TRACER, 10)
			MAGG A 10
			TNT1 A 0 A_SpawnItemEx("ExplosionEffect1", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
		ChaseLoop:
			MAGG A 0 A_ChangeVelocity(cos(pitch)*user_speed, 0, sin(-pitch)*user_speed, CVF_RELATIVE|CVF_REPLACE)
			MAGG A 2
			loop
		Death:
			TNT1 A 0 A_SpawnItemEx("ExplosionEffect1", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERTRANSLATION)
			stop
	}
}