Solved k.o I want to make the sprite come out of the screen.

Question that is answered or resolved.

DD Tokki

Well-known member
KoR - 0036.png
KoR - 0036-.PNG

I want the KO message to appear immediately when the boss is defeated. The command in the header is "falldie 2" and I would like to know how to keep this and make the ko text pop up.
 
Solution
You said that spawning text is not recommended, so I would like to know how to apply a script.
I spawn a Type Text entity on my bosses ondeathscript. It pretty much solves the issue.
Btw, I think @DCurrent wasn't saying to not use TYPE TEXT entities, but to avoid using other method that not ondeathscript, since its perfect for that.

As I use a fowarder, you would need two files:

save this as kofx.c under your scripts folder:

C-like:
#import "data/scripts/kofx_actual.c"
void main()
{
    actual_main();
}

Then save this on the same folder as kofx_actual.c
C-like:
void actual_main()
{
// by Douglas Baldan - O Ilusionista
void self = getlocalvar("self"); // get caller entity
int selfx = getentityproperty(self, "x")...
The most stable way is to spawn it using the opponent's ondeath script.

You can also use the text base spawn or summon commands, or even spawn it as an item, but these are very messy and not recommended methods.

DC
 
You said that spawning text is not recommended, so I would like to know how to apply a script.
I spawn a Type Text entity on my bosses ondeathscript. It pretty much solves the issue.
Btw, I think @DCurrent wasn't saying to not use TYPE TEXT entities, but to avoid using other method that not ondeathscript, since its perfect for that.

As I use a fowarder, you would need two files:

save this as kofx.c under your scripts folder:

C-like:
#import "data/scripts/kofx_actual.c"
void main()
{
    actual_main();
}

Then save this on the same folder as kofx_actual.c
C-like:
void actual_main()
{
// by Douglas Baldan - O Ilusionista
void self = getlocalvar("self"); // get caller entity
int selfx = getentityproperty(self, "x"); // get caller x position
int XPos = openborvariant("xpos"); //Get screen edge's position
int YPos = openborvariant("ypos"); // Get camera position

if (selfx > XPos + 480 ){
        spawn06("kofx", 240, 0, 140, 1);
      } else if (selfx < XPos + 1 ){
        spawn06("kofx", 240, 0, 140, 1);
      } else {
        spawn01("kofx", 0, 40, 0);
      }
}

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.
  if (vSpawn){// safe check

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

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.

  if (vSpawn){// safe check

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

It will need am entity called "kofx", which is the ko text.
My code check for the character position, to display the KO effect always where the boss is.
If you don't need this and wants the effect always in the same position, then you need to change the code to this:

C-like:
void actual_main()
{
// by Douglas Baldan - O Ilusionista
void self = getlocalvar("self"); // get caller entity
        spawn01("kofx", 0, 40, 0);
}


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.


  if (vSpawn){// safe check


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

You may already have both spawn06 and spawn01 functions, but I've added them anyway here.
also, my version inclusde a safe check.
 
Solution
I set up the script and the game ran without a problem, but kofx.txt could not be loaded.
The directory where the current file is located is data/chars/misc/KO/kofx.txt
 
I spawn a Type Text entity on my bosses ondeathscript. It pretty much solves the issue.
Btw, I think @DCurrent wasn't saying to not use TYPE TEXT entities, but to avoid using other method that not ondeathscript, since its perfect for that.

As I use a fowarder, you would need two files:

save this as kofx.c under your scripts folder:

C-like:
#import "data/scripts/kofx_actual.c"
void main()
{
    actual_main();
}

Then save this on the same folder as kofx_actual.c
C-like:
void actual_main()
{
// by Douglas Baldan - O Ilusionista
void self = getlocalvar("self"); // get caller entity
int selfx = getentityproperty(self, "x"); // get caller x position
int XPos = openborvariant("xpos"); //Get screen edge's position
int YPos = openborvariant("ypos"); // Get camera position

if (selfx > XPos + 480 ){
        spawn06("kofx", 240, 0, 140, 1);
      } else if (selfx < XPos + 1 ){
        spawn06("kofx", 240, 0, 140, 1);
      } else {
        spawn01("kofx", 0, 40, 0);
      }
}

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.
  if (vSpawn){// safe check

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

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.

  if (vSpawn){// safe check

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

It will need am entity called "kofx", which is the ko text.
My code check for the character position, to display the KO effect always where the boss is.
If you don't need this and wants the effect always in the same position, then you need to change the code to this:

C-like:
void actual_main()
{
// by Douglas Baldan - O Ilusionista
void self = getlocalvar("self"); // get caller entity
        spawn01("kofx", 0, 40, 0);
}


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.


  if (vSpawn){// safe check


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

You may already have both spawn06 and spawn01 functions, but I've added them anyway here.
also, my version inclusde a safe check.
ondeathscript data/scripts/kofx.c

I wrote the script in the boss header like this, is that correct?
And the structure calls kofx.txt with Spawn01 or 06, right?
I was wondering if I missed something somewhere. The game runs fine, but
KO is not out yet.
I wonder if the directory created above is the cause.
 
Back
Top Bottom