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.
So, is there any script doing exactly this summonframe property?
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.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?
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);
}
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.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.
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);
}
}
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);
}
}
}
Awesome!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.
@cmd summon "Ryu" 0 0 1 8
@cmd killSummon 8 1
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);
}
}