Download

Pokemon-esque typing and battles

Hi guys,

Does anyone have any tutorials or know of any tutorials for multiple types like pokemon, or the turn based battling in it?

I have managed a simple Rock, Paper, Scissors type of system with Enums, but when a type has multiple weaknesses, then I can’t set it as more than one thing.
(All done in blueprints)
I.e

Switch on Enum Type:
When Fire -> Set Enum Weakness to Water
When Water -> Set Enum Weakness Grass
When Grass -> Set Enum Weakness Fire

But if I was to add “Bug” for example, I can’t have 2 weaknesses. Grass would be weak against both Fire and Bug. I couldn’t figure out how to create an array of Weaknesses? (fairly new still) Any tips?

And in terms of the battling system. If anyone can point me to a tutorial that would be fantastic. I couldn’t find one myself :frowning:

Thanks,
Meerkat

I think that you shouldnt be setting type weaknesses programatically, but instead create an actor class or an actor component class that contains the info about a determinated type.

This is just an example, but it might be useful for you.

Create an array of enums for each type’s weaknesses: for example FireWeak, set the default values of this array to the weaknesses of the fire type. Do this for each type.
When calling the function that returns the weaknesses you simply return the corresponding array. Something like this:

25865776246d7c8fc57ca7a4f4b00575ffa78c63.png