Download

How do you make a Actor Class list for weapons...For a RTS UE4 4.26

Ok I have been trying to figure this out for two months and have not been able to fully figure out how to approach it for I am still new in Blueprint Coding (in fact coding period) and not sure how to go about this. From what I understand I would have to make the weapon actor, then (This is where I get suck) In the Base Unit BP I am not sure if I need to make the weapon a Child Actor, or if I just make a reference to it in a Function which calls upon the Weapon Actor Class to be able to make the Weapon accessible and if possible be able to choose the weapon for the Child Units based off the Main Unit BP. My question is how do I make if be able to be selected from adown down list, which will spawn the weapon I have chosen to the unit Socket, so when it comes to the Customize I plan to make A player can choose what weapon his unit can care. I hope I was clear in explaining this. Thank you for Reading.

If I understood correctly, you could do the following:

Let’s say you have a widget where the player can choose a weapon for his unit. You could either use a map (not recommended if game scales up) or use a simple data table with the structure “Display Name of the Weapon; Corresponding BP Class of the Weapon”. Use the DT in the widget and if the player makes a selection, you look up the corresponding BP Class and spawn it in the world (at location 0-0-0) while setting its owner to the player.
This will trigger event “Begin Play” in the Weapon Base, here you can cast/interface to the player (as it is the owner) and there you can run “Attach Actor to Component”.

I hope this is answering your question :slight_smile:

Thank you for this this has solved a bit of my problem. Now just trying to get my Variants to be visible.

1 Like