Help using spawn06 script (ty Bloodbane) to spawn my flashing X

apescott

Member
I've been messing with this still lately lol, but I can't get it to work in game... It just crashes when an enemy dies.
Here's what I have... What do I do to get it to work?

Code:
void spawn06(void vName, float fX, float fY, float fZ)
{
	//Spawns entity based on left screen edge and z axis
	//Auto adjust with camera's position
	//vName: Model name of entity to be spawned in.
	//fX: X distance relative to left edge
	//fY: Y height from ground
      //fZ: Z coordinate

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int Direction = getentityproperty(self, "direction");
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int YPos = openborvariant("ypos"); // Get camera position
        int Screen = openborvariant("hResolution"); // Get screen width

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

   if (Direction == 0){ //Is entity facing left?                  
      fX = Screen-fX; //Reverse X direction to match facing and screen length
   }

	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX + XPos, fZ + YPos, fY); //Set spawn location.
	return vSpawn; //Return spawn
}

Code:
name	xflash
health	0
type	none
shadow	0
animationscript data/scripts/spawn06.c

anim idle
	loop	0
	delay	3
	offset	0 170
	frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif
frame	data/chars/misc/x1.gif
        frame	data/chars/misc/x2.gif

Code:
anim	death
	loop	0
	offset	238 177
	bbox	0 0 0 0
        @cmd    spawn06 "xflash" 5 20 0
	delay	60
	frame	data/chars/simons/fall002.gif

I set it to ''load'' xflash in my models.txt, but it still crashes. I just want it to spawn the xflash entity at death. Pleae help it's driving me bonkers  :'( lol  Thanks guys  ;)
 
That function works fine here so the question is which build you are using? I can't guarantee this work in older build.

Also what did log say about this crash? No, not the error message at end of log, I refer to error message somewhere in middle of log.
 
Bloodbane said:
That function works fine here so the question is which build you are using? I can't guarantee this work in older build.

Also what did log say about this crash? No, not the error message at end of log, I refer to error message somewhere in middle of log.

It's a RAM issue. I don't have enough free to use the xflash. Here's the error:

Code:
********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'animationscript' data/chars/misc/xflash.txtTotal Ram: 2146660352 Bytes
 Free Ram: 1478967296 Bytes
 Used Ram: 18755584 Bytes

Release level data...........Level Unloading: 'data/levels/snes/st11.txt'
Total Ram: 2146660352 Bytes
 Free Ram: 1478959104 Bytes
 Used Ram: 18755584 Bytes

Done.
Total Ram: 2146660352 Bytes
 Free Ram: 1478959104 Bytes
 Used Ram: 18755584 Bytes

I'm using build 3.0 3713.7z
Thanks Blood =]
 
I did get my xflash to spawn by calling it with the spawn01 script, but how do I get it to spawn in a specific spot on the screen over the enemy icon? I know Bloodbane you mentioned making an entity that scrolls with the screen? Do I need another script for that or need to put in a command of some sort? I'm so close!!! =D
 
Back
Top Bottom