• All, I am currently in the process of migrating domain registrations. During this time there may be some intermittent outages or slowdowns. Please contact staff if you have any questions.

Script for summonframe

StrikerX

Member
One big difference between spawnframe and summonframe, (besides the unsumon option) is that once the summoned entity is in the game, it cannot be summoned again, until it dies. So, is there any script doing exactly this summonframe property?
 
summonframe limits only one summoned entity, while spawnframe accepts any summoned entity.

spawnframe {frame} {x} {z} {a} {relative}

  • Used to make entity to spawn another entity. Normally it is used to spawn enemy. Spawning with this has no limit.
  • The spawned entity is determined by 'subentity' or 'custentity'.
  • {frame} determines at which frame the other entity is spawned.
  • {x} determines spawn range in x axis.
  • {z} determines spawn range in z axis.
  • {a} determines spawn range in y axis.
  • {relative} determines where the other entity is spawned.
    • 0, count from the spawner. Spawned entity will face same direction with the spawner.
    • 1, count from screen offset.
  • Regardless of spawned entities, 'group' settings (see below) in level texts won't prevent them from being spawned at all. Though, after they are spawned, 'group' will still count them.

summonframe {frame} {x} {z} {a} {relative}

  • Used to make entity to spawn another entity. Normally it is used to spawn enemy. Spawning with this is limited to 1 entity.
  • The spawned entity is determined by 'subentity' or 'custentity'.
  • {frame} determines at which frame the other entity is spawned.
  • {x} determines spawn range in x axis.
  • {z} determines spawn range in z axis.
  • {a} determines spawn range in y axis.
  • {relative} determines where the other entity is spawned.
    • 0, count from the spawner. Spawned entity will face same direction with the spawner.
    • 1, count from screen offset.
  • Summoned entity can be killed with 'unsummonframe'.
  • Regardless of spawned entities, 'group' settings (see below) in level texts won't prevent them from being spawned at all. Though, after they are spawned, 'group' will still count them.
  • Summonframe also populates a hidden value on the parent entity with the child entity. This does two things - it allows you to later use the Unsummon command to kill the child entity, and also automatically kills the child entity when parent entity dies. That's also why you can only "summon" one entity at a time without script, but you can "spawn" as many as you want.


unsummonframe {frame}

  • Used to kill summoned entity which was summoned by 'summonframe'. Obviously you need to use 'summonframe' before.
  • {frame} determines at which frame the other entity is spawned.

Do you want to limit how many times you spawn a summoned entity? If not, how do you want that to act like summonframe in script?
 
summonframe limits only one summoned entity, while spawnframe accepts any summoned entity.



Do you want to limit how many times you spawn a summoned entity? If not, how do you want that to act like summonframe in script?
Thanks for replay. So... I want to limit! If I summon an entity, even if the command is done again, it won't be summoned again until the entity dies.

For ex. D, U A1 Freespecial10 summon Ryu. So even if I do it more times D,U A1, Ryu will not back again.

But you may ask, why I dont want to use sommonframe native code? So I say, the native code is limited, it doesn't allow me to establish an alias, map, Ani_follow, etc.

would be realy nice if native code was: summonframe {frame} {x} {z} {a} {relative} {Ani_Follow#} {map} {alias}:love:

But I have elements to code this:

Code:
void summonframe (void Name, float dx, float dy, float dz, char Alias, void Ani, int iMap)
{
   void self = getlocalvar("self");
   void Spawn;
     Spawn = spawn01(Name, dx, dy, 0);
   changeentityproperty(Spawn, "name", Alias);
 performattack(Spawn, openborconstant(Ani));
 changeentityproperty(Spawn, "map", iMap);
}

however this code use the spawnframe, that doesn't check if the entity already exists in stage, I think the original code of the summonframe checks if already there is a entity in the stage, if it exists, it kills the next spawn.
 
Last edited:
Thanks for replay. So... I want to limit! If I summon an entity, even if the command is done again, it won't be summoned again until the entity dies.

For ex. D, U A1 Freespecial10 summon Ryu. So even if I do it more times D,U A1, Ryu will not back again.
Try to take a look at Beast who summons his robot assistant in the Avengers mod. There's a script that limits its spawn/summon only once until it dies. No spawnframe or summonframe is used at all. I use that same script and same procedure, but for summoning projectiles for my own. At first hand, you'll see a freespecial command until you realize there's a follow animation inside the command of script under freespecial.
 
I've coded summon function:
C:
void summon(void Name, float dx, float dy, float dz, void Slot)
{ // Spawn certain entity and store it in defined slot
// Doesn't always respawning if last entity still exists
    void self = getlocalvar("self");
    void Sum = getentityvar(self, Slot);

    if(Sum){
      int SHP = getentityproperty(Sum,"health");
      int SEx = getentityproperty(Sum,"exists");

      if(SHP<=0 || SEx==0){
        Sum = NULL();
      }
    }

    if(Sum==NULL()){
      void Spawn = spawn01(Name, dx, dy, dz);

      setentityvar(self, Slot, Spawn);
    }
}

This script spawns entity then store it in spawner's entity variable. There are lines which checks stored entity handle to prevent double summon.
Related to this, there's this script to unsummon the summoned entity:
C:
void killSummon(void Slot, int Flag)
{ // Kill summoned entity based on defined slot
    void self = getlocalvar("self");
    void Sum = getentityvar(self, Slot);

    if(Sum){
      setentityvar(self, Slot, NULL());

      if(Flag==1){
        damageentity(Sum, self, 1000, 0, openborconstant("ATK_NORMAL"));
      } else {
        killentity(Sum);
      }
    }
}

This script has extra parameter to define how summoned entity will be unsummoned.

The summon function could be expanded for extra settings etc.
 
I've coded summon function:
C:
void summon(void Name, float dx, float dy, float dz, void Slot)
{ // Spawn certain entity and store it in defined slot
// Doesn't always respawning if last entity still exists
    void self = getlocalvar("self");
    void Sum = getentityvar(self, Slot);

    if(Sum){
      int SHP = getentityproperty(Sum,"health");
      int SEx = getentityproperty(Sum,"exists");

      if(SHP<=0 || SEx==0){
        Sum = NULL();
      }
    }

    if(Sum==NULL()){
      void Spawn = spawn01(Name, dx, dy, dz);

      setentityvar(self, Slot, Spawn);
    }
}

This script spawns entity then store it in spawner's entity variable. There are lines which checks stored entity handle to prevent double summon.
Related to this, there's this script to unsummon the summoned entity:
C:
void killSummon(void Slot, int Flag)
{ // Kill summoned entity based on defined slot
    void self = getlocalvar("self");
    void Sum = getentityvar(self, Slot);

    if(Sum){
      setentityvar(self, Slot, NULL());

      if(Flag==1){
        damageentity(Sum, self, 1000, 0, openborconstant("ATK_NORMAL"));
      } else {
        killentity(Sum);
      }
    }
}

This script has extra parameter to define how summoned entity will be unsummoned.

The summon function could be expanded for extra settings etc.
Awesome!

I used in animationscript

Code:
@cmd    summon "Ryu" 0 0 1 8
@cmd    killSummon 8 1
It works well! Thank you very much!!

I also include my changes:

Code:
void summonC(void Name, float dx, float dy, float dz, char Alias, void Ani, int iMap, void Slot)
{ // Spawn certain entity and store it in defined slot 
// Usage: @cmd    summonC "Ryu" 0 0 1 "Karate_man" "ANI_FREESPECIAL" 1 8
// Doesn't always respawning if last entity still exists
    void self = getlocalvar("self");
    void Sum = getentityvar(self, Slot);

    if(Sum){
      int SHP = getentityproperty(Sum,"health");
      int SEx = getentityproperty(Sum,"exists");

      if(SHP<=0 || SEx==0){
        Sum = NULL();
      }
    }

    if(Sum==NULL()){
      void Spawn = spawn01(Name, dx, dy, dz);

 changeentityproperty(Spawn, "name", Alias);
 performattack(Spawn, openborconstant(Ani));
 changeentityproperty(Spawn, "map", iMap);

      setentityvar(self, Slot, Spawn);
    }
}
 
Last edited:
Back
Top Bottom