spawn remap

Gurtag

Active member
hey guys, i have been serching in the manual for a command or script but got nothing so far, so i though better just ask here, is there a way to set specific palette for an entity spawned with spawnframe command? i use alternatepal for most entities.
 
No. It will spawn in with its default palette. If you want to control the palette on spawn, best use one of the many script functions already floating around. Most of them will be written with a parameter to set the map number.

DC
 
Like this
Code:
void spawn01map(void vName, float fX, float fY, float fZ)
{
	//spawn01 (Generic spawner)
	//Damon Vaughn Caskey + Douglas Baldan
	//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.
	int  iMap = getentityproperty(self, "map"); // Get caller's remap.
	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, "map", iMap); //Set map.
    
	return vSpawn; //Return spawn.
}

It's DC old spawn01 function which I've added a map control, some years ago.
 
I believe that function above applies same palette as spawner to spawned entity

If you want to set palette directly, use this function:

Code:
void spawnMap(void vName, float fX, float fY, float fZ, int Map)
{
	//spawn01 (Generic spawner)
	//Damon Vaughn Caskey + Douglas Baldan
	//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.
	//Map: palette setting.

	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, "map", Map); //Set palette
   
	return vSpawn; //Return spawn.
}

Ex: @cmd spawnMap "wn2" 0 0 1 3

wn2 will be spawned using its 3rd palette
 
glad you posted the wrong one, have now anotter function that will be usefull when the time comes, btw, i have a few questions, does the name.c of the script file matters in some way? i mean, have several functions stored on script.c file wich works fine, but some time ago due to a so to speak a nice accident with openborstats trying to use a @cmd freeself 1 script on an anim, i found my self with a new script file aniScp.c out of nowere on my script folder, it also works like a charm when it comes to killing an entity, but if i put the freeself function on script.c and delete aniScp.c the game crashes with cant compile script error
 
That's because OpenBorStats is adding a reference to its "aniScp.c" file in your model's .txt file. So if you delete aniScp.c without deleting the "animationscript data/scripts/aniScp.c" line from the .txt file, the engine will try to read from a script file that doesn't exist.

In other words, you should be fine moving the function and deleting aniScp.c as long as you also delete the reference to it.
 
that is odd, when i changed the function to script.c also canged animationscript to script.c, even did a serch in files for aniScp.c on data folder but found nothing.
nvm, freeentity function was also needed and never put it on script.c, works now.
 
Back
Top Bottom