Solved showing damage in numbers

Question that is answered or resolved.
Solution
ok, i've tested the script and it works!

i've made a "numflash" entity:

Code:
name	numflash
type	none
shadow	0
toflip 1
facing 1
setlayer	9999999
lifespan	1

palette data/chars/misc/numflash/numflash.gif #1

anim spawn
	loop	0		
	offset     225 201
	delay		1000
	frame	data/chars/misc/numflash/0.gif
	frame	data/chars/misc/numflash/1.gif
	frame	data/chars/misc/numflash/2.gif
	frame	data/chars/misc/numflash/3.gif
	frame	data/chars/misc/numflash/4.gif
	frame	data/chars/misc/numflash/5.gif
	frame	data/chars/misc/numflash/6.gif
	frame	data/chars/misc/numflash/7.gif

	delay		1000
	@cmd	dasher 0 0 -0.3
	frame	data/chars/misc/numflash/8.gif
	frame	data/chars/misc/numflash/9.gif
	frame	data/chars/misc/numflash/minus.gif

anim idle
	loop	0
	offset...
this is how i've done:

first of all, you have to create a dasher.c, this is the code:
Code:
void dasher( float Vx, float Vy, float Vz)
{
    void self = getlocalvar("self");
    int dir = getentityproperty(self,"direction");

    if(dir==0){
      Vx = -Vx ;
    }

    changeentityproperty(self, "velocity", Vx, Vz, Vy);
}

then you have to add it in the animationscript in the numflash header, then in the numflash spawn animation, you have to add the following code at the first frame:

Code:
@script
{
dasher(0,0.3,0);
}
@end_script

here it is for example, my numflash:

Code:
name numflash
type none
shadow 0
toflip 1
facing 1
antigravity 100
setlayer 99999999
lifespan   1
animationscript    data/scripts/dasher.c

palette data/chars/misc/numflash/numflash.gif #1

anim spawn
loop   0      
offset     225 251
delay      -1
@script
{
dasher(0,0.3,0);
}
@end_script
   frame   data/chars/misc/numflash/0.gif
   frame   data/chars/misc/numflash/1.gif
   frame   data/chars/misc/numflash/2.gif
   frame   data/chars/misc/numflash/3.gif
   frame   data/chars/misc/numflash/4.gif
   frame   data/chars/misc/numflash/5.gif
   frame   data/chars/misc/numflash/6.gif
   frame   data/chars/misc/numflash/7.gif
   frame   data/chars/misc/numflash/8.gif
   frame   data/chars/misc/numflash/9.gif
   frame   data/chars/misc/numflash/minus.gif

anim idle

hope it helps  :)
 
Die_In_Fire said:
(wow, how I miss the old smileys!)

We should have them back eventually.  The files for the smileys need to be transferred from the LavaLit server, but we'll have to wait a while longer for reasons I won't go into here.
 
EDIT: Okay, so I got it to work, but...

rxesABw.png


Exactly how does the offset work? I have a small offset because my individual numbers are small. How do I get the numbers to appear over the enemy?
 
Actually no, I figured it out again! :)

The main script for numflash looks like this, right?
Code:
void main()
{
   int damage = getlocalvar("damage");
   void self = getlocalvar("self");
   int x, z, a, t;
   void f;
   if(damage)
   {
      x = getentityproperty(self, "x");
      z = getentityproperty(self, "z")+1;
      a = getentityproperty(self, "a")-50;
      setspawnentry("name", "numflash");
      while(damage)
      {
         t = damage % 10;
         f = spawn();
         changeentityproperty(f, "position", x,z,a);
         updateframe(f, t);
         damage/=10;
         x -= 8;
      }
      f = spawn();
      changeentityproperty(f, "position", x,z,a);
      updateframe(f, 10);
   }
}

I changed this line...
Code:
      a = getentityproperty(self, "a")-50;
To this...
Code:
      a = getentityproperty(self, "a")+30;
And it looks much better!

Note, you may want to give it a higher value depending on how big your sprites are. ClaFan uses tiny sprites, so +30 worked just fine. But I imagine for KOF sized characters, something like +120 is probably better.
 
Instead of using an arbitrary setting to compensate for size, try adding the height property in. This will make the script self adjust to any size entity and then your adjustment becomes a universal 'how high over the head' setting.
 
Back
Top Bottom