The "How do I..." Thread

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.
FakeArchvile
Posts: 5
Joined: Tue Jun 20, 2017 9:15 am

Re: The "How do I..." Thread

Post by FakeArchvile »

FakeArchvile wrote:
Vaecrius wrote:Does ACS's "Spawn" function abort if there's no room? That looks like it's spawning the zombie at the same spot as the caller.
I want it to spawn the zombie near the caller.

EDIT: Could it be the decorate file?

Code: Select all

CVIL LKJI 3
CVIL I 0 ACS_Execute(2,0,0,0,0)  //<--- I'm thinking this line is giving me trouble.
CVIL H 3
CVIL G 8
Goto See
Nevermind, it was the ASC. There's a function called SpawnSpotForced. It works now.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

Actually, you should be using [wiki]SpawnForced[/wiki], not [wiki]SpawnSpotForced[/wiki]... unless you want the monster to spawn at a certain map spot.
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: The "How do I..." Thread

Post by NeoTerraNova »

I don't want to go into a lot of detail and spoil things, but I'm trying to implement a "Player has been poisoned" (or bleeding!) ACS script that's triggered by an enemy's attack. I do NOT want to use the built-in "Poison" mechanics, as they don't provide the effect I'm going for - that is, a "poisoned state" which continually drains health and lasts until "cured" by using an inventory item that can be picked up and carried, instead of "half damage now, the rest comes later."

I don't come and ask for help lightly - I've read over the forums and the Wiki for several days now, and I must be missing a concept here, or something.

I can get an ACS script to work that inflicts X amount of damage every Y number of tics (currently set to 3DMG every 35TICS/1 second, for testing), activating upon the Player starting a new game.
I cannot, for the life of me, get it to be activated by an enemy's projectile attack.

So far, I've tried:
-Force the enemy projectile to give the Player a hidden inventory item, combined with an ACS script that continually runs in the background, checking to see of the Player has this item, and if they do, to inflict damage (combined with the "cure" item simply removing all of these fake counters). This failed. I cannot seem to force an item into the Player's inventory when they're hit with a projectile.
-Force the enemy projectile to activate the ACS script directly, when it hits the character ("CRASH" state, not "DEATH" or "XDEATH" states). Conversely, using the "cure" item would simply stop the script (and possibly check to see if the script is running, to prevent the item from being used when it isn't needed). I have no idea why this didn't work - is it possible to have an enemy projectile activate an ACS script when it hits the player?

I don't have a preference for how to get this to work, so long as I can reproduce it at least once (one time for "poison" and another for "bleeding" with different curative items for each), and can then get both a melee attack and a projectile (not hitscan) attack to activate these effects.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

I wonder if [wiki]PowerRegeneration[/wiki] could be utilized to achieve what you want, with a negative value under its Powerup.Strength property... much like [wiki]PowerStrength[/wiki] with a float value less than 1 under its DamageFactor property (for weaker damage) or [wiki]PowerProtection[/wiki] with a float value greater than 1 under its DamageFactor property (for weaker resistance)...
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: The "How do I..." Thread

Post by NeoTerraNova »

Thank you for the idea! I just tried it out, though, and it didn't seem to work. Here's the code I used:

Code: Select all

ACTOR VulgarShot
{
   Radius 8
   Height 16
   Speed 10
   Damage 4
   RENDERSTYLE ADD
   ALPHA 0.67
   PROJECTILE
   +THRUGHOST
   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
   Crash:
	  TNT1 A 0 A_GiveInventory ("Venom", 1)
      FVUL CDEF 4 Bright
      stop
   }
}

actor Venom : PowerupGiver
{
	inventory.pickupmessage "You've been poisoned!"
	powerup.color blue 0.25
	inventory.maxamount 1
	powerup.type "Envenom"
	powerup.duration 350
	+AUTOACTIVATE
}

actor PowerEnvenom : PowerRegeneration
{
	Powerup.Duration -350
	Powerup.Strength -3
}
I'm using the "Vulgar" from Realm667 to test this out, yes. I did try both summoning the Vulgar and letting it hit me, and I tried manually giving myself both the "Venom" item, and the "PowerEnvenom" item. While the "Venom" item did change the screen blue, and wear out in the designated amount of time, it did nothing to my Health. The "PowerEnvenom" item did nothing when given directly to the Player.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

According to your code, you're having the VulgarShot give itself the powerup. I advise that you add the HITTRACER flag (as the VulgarShot doesn't use its tracer field for anything, since it's not a seeker missile) so that it sets whatever it hits as its tracer. Then, in its death state, use [wiki]A_GiveInventory[/wiki] to give the tracer the Venom item by also specifying AAPTR_TRACER in its pointer field.

For the powerup giver, I advise that you also add the ALWAYSPICKUP flag, to make sure that the item is always picked up.

Here's how I'd structure your code:

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
   Crash:
     TNT1 A 0 A_GiveInventory ("Venom", 1, AAPTR_TRACER) //[DoomKrakken]: Gotta make sure we're giving the tracer the item, and not the projectile itself...
      FVUL CDEF 4 Bright
      stop
   }
}

actor Venom : PowerupGiver
{
   inventory.pickupmessage "You've been poisoned!"
   powerup.color blue 0.25
   inventory.maxamount 1
   powerup.type "Envenom"
   powerup.duration 350
   +ALWAYSPICKUP //[DoomKrakken]: So that we can make sure that the item is ALWAYS picked up.
   +AUTOACTIVATE
}

actor PowerEnvenom : PowerRegeneration
{
   Powerup.Duration -350
   Powerup.Strength -3
}
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: The "How do I..." Thread

Post by NeoTerraNova »

I plugged it in, and it didn't work. The Vulgar didn't inflict Poison on the Player. Force-giving "Venom" and "PowerEnvenom" don't inflict any damage. I do like this line of thought, though, as it would allow me to keep the Player in a "poisoned" state for a set amount of time, rather than for a set amount of Health damage.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

Well, we were able to find a few other issues... maybe have your script execute with the modified code, but not with the negative regen powerup?
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: The "How do I..." Thread

Post by NeoTerraNova »

Is it possible to force a script to execute when an enemy attack hits the Player, simply through ACS_Execute being tagged to the Projectile's Crash state? As in, appending it to TNT1A0, or to the actual animation frames? That was one of the things I was never able to actually confirm - if ACS can be run on projectile collision with the Player, and if so, what the correct syntax is.

I do appreciate the help!
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

First off... I suggest you name the script, and execute it with [wiki]ACS_NamedExecute[/wiki]. Numbered scripts are commonly found in maps, and named scripts are commonly found in gameplay mods. Trust me, you really don't want scripts to conflict.

Next... wherever you wish to have the script execute, you'd put the action there. It'd look something like this:

Code: Select all

 TNT1 A 0 ACS_NamedExecute("MyScript",0) 
If you want it to be the very first thing done when the projectile hits something, then make sure that it's the first state within the Death state sequence. Have the script then use [wiki]SetActivator[/wiki] with the projectile's tracer as the pointer for SetActivator (since the projectile would have the HITTRACER flag), and then do whatever you want with the script (with the knowledge that the script from that point onward will affect the projectile's tracer).

One more thing... the projectile should have a Death state sequence. If the other state sequences (Crash/XDeath) are defined, then it'll enter those sequences upon hitting the correct actor. The Crash state sequence defines what will happen when it hits a non-bleeding actor, and the XDeath state sequence specifies what will happen when it hits a bleeding actor. The Death state sequence will cover all other cases. If you just want it to the same thing regardless of what kind of actor it hits, you should only define a Death state sequence.
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: The "How do I..." Thread

Post by NeoTerraNova »

I appreciate all the help. It's mostly worked so far. There's still an issue, though.

Code: Select all

Script "PoisonScript" (void) //Damage Script for venom/poison. Credit to DoomKrakken.
{
	SetActivator (AAPTR_TARGET); //Works
	GiveInventory ("Recovery", 1); //Works. Gives me a Recovery medicine item once per 35 tics.
	Thing_Damage2(0, 3, "venom"); //Not working. I'm not taking damage.
	delay(35); //Do it about 1 time per second	
	restart;
}
The Vulgar is now activating the Poison/Vemon Script when its VulgarShot hits a Player, but the Script isn't inflicting any damage. Now, what's odd, is that when I had this the way it was before (no SetActivator or GiveInventory, and (void) changed to ENTER), it would inflict the set damage automatically upon entering a new game.
User avatar
Expect No Mercy
Posts: 45
Joined: Sun Mar 18, 2012 1:43 am

Re: The "How do I..." Thread

Post by Expect No Mercy »

I need a simple decorate or zscript way to check if the ceiling is a sky or not.
User avatar
DoomKrakken
Posts: 3489
Joined: Sun Oct 19, 2014 6:45 pm
Location: Plahnit Urff
Contact:

Re: The "How do I..." Thread

Post by DoomKrakken »

@NeoTerraNova, How about using [wiki]DamageActor[/wiki], instead of Thing_Damage2?

@Expect No Mercy, Projectiles will enter their Death state sequence if they hit a ceiling, as well as a wall or floor. They can also enter into the Death state sequence if it hits a bleeding actor and has an XDeath state sequence defined, or a non-bleeding actor and has a Crash state sequence defined. I think from there, using the SKYEXPLODE flag, ZScript will be required. I can't really go further from there...
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: The "How do I..." Thread

Post by NeoTerraNova »

Again, I appreciate the help.

I get the error "Function damageactor is used but not defined." when I try to compile the ACS.

Never mind on that. I didn't have my files updated. My bad!

Anyhow, I tested it, and the damage is still not being applied.

This is the code I used:

Code: Select all

 Script "PoisonScript" (void) //Damage Script for venom/poison. Credit to DoomKrakken.
{
	SetActivator (AAPTR_TARGET);
	GiveInventory ("Recovery", 1); //Works.
	DamageActor (0,AAPTR_TARGET,0,AAPTR_NULL,3,"venom"); //Inflict 3 Damage
	delay(35); //Do it about 1 time per second	
	restart;
}
User avatar
Rip and Tear
Posts: 187
Joined: Tue May 02, 2017 3:54 pm

Re: The "How do I..." Thread

Post by Rip and Tear »

Is there any sort of pointer from a teleport fog to the actor that teleported?
Locked

Return to “Editing (Archive)”