Detect if Actor is a class but NOT a child of that class
Posted: Sat Jan 22, 2022 4:22 am
I am curious if there's a way to detect if a class is EXACTLY a specific class, but not a subclass.
An example could be if I subclass a particular Botpack weapon, but want to detect the original.
I thought about doing these:
What is the best approach?
An example could be if I subclass a particular Botpack weapon, but want to detect the original.
I thought about doing these:
Code: Select all
function bool isSpecificEnforcer(Inventory inv) {
local Enforcer enf;
enf = Enforcer(inv);
if(enf != None) {
//inv is an enforcer, but could be a subclass?
return true;
}
if(inv.IsA('Enforcer') ){
//inv is an enforcer, but could be a subclass?
return true;
}
if(inv.Class == class'Enforcer') {
//inv class is EXACTLY an enforcer?
return true;
}
return false;
}