Upscaling code, running into problems

So I to change my class selection to be from a random array, doing this invalidates my Weapon Base actor variable that I’ve set and referenced throughout the other functions.

I Can then convert this Weapon Base actor variable to a generic object reference actor variable but then other parts of my code breaks (obviously) looking for a specific actor reference. My question is how do I now convert these generic actor references (which are children of the Weapon Base actor) to reference the Weapon Base Actor itself. I don’t think I can cleanly use cast to’s because ill be using different children and I don’t want to create 7 branches for each different child actor to have its own cast to. There has to be a better way. I’ve been trying to brute force the nodes like a noob and so far no luck.

any help is appreciated thanks :smiley:

Look into inheritance. Parent → Child structures.

Base Weapon (Parent) → AssaultRifle (Child) → AK47 (child)

Spawn AK47 → Save reference as Base Weapon Obj Ref

Key here is that ALL the meat and potato variables, data etc have to be created at the Base Weapon level. Then there’s no reason to down cast to the AK47.

Just completely changed how I upscale, everything will use this same class and will use enums to branch different paths instead.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.