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...
rafhot said:
this is so cool!
i have added it to my fantastic four project and it give some cool flavor to it! thanks

Happy to help  the hp bar I made is quite similar to what your making so I was a bit enthusiastic about this.
did you have created some mini hp bar that pop up on enemies head? this sounds very cool too!

yes i have but the code is still buggy when i have it properly working i will share the method!

attached a picture to show it in action  ;)

[attachment deleted by admin]
 
yeah, as Maxman said, it looks very  rpgish Malik!!

ok I'm also trying this, so I'm following Pierwolf steps: I did the numflash entity, then the ndamage.c file... but where I should call the script? I tried this and I got a mess. on the enemy, to call the script I put:
Code:
icon	data/enemy/a1/icon.gif
diesound data/sounds/diek.wav
animationscript data/scripts/escript.c
takedamagescript data/scripts/tdamage/ndamage.c

If that not the right place, where I should call the script??
thanks in advance!
 
;D haha its weird how some people like these bars over head, i always hated them and thought it looks weird and unpolished, IMO hud is for those things and numbers or lifebars on characters in playing area looks weird.Its used in mmo games very often but i guess its for tactics to see which enemy is almost dying.
 
I don't like them either. But, different people just have different tastes.

BTW, the inverted reflection script seems from RV2. IMO they are not correct because reflection should be as tall as your original character, instead of half-sized like shown in the picture. ;)

 
It changes the flavour to some mods. Nick's Rivulet mod was looking very good with that addition. I don't think it fits every mod to be honest.

and again, can someone help me?


Die_In_Fire said:
I did the numflash entity, then the ndamage.c file... but where I should call the script? I tried this and I got a mess. on the enemy, to call the script I put:
Code:
icon	data/enemy/a1/icon.gif
diesound data/sounds/diek.wav
animationscript data/scripts/escript.c
takedamagescript data/scripts/tdamage/ndamage.c

If that not the right place, where I should call the script??
thanks in advance!
 
it creates unncontrollable clones of the player character. Interesting enough, enemies coul go and attack those clones. see the aattached image for reference (all the characters in white clothes are the same player character)...

I don't need to call the function with @cmd on the enemy .txt file??



[attachment deleted by admin]
 
utunnels said:
I don't like them either. But, different people just have different tastes.

BTW, the inverted reflection script seems from RV2. IMO they are not correct because reflection should be as tall as your original character, instead of half-sized like shown in the picture. ;)

the reflection is a custom gfx shadow and the reason they are not full size is due to the angle of the light!
 
malik4ever said:
the reflection is a custom gfx shadow and the reason they are not full size is due to the angle of the light!

Ah, I see.

Die_In_Fire said:
it creates unncontrollable clones of the player character. Interesting enough, enemies coul go and attack those clones. see the aattached image for reference (all the characters in white clothes are the same player character)...

I don't need to call the function with @cmd on the enemy .txt file??

That is strange. Can you post your ndamage.c here?
 
I just copy/pasted Pierwolf's:
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);
   }
}

and I just call it with:
Code:
takedamagescript data/scripts/tdamage/ndamage.c
I checked the location of the ndamage.c, and the numflash entity.
 
justy tried that:
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;
      clearspawnentry();
      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);
   }
}
but the engine crash when I hit the enemy, with this log:
Code:
There's an exception while executing script 'takedamagescript' data/enemy/a1/a1.txt
Code:
Function need a valid entity handle and at an interger parameter: updateframe(entity, int frame)
Script function 'updateframe' returned an exception, check the manual for details.

OpCode: 8

********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'takedamagescript' data/enemy/a1/a1.txtTotal Ram: 1063370752 Bytes
 Free Ram: 267939840 Bytes
 Used Ram: 18952192 Bytes
btw, I'm using old version 3709 (perhaps that's the problem?) because with the newest version I get this error:
Code:
Fatal Error in load_cached_model, file: data/enemy/c1/c1.txt, line 34, message: Failed to create colourmap. Failed to load file 2
and I think I read on the forum that Pierwolf got a similar one with Endless Quest mod.
 
Fatal Error in load_cached_model, file: data/enemy/c1/c1.txt, line 34, message: Failed to create colourmap. Failed to load file 2

in my experience, that simply means that in the c1.txt header you have more colourmap than the entity really has.
it was not a problem with older releases of the engine, but with newest releases it gives this problem.

try cancel that line and see if works.
 
Thanks, I already fixed that little problem by just adding the missing remaps.

Now tried the script with newest version, but I got the same error:
Code:
Function need a valid entity handle and at an interger parameter: updateframe(entity, int frame)
Script function 'updateframe' returned an exception, check the manual for details.

OpCode: 8

********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'takedamagescript' data/enemy/a1/a1.txt

Pierwolf, in regards to the takedamagescript, you are doing something I'm missing?
 
try this, it is my takedamage script:

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've seen your code has one too many line, compared with mine:

Code:
clearspawnentry();

maybe that was the problem.
 
I added that line as a suggested by UT, but originally my script was just the same as yours.

deleting that line, when I hit the enemy, it spawns clones of the player character (on jump sprite, with "parrow".
without deleting the line just crashs...
 
utunnels said:
By any chance, did you have that numflash loaded?

;)

yea i thinked about the same thing.... you have to create an entity and called it "numflash", or every other name by the way, just remember that if you change its name you have to change that call it in the script too.
 
I have "numflash" know-ed, not load-ed... (now missing the smiley with the fool-hat  :P  )

BUT now I have it load-ed on models.txt, and got this error:
Code:
Script compile error: can't find function 'dasher'

Script compile error in 'numflash': dasher line 9, column 12


Can't compile script!
so now the problem is the dasher on this line of the numflash entity:
Code:
	@cmd	dasher 0 0 -0.3
... as it seems I don't have the dasher function. However I put the "#" to ignore that line and works!!!, now I eed to adjust the offset. But I would like to use the dasher also. Where do I get that function from?

thanks a lot UT and Pierwolf!!
 
Back
Top Bottom