[Solved] Cast Error from Mutate
This code is supposed to be a simple Self Destruction mutator. The idea is you just type "Mutate Explode", and then you go out with a bang. My problem is that I'm getting an error that I don't know how to fix.
SelfDestruct() asks for a Pawn, and I would assume that 'Sender.Pawn' is a pawn, so I don't quite see what the problem is. Does anyone know how to make this work?
This code is supposed to be a simple Self Destruction mutator. The idea is you just type "Mutate Explode", and then you go out with a bang. My problem is that I'm getting an error that I don't know how to fix.
SelfDestruct.uc(11) : Error, Cast from 'Pawn' to 'SelfDestruct' will always fail
SelfDestruct() asks for a Pawn, and I would assume that 'Sender.Pawn' is a pawn, so I don't quite see what the problem is. Does anyone know how to make this work?
Code:
Class SelfDestruct extends UTMutator;
var PlayerController playerController;
var Controller InstigatorController;
function Mutate(string MutateString, PlayerController Sender)
{
Super.Mutate(MutateString, Sender);
if (MutateString ~= "Explode" && Sender != None && Sender.Pawn != None)
{
SelfDestruct(Sender.Pawn);
}
}
function SelfDestruct(Pawn P)
{
local UTProj_HeroRedeemer Proj;
Proj = Spawn(class'UTProj_HeroRedeemer', InstigatorController,, P.Location);
}
Last edited: