Solved About Spawnframe (enemies), Alias and Item Alias.

Question that is answered or resolved.
Greetings to all, I am working on my game and I have come across something that I have not been able to solve, reading the manual I still cannot find the answer.

I have created some enemies that spawn more enemies (using Spawnframe), but I would like these spawned enemies to have an Alias and maybe they can give an Item upon death. Can this be achieved in any way? Apparently this I cannot configure from the TXT of the level.


Thank you very much, I hope someone can help me.
 
Solution
Kalcetin Studio said:
but in my example from the video, I would like the enemy to call reinforcements from time to time,

Ah, it's a different story.

If you want infinite enemy spawner, I suggest creating one instead of forcing an enemy to drop clone of itself.
Something like:
Code:
name		NoriSpawn
type		none
animationscript	data/scripts/lescript.c
load		NoriCae


anim	idle
@script
    if(frame == 1){
      void self = getlocalvar("self");
      int Enemy = openborvariant("count_enemies");

      if(Enemy <= 1){
        performattack(self, openborconstant("ANI_FOLLOW1"));
      }
    }
@end_script
	delay	10
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif

anim	follow1
	delay	1
	offset	8...
not shure exactly what you trying to do, but yes, you could achive that functionality with script.

something like this could work for alias

Code:
void spawnAlias(void vName, float fX, float fY, float fZ, void name)
{
	//spawn01 (Generic spawner)
	//Damon Vaughn Caskey
	//07/06/2007
	//
	//Spawns entity next to caller.
	//
	//vName: Model name of entity to be spawned in.
	//fX: X location adjustment.
	//fY: Y location adjustment.
      //fZ: Z location adjustment.

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int  iDirection = getentityproperty(self, "direction");

	clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

	if (iDirection == 0){ //Is entity facing left?                  
          fX = -fX; //Reverse X direction to match facing.
	}

      fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
      fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
      fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
	
	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
	changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
    changeentityproperty(vSpawn, "name", name);
    
	return vSpawn; //Return spawn.
}

use like this 

	@cmd    spawnAlias "entityname" 200 0 0 "alias"


but for adding item you better wait for someone with more experience to pop up

 
Hello, Thanks for write.
Ok, this is what I am trying to do. I made an enemy, when I knock him down, he calls another enemy, I use this in his FALL animation
Code:
load NoriCae
custentity NoriCae      
spawnframe 2 420 1 1 0

"NoriCae" is the spawned entity, but I would like to assign it an Alias, since by default it is named "NoriCae" when I spawn it with Spawnframe
I have recorded a video to better illustrate my dilemma, activate the entity names to explain it better.
Thanks :D
 
Bloodbane said:
Whenever an enemy is expected to spawn another enemy on death, that enemy usually transforms form into deadlier form.

So Kalcetin Studio, am I right to think that you want NoriCae to transform after he dies?  ;)

Hello Bloodbane . Yes, I have a transformation planned in the bosses with this method, but in my example from the video, I would like the enemy to call reinforcements from time to time, I would like NoriCae to have an Alias "NORIHIKO". I would also like it to drop an Item upon death, I can do this with Spawnframe, but it would be very repetitive to drop the same item when the enemy is spawned several times.
Thanks =)
 
Gurtag said:
not shure exactly what you trying to do, but yes, you could achive that functionality with script.

something like this could work for alias

Code:
void spawnAlias(void vName, float fX, float fY, float fZ, void name)
{
	//spawn01 (Generic spawner)
	//Damon Vaughn Caskey
	//07/06/2007
	//
	//Spawns entity next to caller.
	//
	//vName: Model name of entity to be spawned in.
	//fX: X location adjustment.
	//fY: Y location adjustment.
      //fZ: Z location adjustment.

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int  iDirection = getentityproperty(self, "direction");

	clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

	if (iDirection == 0){ //Is entity facing left?                  
          fX = -fX; //Reverse X direction to match facing.
	}

      fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
      fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
      fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
	
	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
	changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
    changeentityproperty(vSpawn, "name", name);
    
	return vSpawn; //Return spawn.
}

use like this 

	@cmd    spawnAlias "entityname" 200 0 0 "alias"


but for adding item you better wait for someone with more experience to pop up
Thank you very much Gurtag  ... I have a question since I am still a beginner with scripts. This code should I put it in a script in the scripts folder, or can I use it in the TXT of the entity?
 
yep, you need to past it to script.c on your script folder, then past this line on entity spawner´s header:
"animationscript data/scripts/script.c" with out the quotes, then make use of it on the desired animation like this this:

anim  fall
delay etc
@cmd    spawnAlias "NoriCae " 0 0 0 "NoriCae222"

like i sayd before for further functionality ask dragon or ilu, they can help you with the item spawn
 
Kalcetin Studio said:
but in my example from the video, I would like the enemy to call reinforcements from time to time,

Ah, it's a different story.

If you want infinite enemy spawner, I suggest creating one instead of forcing an enemy to drop clone of itself.
Something like:
Code:
name		NoriSpawn
type		none
animationscript	data/scripts/lescript.c
load		NoriCae


anim	idle
@script
    if(frame == 1){
      void self = getlocalvar("self");
      int Enemy = openborvariant("count_enemies");

      if(Enemy <= 1){
        performattack(self, openborconstant("ANI_FOLLOW1"));
      }
    }
@end_script
	delay	10
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif

anim	follow1
	delay	1
	offset	8 14
	frame	data/chars/misc/empty.gif
	delay	200
	@cmd	spawnAlias "NoriCae" 0 0 0 "NORIHIKO"
	frame	data/chars/misc/empty.gif

This spawner will respawn NoriCae with NORIHIKO alias whenever number of enemies drop below 2 or lower.
The spawner itself isn't an enemy so it won't count itself.

You might need to modify this example for your need :)
 
Solution
Thank you very much, Gurtag Bloodbane, after several attempts I managed to implement the Scripts that you recommended to me and I managed to make them work. Now I just need to get them to give an item when they die, for now I can do it with spawnframe in their DEATH animation. I found it only works if I use the FALLDIE 2 command.

THANK YOU!
 
Back
Top Bottom