[solved]How to prevent projectle from shattering Ice Corpse?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Lagi
Posts: 679
Joined: Sat Jun 23, 2018 12:51 pm
Location: Thou shalt alter thy beliefs with new evidence

[solved]How to prevent projectle from shattering Ice Corpse?

Post by Lagi »

how do i set some projectiles to not affect ice corpse? I cannot use damage type ice, because Im using different custom damage type.


when I freeze monsters they corpse are resistant to ice projectiles - thats fine.
problem is I have a "block/stun" projectile, that should not shatter ice corpse, as well.
Spoiler:
Last edited by Lagi on Sat Nov 21, 2020 11:52 am, edited 1 time in total.
Kzer-Za
Posts: 521
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: How to prevent projectile from shattering Ice Corpse?

Post by Kzer-Za »

Maybe there is a simpler way, then someone will correct me, but I think that you could try overriding SpecialMissileHit in the stunner projectile class.

Something like this (untested):

Code: Select all

	override int SpecialMissileHit (Actor victim)
	{
		if (victim)
		{
			if (victim.InStateSequence(victim.CurState, victim.ResolveState("Ice")))
			{
				return 0;
			}
		}
		return -1;
	}
User avatar
Lagi
Posts: 679
Joined: Sat Jun 23, 2018 12:51 pm
Location: Thou shalt alter thy beliefs with new evidence

Re: How to prevent projectile from shattering Ice Corpse?

Post by Lagi »

thanks,

ehmm... it suppose to look like that?

Code: Select all

class blockstun : actor
{
		default
		{
		+NOBLOCKMAP;
		+NOGRAVITY ;
		+BLOODLESSIMPACT;
		+CAUSEPAIN;
		+DONTSPLASH;
		damagetype "stun";
		}

override int SpecialMissileHit (Actor victim)
   {
      if (victim)
      {
         if (victim.InStateSequence(victim.CurState, victim.ResolveState("Ice")))
         {
            return 0;
         }
      }
      return -1;
   }

}
above dont work any different, than decorate :D
Spoiler:
I make some research:
https://github.com/coelckers/gzdoom/blo ... red/ice.zs

the resistance of frozen corpse to ice damage, is coming from: A_FreezeDeath which give +IceCorpse flag

interaction with ice damage and icecorpse flag is here:
https://github.com/coelckers/gzdoom/blo ... action.cpp

Code: Select all

	if (target->health <= 0)
	{
		if (inflictor && mod == NAME_Ice && !(inflictor->flags7 & MF7_ICESHATTER))
		{
			return -1;
		}
		else if (target->flags & MF_ICECORPSE) // frozen
		{
			target->tics = 1;
			target->flags6 |= MF6_SHATTERING;
			target->Vel.Zero();
		}
		return -1;
	}
return -1, mean the damage is cancelled. Too bad if damage is 0 or lower, it will still shatter the ice.
if (damage < 0) damage = 0;
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: How to prevent projectile from shattering Ice Corpse?

Post by Graf Zahl »

Kzer-Za wrote:Maybe there is a simpler way, then someone will correct me, but I think that you could try overriding SpecialMissileHit in the stunner projectile class.

Something like this (untested):

Code: Select all

	override int SpecialMissileHit (Actor victim)
	{
		if (victim)
		{
			if (victim.InStateSequence(victim.CurState, victim.ResolveState("Ice")))
			{
				return 0;
			}
		}
		return -1;
	}
That won't work. It completely misses the generic ice death case. The proper bit to check is bIceCorpse.
Kzer-Za
Posts: 521
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: How to prevent projectile from shattering Ice Corpse?

Post by Kzer-Za »

Then how about

Code: Select all

	override int SpecialMissileHit (Actor victim)
	{
		if (victim)
		{
			if (victim.bIceCorpse == true)
			{
				SetStateLabel("Death");
				return 1;
			}
		}
		return -1;
	}
User avatar
Lagi
Posts: 679
Joined: Sat Jun 23, 2018 12:51 pm
Location: Thou shalt alter thy beliefs with new evidence

Re: How to prevent projectile from shattering Ice Corpse?

Post by Lagi »

sorry, im using hitscan and puff. This probably mess with SpecialMIssileHit

TNT1 A 0 A_FireBullets(-50,0,-1,0, "blockstun", FBF_NORANDOM | FBF_EXPLICITANGLE, 140)

I would rewrite the code with A_FireProjectile
Kzer-Za
Posts: 521
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: How to prevent projectile from shattering Ice Corpse?

Post by Kzer-Za »

If it's hitscan, then I'm not sure what to do. We probably will have to wait until someone with a greater knolewdge of GZDoom than mine stops by.
User avatar
Lagi
Posts: 679
Joined: Sat Jun 23, 2018 12:51 pm
Location: Thou shalt alter thy beliefs with new evidence

Re: How to prevent projectile from shattering Ice Corpse?

Post by Lagi »

this work!

problem is: projectile has no limit to the range. So i can block attacks from other edge of map.

messy 1st part of code:

Code: Select all

class blockstun2 : actor
{
		default
		{
		+NOBLOCKMAP;
		+NOGRAVITY ;
		+BLOODLESSIMPACT;
		+CAUSEPAIN;
		+DONTSPLASH;
		damagetype "stun";
		
		Radius 10;
		  Height 20;
		  Speed 30 ;
		  Damage 0;
		  Projectile;
		  +THRUGHOST;
		  }
			  States
			  {
			  Spawn:
				DHFX A 2 Bright;
				DHFX B 2 Bright ;
				DHFX CDEFGH 2 Bright;
				Loop;
				
			  Death:
				
				FHFX STUVW 4;
				Stop;
			  }



   override int SpecialMissileHit (Actor victim)
   {
      if (victim)
      {
         if (victim.bIceCorpse == true)
         {
            return 0;
         }
      }
      return -1;
   }

}
Post Reply

Return to “Scripting”