how to spawn01 + anichange

jonsilva

New member
hello

iam trying to modify the spawn01 script with the anichange script
so i can call the entity with any animation i whant...
like what iam using in level txt
spawn  biker1
@script void main() {
  performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW2"));
} @end_script
map    2
health  100
coords  450 420
at      0

iam trying to make this in enemy.txt
@cmd spawn06 "lgt1" 50 55 1  "ANI_FOLLOW2"


iam having trouble figuring out how to connect the 2 scripts
this is what ive done so far... but its not working

void spawn06(void vName, float fX, float fY, float fZ, float Ani)
{
//spawns entity with choosen animation
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fZ: Y location adjustment.
      //fY: 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.
}
      Ani = Ani + getentityproperty(self, "animation", openborconstant(Ani));
      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, Ani); //Set spawn location.
changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
return vSpawn; //Return spawn.
}

spawn01
void spawn01(void vName, float fX, float fY, float fZ)
{
//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.
//fZ: Y location adjustment.
      //fY: 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.
   
return vSpawn; //Return spawn.
}

Anichange
void anichange(void Ani)
{ // Animation changer
    void self = getlocalvar("self");
    changeentityproperty(self, "animation", openborconstant(Ani)); //Change the animation
}


anyone knows how to make this...
so it can work like

@cmd spawn06 "name" 50 55 1  "ANI_FOLLOW*"
 
Hi, adapted this code for my mod

Code:
void spawnAni(void vName, float fX, float fY, float fZ, void Ani, float Vx, float Vy, float Vz)
{
	//spawnB (Generic spawner) + Specific animation + velocities
	//Damon Vaughn Caskey + Douglas Baldan/O Ilusionista
	//07/06/2007 - 30/05/2013
	//
	//Spawns entity next to caller.
	//
	//vName: Model name of entity to be spawned in.
	//fX: X location adjustment.
	//fZ: Y location adjustment.
      //fY: 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.
    	performattack(vSpawn, openborconstant(Ani)); 
	changeentityproperty(vSpawn, "velocity", Vx, Vy, Vz);

	return vSpawn; //Return spawn.
}

usage:
@cmd spawnAni "soldier" 0 30 0 "ANI_FALL" -4 0 -4
spawnAni(Name,position X, position Y, position Z, Animation, velocity X, velocity Y, velocity Z)

This code let you choose which animation and which velocity the entity will have.
 
O Ilusionista said:
Hi, adapted this code for my mod

Code:
void spawnAni(void vName, float fX, float fY, float fZ, void Ani, float Vx, float Vy, float Vz)
{
	//spawnB (Generic spawner) + Specific animation + velocities
	//Damon Vaughn Caskey + Douglas Baldan/O Ilusionista
	//07/06/2007 - 30/05/2013
	//
	//Spawns entity next to caller.
	//
	//vName: Model name of entity to be spawned in.
	//fX: X location adjustment.
	//fZ: Y location adjustment.
      //fY: 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.
    	performattack(vSpawn, openborconstant(Ani)); 
	changeentityproperty(vSpawn, "velocity", Vx, Vy, Vz);

	return vSpawn; //Return spawn.
}

usage:
@cmd spawnAni "soldier" 0 30 0 "ANI_FALL" -4 0 -4
spawnAni(Name,position X, position Y, position Z, Animation, velocity X, velocity Y, velocity Z)

This code let you choose which animation and which velocity the entity will have.

If possible add in this script one flag to take pallete from the spawner?
I have tried to do it many times, but it did not work.
 
Insert this before "void vSpawn..."

int  iMap = getentityproperty(self, "map"); // Get caller's remap.

And insert this before "return vSpawn":

changeentityproperty(vSpawn, "map", iMap); //Set map.
 
O Ilusionista said:
Insert this before "void vSpawn..."

int  iMap = getentityproperty(self, "map"); // Get caller's remap.

And insert this before "return vSpawn":

changeentityproperty(vSpawn, "map", iMap); //Set map.

Works perfect!
Thanks my friend!
 
Back
Top Bottom