I've been able to figure out a prototype method for a simple turn based RPG combat system that works in one versus one. But I'm having a hell of a hard time figuring out how I would manage battles with one versus multiple enemies, any enemy type in any order, following turns, etc...
Like there are a couple orders I'd like to give, how in construct would you say things like:
"select the enemy at this position and attack him, use these values to figure out the result"
"take the speed value of all player and non player character in play and apply this formula to then write a list of order of attacks"
"the enemy at this spot is this particular type of enemy which has these statistic parameters"
Not expecting a complete logic course 101 but just wondering if you guys could give me a trail or a hint or two that could unblock me. Just a general method idea on how to structure all this and where should I focus my attention. I've been on this one for the past week, so any help is really appreciated!
Need the INI:
edit: more clarity
I think what you need is picking.
Sprite condition : section Pick
Pick random returns a random instance of the object type.
Pick closest test the distance between sprites and returns the closest
Pick farthest same but returns the farther from the given position
Pick by comparison allow you to apply the formula of your chosing returning the instance that corresponds best.
Check also in section "Private variable" Pick object with highest variable & lowest variable.
Allow you to test directly which instance of your object type has the higher/lower value.
The characteristics of your monsters should be stocked in private variables, easying picking.
Then once you picked one instance, use sub events. Any reference to the object type will apply actions/conditions to the instance picked.
Pick random SpriteMonster
+ SpriteMonster.health > 0
=> Add 1 to SpriteMonster.x
(For example. Only the picked SpriteMonster health PV will be tested. And only this instance will be moved if the condition is true.)
Now for groups, or testing each monsters :
System: For each object / for each object (ordered).
Such a loop will go through every instances of the object type. You can then test conditions and apply actions. For each iteration of the loop, only the current instance (picked by the loop) will be influenced.
Then again, you nest your tests/conditions in sub events of the "for each" loop.