const int MagnetHomingMin = 100;
actor MagnetMissileWepSH : BaseMM8BDMWep
{
//$Category MM8BDM-Weapons
//$Title Magnet Missile
Weapon.AmmoUse 3
Weapon.AmmoGive 28
Weapon.SlotNumber 2
Inventory.Pickupmessage "$PU_MAGNETMISSILE"
Obituary "$OB_MAGNETMISSILE"
Tag "$TAG_MAGNETMISSILE"
weapon.ammotype "MagnetMissileAmmo"
inventory.icon "MAGNETSI"
+INVENTORY.RESTRICTABSOLUTELY Inventory.RestrictedTo megamans
States
{
SpawnLoop:
WEAP I 1
loop
Ready:
MAGG C 0 ACS_ExecuteAlways(998,0,8)
MAGG C 1 A_WeaponReady
Goto Ready+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
MAGG C 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
MAGG C 1 A_Raise
Loop
Fire:
MAGG C 0 A_JumpIfNoAmmo("NoAmmo")
MAGG C 0 A_PlaySoundEx("weapon/magnetmissile","Weapon")
MAGG C 0 A_FireCustomMissile("MagnetMissileSH",0,1,8,0)
MAGG DEC 4
MAGG C 8
MAGG C 0 A_Refire
Goto Ready+1
NoAmmo:
MAGG C 1 ACS_Execute(979,0)
Goto Ready+1
}
}

actor MagnetMissileSH
{
PROJECTILE
Radius 8
Height 5
scale 2.5
damagetype "MagnetMissile"
Obituary "$OB_MAGNETMISSILE"
damage (30)
speed 47
+SEEKERMISSILE
-EXTREMEDEATH
+SCREENSEEKER
reactiontime 175
var int user_HomingChance;
States
{
Spawn:
MAGG AAAAA 1
Spawn2:
MAGG A 1 A_SeekerMissile (0, 0, SMF_LOOK, MagnetHomingMin+user_HomingChance, 2)
MAGG A 0 A_JumpIf(MagnetHomingMin+user_HomingChance >= 250, 1)
MAGG A 0 A_SetUserVar("user_HomingChance", user_HomingChance+5)
MAGG A 0 A_JumpIfTargetInLOS("ReDirect", 0, JLOSF_PROJECTILE)
MAGG A 0 A_CountDown
loop
ReDirect:
MAGG A 0 A_FaceTracer
MAGG A 0 A_SeekerMissile(1, 360, SMF_PRECISE, MagnetHomingMin+user_HomingChance, 2)
MAGG A 0 A_ScaleVelocity(0.01)
MAGG A 2 A_FaceTracer
MAGG A 0 A_ScaleVelocity(115.0)
Goto Go
Go:
MAGG A 1 A_CountDown
wait
Death:
TNT1 A 0 A_SpawnItemEx("ExplosionEffect1")
stop
}
}