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;
}
Code: Select all
Script "PoisonStop" (Void)
{
ACS_NamedTerminate ("PoisonScript",0);
}
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
}
}
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.