I want to create a summon ability. Like this:
1) costs energy
2) unit plays animation
3) at certain point in animation, summoned unit appears
What is a good dummy ability to base this on? I experimented with burrow, but ran into issues.
Step 3) is NOT the issue, I know how to do this with GPTP.
Responsible for my own happiness? I can't even be responsible for my own breakfast
Rather than basing it on an ability at all, I'd recommend using the "Carrier Stop" or "Reaver Stop" orders. These are pretty useful for actions where you just want the player to press a button and have something happen.
Here's a skeleton of what that might look like:
if(unit->mainOrderId == OrderId::CarrierStop) {
unit->orderToIdle();
if(unit->energy < 25600) {
scbw::showErrorMessageWithSfx(unit->playerId, 864, 158);
}
else {
//do stuff here
}
}
You will need to make sure that you edit the requirements for the Carrier Stop order so that your unit can use it.
As far as playing an animation goes, you can use unit->sprite->playIscriptAnim() to do that, and the sigorder iscript opcode to communicate back to GPTP. So perhaps our code might look something like this:
if(unit->mainOrderId == OrderId::CarrierStop) {
unit->orderToIdle();
if(unit->energy < 25600) {
scbw::showErrorMessageWithSfx(unit->playerId, 864, 158);
}
else {
unit->sprite->playIscriptAnim(IscriptAnim::CastSpell, true);
}
}
else if (unit->orderSignal == 16) {
//summon the unit here
}
And our iscript something along these lines:
playfram 0x11 # Frame set 12
wait 1
playfram 0x22 # Frame set 2
sigorder 16
wait 1
playfram 0x33
wait 1
to ensure that we summon the unit at the appropriate point in the animation.