I spawn a Type Text entity on my bosses ondeathscript. It pretty much solves the issue.You said that spawning text is not recommended, so I would like to know how to apply a script.
#import "data/scripts/kofx_actual.c"
void main()
{
actual_main();
}
void actual_main()
{
// by Douglas Baldan - O Ilusionista
void self = getlocalvar("self"); // get caller entity
int selfx = getentityproperty(self, "x")...
As shown in the video, I want the KO message to appear immediately when the opponent loses.
I spawn a Type Text entity on my bosses ondeathscript. It pretty much solves the issue.You said that spawning text is not recommended, so I would like to know how to apply a script.
#import "data/scripts/kofx_actual.c"
void main()
{
actual_main();
}
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.
}
}
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.
}
}
ondeathscript data/scripts/kofx.cI 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.