- Joined
- May 16, 2020
- Messages
- 660
Hi guys,
I'm trying to re-create Doom 's "Devour" ability from dota 2:
"Consumes an enemy or neutral creep, acquiring any special abilities that it possessed."
I have around 20 creeps in my map, each with their own abilities. To determine which ability I need to add to my hero upon devouring a unit, I would need to run a huge nested if function (if devoured unit = X, add ability X, else if devoured unit = Y, add abilly Y, etc...). But this is not very elegant nor efficient I'd say.
So my question: Is there a more elegant and efficient way to determine which ability I need to add based on which target is chosen to devour?
Cheers
I'm trying to re-create Doom 's "Devour" ability from dota 2:
"Consumes an enemy or neutral creep, acquiring any special abilities that it possessed."
I have around 20 creeps in my map, each with their own abilities. To determine which ability I need to add to my hero upon devouring a unit, I would need to run a huge nested if function (if devoured unit = X, add ability X, else if devoured unit = Y, add abilly Y, etc...). But this is not very elegant nor efficient I'd say.
So my question: Is there a more elegant and efficient way to determine which ability I need to add based on which target is chosen to devour?
Cheers