Cure poison
					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!)
	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!)
Cure poison
I have a weapon that inflicts poison damage, meaning that any monster that gets hit by it takes some damage every second until it is dead. When I defeat a monster with it and it becomes resurrected by an Archvile, the monster is still poisoned. How do I cancel the poison status upon death using Zscript?
			
			
									
						
										
						- Rip and Tear
 - Posts: 187
 - Joined: Tue May 02, 2017 3:54 pm
 
Re: Cure poison
Can you go in to more detail as to how you are poisoning your monsters?Sebelino wrote:I have a weapon that inflicts poison damage, meaning that any monster that gets hit by it takes some damage every second until it is dead. When I defeat a monster with it and it becomes resurrected by an Archvile, the monster is still poisoned. How do I cancel the poison status upon death using Zscript?
Re: Cure poison
Here is the weapon (Decorate):
And the puff (Decorate):
And a sample monster (Zscript):
			
			
									
						
										
						Code: Select all
actor PoisonIperitta : Pistol replaces Pistol {
  States {
  Fire:
    PISG A 4
    PISG B 0 A_FireBullets (5.6, 0, 1, 5, "PoisonPuff")
    PISG B 0 A_PlaySound("weapons/pistol", CHAN_WEAPON)
    PISG B 6 A_GunFlash
    PISG C 4
    PISG B 5 A_ReFire
    Goto Ready
  }
}Code: Select all
actor PoisonPuff : BulletPuff {
  DamageType Gun
  PoisonDamage 10, 100, 0
}Code: Select all
class Poltergeist : Actor replaces Zombieman {
  const m_scale = 0.12;
  double m_scale_modifier;
  
  void increase_height() {
  	  m_scale_modifier += 0.1;
      A_SetScale(m_scale, m_scale_modifier * m_scale);
  }
  
  void set_height_modifier(double hight) {
      A_SetScale(m_scale, hight * m_scale);
	  m_scale_modifier = hight;
  }
  
  Default {
  Health 30;
  Radius 20;
  Height 56;
  Speed 5;
  Scale m_scale;
  Species "Chaos";
  PainChance 200;
  PainChance "Fire", 255;
  PainChance "Ice", 255;
  PainChance "Electric", 255;
  DamageFactor "Fire", 1.5;
  DamageFactor "Ice", 1.5;
  DamageFactor "Electric", 1.5;
  Monster;
  +NOINFIGHTSPECIES
  +FLOORCLIP
  SeeSound "grunt/sight";
  AttackSound "grunt/attack";
  PainSound "grunt/pain";
  DeathSound "grunt/death";
  ActiveSound "grunt/active";
  obituary "%o fell to Poltergeist's Feral Claw.";
  DropItem "Magnetite";
  }
  States {
  Spawn:
    POLT AA 10 A_Look;
    Loop;
  See:
    NULL A 0 A_SetTranslation("None");
    POLT AAAAAAAAAAAAA 2 A_Chase;
    Loop;
  Missile:
    POLT A 10 A_FaceTarget;
    POLT A 8 A_PosAttack;
    POLT A 8;
    Goto See;
  Pain:
    NULL A 0 A_SetTranslation("Susceptible");
    POLT A 20 A_Pain;
    Goto See;
  Pain.Fire:
    NULL A 0 A_SetTranslation("Weak");
    POLT A 30;
	NULL A 0 A_SetTranslation("none");
    goto See;
  Pain.Ice:
    NULL A 0 A_SetTranslation("Weak");
    POLT A 30;
	NULL A 0 A_SetTranslation("none");
    goto See;
  Pain.Electric:
    NULL A 0 A_SetTranslation("Weak");
    POLT A 30;
	NULL A 0 A_SetTranslation("none");
    goto See;
  Pain.Poison:
    NULL A 0 A_SetTranslation("Poisoned");
    POLT A 4 A_Pain;
    NULL A 0 A_SetTranslation("none");
    goto See;
  Death:
    NULL A 0 A_Scream;
	NULL A 0 A_NoBlocking;
	NULL A 0 A_SetTranslation("Dead");
	POLT AAAAAAAAAA 2 A_FadeOut(0.1);
	POLT A 0 A_FadeTo(1.0, 1.0);
    POLT A -1 set_height_modifier(0.2);
    Stop;
  Raise:
	NULL A 0 A_SetTranslation("None");
	POLT AAAAAAAAA 5 increase_height();
    Goto See;
  Ice:
    NULL A 0 A_SetTranslation("None");
    POLT A 1 A_PlaySound("misc/freeze");
    POLT A 20 A_SetTranslation("Ice");
    POLT A 5 A_IceGuyDie;
  }
}
- Rip and Tear
 - Posts: 187
 - Joined: Tue May 02, 2017 3:54 pm
 
Re: Cure poison
You should be able to clear any remaining poison by setting PoisonDurationReceived equal to zero when your monster dies.
			
			
									
						
										
						Re: Cure poison
That did the trick. Thanks!
			
			
									
						
										
						Code: Select all
  Death:
    NULL A 0 A_Scream;
    NULL A 0 A_NoBlocking;
    NULL A 0 A_SetTranslation("Dead");
    POLT AAAAAAAAAA 2 A_FadeOut(0.1);
    POLT A 0 A_FadeTo(1.0, 1.0);
    POLT A 0 {
      PoisonDurationReceived = 0;
    }
    POLT A -1 set_height_modifier(0.2);
    Stop;