ACS/Decorate problem

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

ACS/Decorate problem

Post by NeoTerraNova »

Greetings.

So, my issue started when I wanted to make a "Poison" or "Bleeding" type script where the Player would take constant damage after being hit by an enemy attack. This would be resolved by picking up and carrying, then using, specific Inventory items that would stop the incoming damage.

Thanks to DoomKrakken and Blue Shadow, I've resolved 2/3rds of my problem - I now have a Script that emulates Poison or Bleeding damage. Here it is below for anyone that would like to use it:

Code: Select all

Script "PoisonScript" (void) //Damage Script for venom/poison. Credit to DoomKrakken & Blue Shadow.
{
	SetActivatorToTarget(0);
	Thing_Damage2(AAPTR_DEFAULT,3,"venom"); //Inflict 3 Damage
	delay(35); //Do it about 1 time per second	
	restart;
}
I also added this Script separately to simply shut off the damage:

Code: Select all

Script "PoisonStop" (Void)
{
	ACS_NamedTerminate ("PoisonScript",0);
}
And an Inventory Item to call it:

Code: Select all

ACTOR Serum : CustomInventory
// Vial
{
	Scale 0.125
	Inventory.MaxAmount 4
	Inventory.InterHubAmount 4
	Inventory.Icon "I_SRUM"
	Inventory.UseSound "meds/medium"
	Inventory.PickupSound "item/health_carry"
	Inventory.PickupMessage "Serum"
	Tag "Serum"
	+INVENTORY.INVBAR
	States
	{
	Spawn:
		SRUM B -1
		Loop
	Use:
	TNT1 A 0 ACS_NamedExecute ("PoisonStop", 0)
	Stop
	}
}
Here are the images for them, if anyone would like to use them:
Image
Image

Additionally, this is the code I'm currently using to test this function. It's based on the Vulgar from Realm667.

Code: Select all

ACTOR VulgarShot
{
   Radius 8
   Height 16
   Speed 10
   Damage 4
   RENDERSTYLE ADD
   ALPHA 0.67
   PROJECTILE
   +THRUGHOST
   +HITTRACER //[DoomKrakken]: So that it sets whatever actor it hits as its "tracer" upon hitting it.
   Seesound "monster/vulsh1"
   DeathSound "monster/vulsh2"
   Decal "DoomImpScorch"
   States
   {
   Spawn:
      FVUL AAABBB 1 Bright A_SpawnItemEx("BarbTrail",0,0,0,0,0,0,0,128,0)
      loop
   Death:
	  TNT1 A 0 ACS_NamedExecute("PoisonScript",0, AAPTR_TRACER)
      FVUL CDEF 4 Bright
      stop
   }
}

Now, the problem I'm having:

While I can get the Poison to take effect on the player, it works TOO well - the Player is getting poisoned even if the VulgarShot hits a wall. Of course, I'd much rather the Player only get poisoned if they're hit with the enemy's attack. I'm guessing this is because the script is activating on the *target of the attack* in question in the DECORATE lump, and not *if* the attack hits the target.

Once again, I humbly beg, does anyone have a solution? I'm trying to get the Projectile in question to "inflict Poison" (read: start the ACS script that deals damage over time), but only if the Projectile actually hits the Player.

Again, all suggestions are immensely appreciated.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: ACS/Decorate problem

Post by Nevander »

Try calling NamedExecute on XDeath instead of Death and take it off Death.
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: ACS/Decorate problem

Post by NeoTerraNova »

That did the trick! THANK YOU! Updated code here:

Code: Select all

ACTOR VulgarShot
{
   Radius 8
   Height 16
   Speed 10
   Damage 4
   RENDERSTYLE ADD
   ALPHA 0.67
   PROJECTILE
   +THRUGHOST
   +HITTRACER //[DoomKrakken]: So that it sets whatever actor it hits as its "tracer" upon hitting it.
   Seesound "monster/vulsh1"
   DeathSound "monster/vulsh2"
   Decal "DoomImpScorch"
   States
   {
   Spawn:
      FVUL AAABBB 1 Bright A_SpawnItemEx("BarbTrail",0,0,0,0,0,0,0,128,0)
      loop
   Death:
      FVUL CDEF 4 Bright
      stop
   XDeath:
	  TNT1 A 0 ACS_NamedExecute("PoisonScript",0, AAPTR_TRACER) //Nevander: Execute on XDEATH and not DEATH so that it only applies when it hits the Player
      FVUL CDEF 4 Bright
      stop
   }
}
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: ACS/Decorate problem

Post by Nevander »

One thing though I think it might still run if the projectile hits another monster too and not only the player, but I'm not sure. I just know XDeath runs if the projectile hits a thing with health or whatever.
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: ACS/Decorate problem

Post by NeoTerraNova »

I appreciate the help! It seems to work - when I don't get hit by the projectile, I'm not getting poisoned. When I do get hit, I'm getting poisoned. If it turns out that it poisons another monster by "mistake" - well, that's Hell's problem, not mine (or, rather, the Player's).

I have one (two-part) final question, now that I've moved to the end of my process of setting this up - is it possible to somehow execute an ACS script when a Melee attack hits the Player or another Monster? Or, is there a way to fake this, somehow? And, can the whole ACS_NamedExecute function be simply appended to a Hitscan attack?

I ask, so that I can get certain high-end Melee attacks, and certain Hitscan attacks (i.e. Mastermind's cannon) to inflict "Bleeding" (which would behave like Poison, and have the same code, with different names), and certain monsters to inflict Poison without having to give them a Projectile attack.
Locked

Return to “Editing (Archive)”