Alright, we can try an array for that.
JavaScript:
<Custom Apply Effect>
if (!user._afterEffects) {
user._afterEffects = []
}
user._afterEffects.push(25)
user.addState(X)
</Custom Apply Effect>
<Custom Remove Effect>
var index = user._afterEffects.indexOf(25)
if (index > -1) user._afterEffects.splice(index, 1)
</Custom Remove Effect>
This is your 'summon' state. When the state is applied, it checks to see if the user._afterEffects array exists, and if it doesn't it creates it. After it knows the array exists, it pushes 25 to it, the skillId of the skill to use. If the state is removed, it doesn't delete the array, it removes an index which contains 25 from it.
This state is for your one specific example of lets say a skeleton. If it dies, and the state is removed, we don't want it killing all of your summons at once, so it only removes the skeletons skill from the array.
Next, you need a new state, which is used solely to spam after effect skills. This state is added on the apply effect above, change the X to it's Id. All of the summon states should all add the same state. There should be only one of these states. You could summon a monkey, a skeleton, a fire elemental and an elephant, and they all add their own unique state above and each of those states only adds this one state below.
The new state is going to have a confirm effect similar to what we already had, but using the array. It's going to grab the first value from the array, as pushed to it above, and forceaction that, then increment a counter variable so at the end of that force action it will know to do the next one on the next go around.
JavaScript:
<Custom Confirm Effect>
user._counter = (user._counter != undefined) ? user._counter + 1 : 0
if (user._afterEffects[user._counter]){
user.forceAction(user._afterEffects[user._counter], -2)
} else {
user._counter = undefined
}
</Custom Confirm Effect>
What this should do, is after using
any skill that hits it will force the first skill in the array. When that skill hits, it will increment the counter and use the next skill in the array. Then the next, until the counter gets higher than the number of skills in the array. At that point, nothing should happen and the turn should end on it's own.
At the end of the next action, the same thing should happen.
Keep in mind this might cause an infinite loop, if one of the skills added adds another force action to the list.