Major Cooke wrote:Did some further testing. It seems the inverse of your doubts is true.
Code: Select all
if (mo == (D4RedCard)GetClass()) //This won't load.
if (mo == (D4RedCard)(GetClass())) //This loads, but doesn't ever work.
So for my own sanity, I'm just going to use mo.CheckClass("NameOfActor"). Since I'm only ever using this on other actors, I can tell this is going to drive me up the wall.
That's because what you did is simply wrong. You try to cast a class pointer to an object pointer. That should always result in a type mismatch error. Apparently the grammar lets some stuff slip through that it shouldn't, as the first line.
So here's a quick instruction of a few options:
1. Check if an object is of a certain class or subclass:
'if (object is "Classname")'
'if (object.CheckClass("Classname", AAPTR_DEFAULT, true)'
'if (Classname(object)'
all yield the same result, the first one is the recommended syntax.
2. Check if an object is an exact class type:
'if (object.GetClass() == "Classname")'
if (object.CheckClass("Classname")'
will do the job.