Attack That Spawns Random Enemy With Random Palette

Weoooo

Member
So, I had an idea that a spooky demon could have an attack where they make a spooky portal. That spooky portal would then randomly spit out a spooky rat, a spooky bat, or a spooky hat. You know. Normal stuff.

I can see it being done by having the spooky demon have an attack that uses summonframe to create a spookyportal.txt, which is an enemy that can't move and has 3 attacks that use spawnframe to create spookyrat.txt, spookybat.txt, and spookyhat.txt. Since attacks on enemies are, as far as I can tell, chosen fairly randomly unless you start giving them parameters for their use, this seems like a pretty obvious solution.

But then I thought "what if I wanted different colors?" I suppose you could change them to spawn with a specific palette and just bump up the attacks, but that seems... inefficient. There's probably a way to create a list then have the things within it chosen at random. But if that's the case, couldn't you do that with the spawned entities, too?

I'm unsure. After looking at things for a while, I decided to just ask and see.
 
So, I had an idea that a spooky demon could have an attack where they make a spooky portal. That spooky portal would then randomly spit out a spooky rat, a spooky bat, or a spooky hat. You know. Normal stuff.

I can see it being done by having the spooky demon have an attack that uses summonframe to create a spookyportal.txt, which is an enemy that can't move and has 3 attacks that use spawnframe to create spookyrat.txt, spookybat.txt, and spookyhat.txt. Since attacks on enemies are, as far as I can tell, chosen fairly randomly unless you start giving them parameters for their use, this seems like a pretty obvious solution.

But then I thought "what if I wanted different colors?" I suppose you could change them to spawn with a specific palette and just bump up the attacks, but that seems... inefficient. There's probably a way to create a list then have the things within it chosen at random. But if that's the case, couldn't you do that with the spawned entities, too?

I'm unsure. After looking at things for a while, I decided to just ask and see.

What you described is an old hackaround I call the Daisy Chain spawn. Trust me, you don't want to do that. It's clunky, limited, unstable, and outdated over ten years now since we have script.

What you really want to do is use the spawn function, and a random number generator rand() to decide which spawn to use. There's lot of examples, and IIRC @Bloodbane has posted a few.

DC
 
I can see it being done by having the spooky demon have an attack that uses summonframe to create a spookyportal.txt,

You need to decide which entity who will do the spawning. Both are doable but each has pros and cons.

1. Demon spawns enemies himself
This one is straightforward and easier to understand (by both players and modder).
2. Demon spawns a portal to spawn the enemies
This one is less easy cause you'd need to create separate entity but it could create extra challenge if the portal could spawn enemies while the demo is moving and attacking.

So which one do you prefer? @Weoooo
 
You need to decide which entity who will do the spawning. Both are doable but each has pros and cons.

1. Demon spawns enemies himself
This one is straightforward and easier to understand (by both players and modder).
2. Demon spawns a portal to spawn the enemies
This one is less easy cause you'd need to create separate entity but it could create extra challenge if the portal could spawn enemies while the demo is moving and attacking.

Personally, I'd like the second one. I like the idea of having a portal spawner to begin with, cause a thing that spawns bad guys is a fun and interesting obstacle that I don't recall seeing much of in brawlers.
 
I don't recall seeing much of in brawlers.

Yeah, bosses which call backups or summon other enemies in beatmups are so few let alone ones using portals.
Speaking of portal, here's my suggestion of portal:
Code:
name        EPortal
type        none
setlayer    1
lifespan    2
load        En1
load        En2
load        En3


anim    idle
    delay    5
    offset  100 30
    frame    data/chars/effects/arcana.png
    frame    data/chars/effects/arcana.png

anim    spawn
@script
  if(frame==1){
    void self = getlocalvar("self");
    int r = rand()%15+15;

    if(r > 20){
      performattack(self, openborconstant("ANI_FOLLOW1"));
    } else if(r > 10){
      performattack(self, openborconstant("ANI_FOLLOW2"));
    } else {
      performattack(self, openborconstant("ANI_FOLLOW3"));
    }
  }
@end_script
    delay    1
    offset  100 30
    frame    data/chars/effects/arcana.png
    frame    data/chars/effects/arcana.png

anim    follow1
    delay    5
    offset  100 30
    spawnframe 1 0 0 0 0
    custentity En1
    frame    data/chars/effects/arcana.png
    delay    500
    frame    data/chars/effects/arcana.png
    frame    data/chars/effects/arcana.png

anim    follow2
    delay    5
    offset  100 30
    spawnframe 1 0 0 0 0
    custentity En2
    frame    data/chars/effects/arcana.png
    delay    500
    frame    data/chars/effects/arcana.png
    frame    data/chars/effects/arcana.png

anim    follow3
    delay    5
    offset  100 30
    spawnframe 1 0 0 0 0
    custentity En3
    frame    data/chars/effects/arcana.png
    delay    500
    frame    data/chars/effects/arcana.png
    frame    data/chars/effects/arcana.png

arcana.png is just ground symbol to represent the portal. You could replace that with other image.
The most important part is the script in SPAWN animation which chooses which animation to play randomly.

This version is simple and straightforward. It could be expanded to respawn same enemy or rerandomize the choice for chance to spawn different enemy.
 
Back
Top Bottom