Actors can summon other actors during battle. This is how Magikoopa creates clones, Bill Blaster fires Bullet Bills, and bosses call in reinforcements.
SummonEnemy
Use SummonEnemy to summon an actor from a local formation. The summoned actor's ID is returned in LVar0.
Formation CloneFormation = {
OVL_ACTOR_BY_IDX("frost_goomba", BTL_POS_GROUND_C, 10),
};
EvtScript EVS_TakeTurn = {
// ...
Call(SummonEnemy,formationPtr Ref(CloneFormation),priority false)
// LVar0 now contains the new actor's ID
// ...
};The second argument controls priority ordering — false for normal priority, true for low priority.
Storing the summoned actor's ID
You'll usually want to save the summoned actor's ID in an actor variable so you can reference it later:
enum ActorVars {
AVAR_SpawnedActorID = 0,
};
EvtScript EVS_TakeTurn = {
// ...
Call(SummonEnemy,formationPtr Ref(CloneFormation),priority false)
Call(SetActorVar,
actorID ACTOR_SELF,varIndex AVAR_SpawnedActorID,value LVar0)
// ...
};Passing data to summoned actors
The simplest approach is to call SetActorVar on the summoned actor right after summoning it, using the actor ID returned in LVar0:
Call(SummonEnemy,formationPtr Ref(CloneFormation),priority false)
Call(SetActorVar,
actorID LVar0,varIndex 0,value true) // set the summoned actor's var 0See Actor Variables for more on how variables work.
For complete examples, see src/battle/common/actor/magikoopa.inc.c (cloning) and src/battle/common/actor/bill_blaster.inc.c (summoning projectiles).