Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Grey_Wolf

Thing_Damage2 and Custom Damagetypes

Question

Hello there!

After some time that I've been doing other things, I'm back to tweaking a bleeding/wound system I made time ago.

So I have this script:

Spoiler

Script "RUPTURE" (void)       //Open wound inflicted by monsters
{
	int armorsave = GetArmorInfo(ARMORINFO_SAVEPERCENT);
	int i;
	
	If(CheckInventory("CanBleed"))
	{
			If(armorsave >= 0.3 && armorsave < 0.4) //uniform armor
            {
				for (i=0;i<15;i++) // 3*15 times = 45 dmg
				{
                	Thing_Damage2(0,3,"Bleeding");
					SetHudSize(640, 480, true);
					setfont("smallfont");
					HudMessage(s:"deep laceration"; HUDMSG_FADEINOUT, 203, CR_BRICK,320.0, 450.0,1.0);
					setfont("SCRATCH");
					HudMessage(s:"A"; HUDMSG_FADEINOUT, 202, CR_UNTRANSLATED, 100.0, 240.0,10.0);
					int x1 = GetActorX(0);
					int y1 = GetActorY(0);
					int z1 = GetActorZ(0)+10.0;
					Spawn("Brutal_LiquidBlood3",x1,y1,z1,0,0);				
					delay(35*1);
				}
            }
			Else if(armorsave >= 0.4 && armorsave < 0.6) //lightarmor, helmet
            {
				for (i=0;i<10;i++) // 3*10 times = 30 dmg
				{
                	Thing_Damage2(0,3,"Bleeding");
					SetHudSize(640, 480, true);
					setfont("smallfont");
					HudMessage(s:"laceration"; HUDMSG_FADEINOUT, 203, CR_RED,320.0, 450.0,1.0);					
					setfont("SCRATCH");
					HudMessage(s:"A"; HUDMSG_FADEINOUT, 202, CR_UNTRANSLATED, 100.0, 240.0,10.0);
					int x2 = GetActorX(0);
					int y2 = GetActorY(0);
					int z2 = GetActorZ(0)+10.0;				
					Spawn("Brutal_LiquidBlood3",x2,y2,z2,0,0);	
					delay(35*1);
				}
            }
            Else If(armorsave >= 0.6 && armorsave < 0.8) // mediumarmor
            {
				for (i=0;i<15;i++) // 1*15 times = 15 dmg
				{
                	Thing_Damage2(0,1,"Bleeding");
					SetHudSize(640, 480, true);
					setfont("smallfont");
					HudMessage(s:"mild laceration"; HUDMSG_FADEINOUT, 203, CR_RED,320.0, 450.0,1.0);				
					setfont("SCRATCH");
					HudMessage(s:"A"; HUDMSG_FADEINOUT, 202, CR_UNTRANSLATED, 100.0, 240.0,10.0);
					int x3 = GetActorX(0);
					int y3 = GetActorY(0);
					int z3 = GetActorZ(0)+10.0;
					Spawn("Brutal_LiquidBlood3",x3,y3,z3,0,0);					
					delay(35*1);
				}
            }
            Else If(armorsave >= 0.8)  //heavyarmor
            {
				setfont("smallfont");
				HudMessage(s:"laceration absorbed !"; HUDMSG_PLAIN, 203, CR_GREEN,320.0, 450.0,3.0);
				DELAY(35*3);
				terminate;
			}
			
			Else //no armor
			{
			for (i=0;i<25;i++) // 3*25 times = 75 dmg
			{
			Thing_Damage2(0,3,"Bleeding");
			SetHudSize(640, 480, true);
			setfont("smallfont");
			HudMessage(s:"deadly laceration !"; HUDMSG_FADEINOUT, 203, CR_DARKRED,320.0, 450.0,1.0);			
			setfont("SCRATCH");
			HudMessage(s:"A"; HUDMSG_FADEINOUT, 202, CR_UNTRANSLATED, 100.0, 240.0,10.0);
			int x4 = GetActorX(0);
			int y4 = GetActorY(0);
			int z4 = GetActorZ(0)+10.0;
			Spawn("Brutal_LiquidBlood3",x4,y4,z4,0,0);				
			delay(35*1);
			}
		}
	delay(1);
	}
}

 

It's called by some monster attacks and its effects change based on player's currently equipped armor. Ok.

Now, I have some custom difficulty levels in my mod that alter the global DamageFactor. I do not want my script to be altered by that value. I want the wounds in the posted script to inflict fixed damage that ignores armor. So I added this in MAPINFO:

 

Spoiler

Damagetype Bleeding
{
Factor = 1.0
ReplaceFactor
Obituary = "%o bled to death"
NOARMOR
}

 

Thing is that not only I still take 10 damage instead of 3 when I play on skill levels with a damagefactor of 3.5, but when I die from bleeding, I see the message "Player killed himself" instead of the correct obituary. What could be happening?

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 1

I tried to find a way to send pointers are arguments, to no avail, but I think I have figured out to accomplish what you are trying to do, or hopefully close enough:

 

Have the projectile do PoisonDamage, with value, duration, and period, with the PoisonDamageType set to Bleeding.

With all those different levels of armor, you must have custom armor actors.  Give those armor actors different DamageFactors for Bleeding damage.

I think that will do everything in DECORATE with no ACS needed, except there will be no messages describing how much laceration there is, and the armor itself might be damaged.

Share this post


Link to post
  • 0

I would try adding DamageFactor "Bleeding", 1.0 to the player actor.  From what I read in the Wiki, that shouldn't be necessary, but I'd try it anyway.

 

With that script, the player is the activator, so he is damaging himself, so it is suicide if he dies, so you get the "%o killed himself" obituary.  It will require you to jump through a lot of hoops to get it to work, but what about having the monster call the script so it is the activator, and send the pointer to its target as an argument, which can then be the target of the Thing_Damage2?

Share this post


Link to post
  • 0
Quote

I would try adding DamageFactor "Bleeding", 1.0 to the player actor.  From what I read in the Wiki, that shouldn't be necessary, but I'd try it anyway.

This didn't work.

 

Quote

With that script, the player is the activator, so he is damaging himself, so it is suicide if he dies, so you get the "%o killed himself" obituary.  It will require you to jump through a lot of hoops to get it to work, but what about having the monster call the script so it is the activator, and send the pointer to its target as an argument, which can then be the target of the Thing_Damage2?

Actually the activator is a projectile, but yes, it gives the player an item that automatically calls the script, so the players becomes the activator at that point. How can I make the projectile directly call the script pointing at the player?

Edited by Grey_Wolf

Share this post


Link to post
  • 0

Hm, this method will also force me to discard the graphic wound overlay, the dripping blood effect and the fact that bleeding ingores armor. Maybe I'll just tweak the damage values of the different wound levels, so it's still relevant at lower skill levels, but not extremely punishing on higher skill levels. Thanks for your help anyway.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×