Fri Feb 04, 2022 10:36 am
A player can never carry more than one weapon of each kind.
Like with normal inventory items, an actor can have more than one sample of a weapon in its inventory.
Fri Feb 04, 2022 11:14 am
Fri Feb 04, 2022 12:19 pm
A player can never carry more than one weapon of each kind.
Fri Feb 04, 2022 12:28 pm
Actor → UW_ObjectBase → UW_PickupBase
FunctionA → FunctionA
FunctionB → FunctionB
FunctionC
Actor → UW_ObjectBase
MixIn
FunctionA
FunctionB
Actor → UW_PickupBase
MixIn
FunctionA
FunctionB
FunctionC
Fri Feb 04, 2022 1:44 pm
Actor → UW_ObjectBase
Inventory → UW_PickupBase
Weapon → UW_WeaponBase
is "actor"
but not for is UW_ObjectBase
GetDescription()
, I won't be able to call it universally like this:string Description=UW_ObjectBase(ThisObject).GetDescription()
string Description
if (ThisObject is "UW_ObjectBase"){Description=UW_ObjectBase(ThisObject).GetDescription()}
if (ThisObject is "UW_PickupBase"){Description=UW_PickupBase(ThisObject).GetDescription()}
if (ThisObject is "UW_WeaponBase"){Description=UW_WeaponBase(ThisObject).GetDescription()}
string GetDescription(Actor ThisObject)
and use that to pick up data off the UW objects so I don't have to clutter up my code with all those ifs.Fri Feb 04, 2022 3:04 pm
Thu Feb 10, 2022 7:25 pm
void MyFunc(Actor a){
if (a is "NewActor"){
let n=NewActor(a);
//work with n
} else {
//work with a
}
}
Fri Feb 11, 2022 10:27 am
// Checked at compile time. This will error upon loading if the class is missing.
class<Actor> cls = "MissingNameOfClass";
// Checked at run time instead of compile time. 'cls' will just be null if the actor class isn't defined.
string classname = "MissingNameOfClass";
class<Actor> cls = classname;
Fri Feb 11, 2022 5:21 pm
Caligari87 wrote:One method which seems to be allowed is putting the classname in a variable so it's evaluated at run-time instead of compile-time. See this wiki page: ZScript_classes: Cross-Mod_Support
[...]
I personally don't like this because I feel like it's a workaround or hack, rather than an intentional feature. That said, it works, and is fairly simple to understand and implement.