How To Add a Enum By An Array?
I have a multiplayer game(with 2 players) and curious how to add an Enum(TeamA) and Enum(TeamB). I know it would be done at Being Play using an Array and Loop, but not sure how its done in Blueprints. Could someone post a blueprint example of adding/inserting an Enum to MyCharacter blueprint so I can setup the 1st Player to be on TeamA and second player on TeamB?
asked Jun 20 '14 at 01:14 AM in Blueprint Scripting
Right click in content browser, Misc->Enumeration
Then after editing this asset you can go into any BP and make a new variable that uses this new Enum data asset!
Make your own custom player contorller class or use the Character BP
Add a new variable MyTeam that has your new enum as the data type
at runtime you can set the value of this enum to be anything you want
convert a random range integer into a Byte / try to plug it into a Set on your team enum for your character / player contorller
Switch on Enum
And then you have the awesome power of Switch on Enum!
in the content browser, go to new > miscellaneous > enumeration. add a few type identifiers ( TeamA, TeamB,... ), save the enum, then open your MyCharacter blueprint, create a variable called "teamID" and change its type to your custom enumeration. you could set these in the level blueprint using postBeginPlay, or you could set these in your custom game mode.
but an easier way is to just make teamID an integer. that way, you can have some game modes where everyone gets their own team, and some where there is only 2 teams.
answered Jun 20 '14 at 02:00 AM
Hope this helps someone, I believe I found a decent solution thus far.... on how to do the entire process for setting multiplayer for two players so one can use event hits and know who is getting hit and who is not.
I posted the blueprints here: Blueprints Process - How To Setup Multiplayer And Tag Each Player for Collisions/etc
answered Jun 22 '14 at 06:56 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here