Hp Damage

Really wanted the text to fade out but changedrawmethod doesn't work on drawstring unfortunately.

This should give more of a rpg feel to some mods like edless quest and rise of the warduke.
 
msmalik681 said:
Really wanted the text to fade out but changedrawmethod doesn't work on drawstring unfortunately.

This should give more of a rpg feel to some mods like edless quest and rise of the warduke.

msmalik681
Nice idea! It still needs more tests but I'm working on the same feature on SOR2X using drawmethod, something similar to Ragnarok Online. I will share it with you, already applied in your demo

Basically I changed the file "damage.c" with the following code, and created some "number" entities to be spawned after:
Code:
void showDmg()
{
	void self 	= getlocalvar("self"); //Get calling entity.
	void vSpawn1;
	void vSpawn2;
	void alg1;
	void alg2;
	int num1;
	int num2;
	int damage 	= getlocalvar("damage");
	int dir 	= getentityproperty(self, "direction");
	int Vx 		= 0.5;
	int Vy 		= 1;
	int Px		= 0;
	int Pdif	= 10;
	
	if(damage < 10){
		num1 = "empty";
		num2 = damage;
	}else{
		num1 = damage/10;
		num2 = damage-num1*10;
	}
	
	if(num1 < 0){
		alg1 = "0";
	}
	else
	if(num1 >= 0 && num1 < 1){
		alg1 = "0";
	}
	else
	if(num1 >= 1 && num1 < 2){
		alg1 = "1";
	}
	else
	if(num1 >= 2 && num1 < 3){
		alg1 = "2";
	}
	else
	if(num1 >= 3 && num1 < 4){
		alg1 = "3";
	}
	else
	if(num1 >= 4 && num1 < 5){
		alg1 = "4";
	}
	else
	if(num1 >= 5 && num1 < 6){
		alg1 = "5";
	}
	else
	if(num1 >= 6 && num1 < 7){
		alg1 = "6";
	}
	else
	if(num1 >= 7 && num1 < 8){
		alg1 = "7";
	}
	else
	if(num1 >= 8 && num1 < 9){
		alg1 = "8";
	}
	else
	if(num1 >= 9 && num1 < 10){
		alg1 = "9";
	}
	else
	{
		alg1 = "empty";
	}
	
	
	if(num2 < 0){
		alg2 = "0";
	}
	else
	if(num2 >= 0 && num2 < 1){
		alg2 = "0";
	}
	else
	if(num2 >= 1 && num2 < 2){
		alg2 = "1";
	}
	else
	if(num2 >= 2 && num2 < 3){
		alg2 = "2";
	}
	else
	if(num2 >= 3 && num2 < 4){
		alg2 = "3";
	}
	else
	if(num2 >= 4 && num2 < 5){
		alg2 = "4";
	}
	else
	if(num2 >= 5 && num2 < 6){
		alg2 = "5";
	}
	else
	if(num2 >= 6 && num2 < 7){
		alg2 = "6";
	}
	else
	if(num2 >= 7 && num2 < 8){
		alg2 = "7";
	}
	else
	if(num2 >= 8 && num2 < 9){
		alg2 = "8";
	}
	else
	if(num2 >= 9 && num2 < 10){
		alg2 = "9";
	}
	else
	{
		alg2 = "empty";
	}
	
	if(dir == 0){
		Vx   = -Vx;
		Pdif = -Pdif;
	}
	
	vSpawn1 = spawn01(alg1,Px,100,0);
	vSpawn2 = spawn01(alg2,Px+Pdif,100,0);
	tossentity(vSpawn1, Vy, -Vx, 0);
	tossentity(vSpawn2, Vy, -Vx, 0);
}

The script will calculate the damage, take each algarism (0 to 99 only for now), convert each algarism to strings and call it as an entity according to your names. Need to create one character for each number, from 0 to 9.

From this point, you can apply any drawmethod effect because each algarism are converted to entities. I don't know if there is a better way to calculate but it's working. We can help each other to improve this script, can be a good feature to use in some games.

Here is the file:
https://drive.google.com/file/d/18iUuG97mhmgrlFTXDLEYWQopJtJ-omiA/view?usp=sharing

And a small video:
https://www.youtube.com/watch?v=67YBF8O8fGE
 
Nice damage number system, Kratus! I love how the text fades. I notice after I checked the video and a demo, I see each number is an entity which is quite clever. :) Excellent work, man!
 
Just FYI, when I can ever get the next release (Covid 19 stuff tripled my workload), drawmethod is available for text too. So you won't need to make the text an entity any more to get fade effect. :)

DC
 
Kratus This is amazing! It's just what I was looking for. I want to download it to use in future projects but the link doesn't seem to work anymore. Would you mind posting a new download link?
 
LittleBlueRiolu said:
Kratus This is amazing! It's just what I was looking for. I want to download it to use in future projects but the link doesn't seem to work anymore. Would you mind posting a new download link?
Hello LittleBlueRiolu
Sorry, I erased the old link, but I made a new pack using the SOR2X as base, you can download below:
https://drive.google.com/file/d/1sd6WFs_NeXUJZI5FxoUV3HHFUV3U2CFO/view?usp=sharing

You need to add all entity numbers (and the null entity too) to the models.txt file, and add the "takedamagescript" event to every character header.
Code:
takedamagescript	data/scripts/takedamage/takedamage.c

You can replace all number's sprites by any other if you want.
 
Back
Top Bottom