Devlog #4: Multi-Target Selection
One of the next features I wanted to work on was the ability to select two more targets for a skill. In RPG Maker, this isn't really an
Your party finds themselves looking at a river, but the only bridge to the other side is broken. None of the party members can fly, even the chicken. So what can they do?
One of the party members has the ability to teleport targets from one location to another, so ideally you would simply pick an ally to teleport, select an empty tile on the other side of the bridge, and then performing the teleportation skill.
Seems pretty simple?!
However, how can this be accomplished in RPG Maker? Skills only let you make at most ONE selection based on the scope of the skill. If it's "one enemy", you can only pick one enemy. If it's "two random enemies", well it's random so you don't even get to pick.
Using the idea of being able to select a party member and then selecting an empty tile, I decided to build a plugin that let's you select multiple targets for a single action. In fact, it even works with AOE.
This works, but now we have a problem: it's the same skill. When I selected the "attack" skill, I can pick three targets, but all it does is repeat the attack skill multiple times. What if there was a way to specify WHICH skill should be used, for each selection?
There's also the problem of scope. If you wanted the first skill to target enemies, but a second skill to target allies, how does the game know to change scopes?
So I built a new feature called skill chains. It's pretty simple: you just note-tag your skill with something like
<skill chain: 12 />
<skill chain: 10 />
<skill chain: 11 />
So now you have your "main skill", followed by 3 additional skills based on database ID. If the skill requires a selection, the game will ask you to select a target.
Here's a demonstration of how skill chains work
So some things that I've solved here:
- target scope. If the skill should target enemies, it will ask you to select an enemy. If the skill should target allies, it will ask you to select an ally.
- skill usage. We didn't have to do anything special here: all skill costs, animations, and messages are shown.
Also, notice that the first and the third actions are the same. You can basically have the same skill performed multiple times by simply adding the same skill to the chain. This would effectively be a skill that allows you to target multiple enemies of your choice.
Now, skill chains are cool. For teleportation skill, I can now have
- Teleport: a skill that let's me pick an ally
- Teleport To: a chained skill that moves the ally to specified tile
But there's another problem: how does the second skill know who I picked? Basically, how do you reference the target in your formulas? Skills are all separate entities, they don't know about each other.
Looking back in History
To solve this problem, I need to provide a way for skills to "talk" to each other. This is done by accessing the "previous action" along with its result.
For example, you attack a monster and hit 20 damage. Then you have a follow-up chain skill that takes that damage, and recovers your HP by half the amount dealt, so 10 recovery.
By accessing the previous action's results, you can grab information such as the target it was used on, as well as the damage that was inflicted. So I wrote a new plugin called "Action History", which provides functions you can use inside your formulas. You can access the immediate previous result, or you can access ALL previous results if you wanted to do something with that information.
Putting it all together
This is how my I set up the "Teleport To" skill
<formula effect> //---------------------- var results = a.getPreviousResult(); var targetResults = results.target var battler = targetResults.battler; //---------------------- var pos = b.getBattlePosition(); battler.moveTo(pos); //---------------------- </formula effect>
The first section is how we access the user's previous action's result. We don't do any error-checking here because we assume this skill will only be used as part of a skill chain. It should be straightforward: you grab the previous results for the target of the action and then grab the targeted battler.
Then the second setion is our re-positioning command: we grab the current action's target "b", grab its battle position, and then we move the previously targeted battler to the position.
And this is the result
What kind of things can you do with this?
Get Grid Battle System for RPGMaker
Leave a comment
Log in with itch.io to leave a comment.