Jump to content
  • 0

How to program contact-damage in DECORATE?


Lanie

Question

Dear Doomers,

 

i have a question. I made cactus within decorate. As you may now, touching a cactus may hurt. Do you have any idea, how i can pull this off? I know there are things like damage types etc. https://zdoom.org/wiki/Damage_types#Fire To me this seems rather complicated. Is there a single line i could add, in order to add some contact-damage?

 

Code:

 

actor CACUE0 25524
    {
    //$Category Obstacles
    Radius 25
    Height 128
    +SOLID
    States
    {
    Spawn:
    CACU E -1
    Stop    
    }

    

}

 

Thank you for considering my question,

Lanie.

 

 

ca.png

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 2

I offer this straightforward solution (without any explosions)

 

actor CACUE0 25524
{
    //$Category Obstacles
    Radius 25
    Height 128
    +SOLID
    +BUMPSPECIAL
    States
    {
    Spawn:
      CACU E 0
      CACU E 0 A_SetSpecial(73,6,0,0,0)
      CACU E -1
      Stop    
    }
}

Has its special set to DamageThing and activation type set to bump.

Does 6 damage to player when they touch it (change the number 6 in the A_SetSpecial second argument if you want different damage).

Share this post


Link to post
  • 0

The simplest way you could do it in DECORATE is by having the cactus repeatedly call A_Explode with a small radius. And also maybe with the XF_THRUSTLESS flag (Which I added myself) too, so that the radius damage doesn't push away actors near the cactus. A set of parameters like these should work:

A_Explode (2,Radius*2,XF_NOTMISSILE|XF_THRUSTLESS,False,Radius*2)

 

These parameters will do 2 damage every time the function is called, any actor in the cactus' radius time 2 (i.e 50 map units in this case) will be caught by the "contact"/blast damage, the XF_ flags make sure that the attack won't be credited to the cactus' target (Like projectile damage is), and that the blast won't push away victims. The false bool is so the explosion doesn't alert anything. And the second radius*2 parameter is to make sure that there is no damage falloff with distance from the cactus.

Share this post


Link to post
  • 0
40 minutes ago, inkoalawetrust said:

The simplest way you could do it in DECORATE is by having the cactus repeatedly call A_Explode with a small radius. And also maybe with the XF_THRUSTLESS flag (Which I added myself) too, so that the radius damage doesn't push away actors near the cactus. A set of parameters like these should work:

A_Explode (2,Radius*2,XF_NOTMISSILE|XF_THRUSTLESS,False,Radius*2)

 

These parameters will do 2 damage every time the function is called, any actor in the cactus' radius time 2 (i.e 50 map units in this case) will be caught by the "contact"/blast damage, the XF_ flags make sure that the attack won't be credited to the cactus' target (Like projectile damage is), and that the blast won't push away victims. The false bool is so the explosion doesn't alert anything. And the second radius*2 parameter is to make sure that there is no damage falloff with distance from the cactus.

 

Thank you for your very detailed answer! I will look into it!

Share this post


Link to post
  • 0
3 hours ago, inkoalawetrust said:

The simplest way you could do it in DECORATE is by having the cactus repeatedly call A_Explode with a small radius. And also maybe with the XF_THRUSTLESS flag (Which I added myself) too, so that the radius damage doesn't push away actors near the cactus. A set of parameters like these should work:

A_Explode (2,Radius*2,XF_NOTMISSILE|XF_THRUSTLESS,False,Radius*2)

 

These parameters will do 2 damage every time the function is called, any actor in the cactus' radius time 2 (i.e 50 map units in this case) will be caught by the "contact"/blast damage, the XF_ flags make sure that the attack won't be credited to the cactus' target (Like projectile damage is), and that the blast won't push away victims. The false bool is so the explosion doesn't alert anything. And the second radius*2 parameter is to make sure that there is no damage falloff with distance from the cactus.

 

 

  • I got a script error with this one: Unknown identifier 'XF_THRUSTLESS'. (GZDOOM V482) Any idea?
  • If i remove the command XF_THRUSTLESS, then it will run, but the cactus does not seem to hurt the player in anyway.

 

The script:

 

actor CACUE0 25524
    {
    //$Category Obstacles
    Radius 25
    Height 128
    +SOLID
    
    States
    {
    Spawn:
    CACU E -1 A_Explode (2,Radius*2,XF_NOTMISSILE|XF_THRUSTLESS,False,Radius*2)
    

    
    Stop    
   

Thank for your thougths,

Lanie.

 

Edited by Lanie

Share this post


Link to post
  • 0

What version of GZDoom are you using ? Like the wiki says, I added those XF_ flags like XF_THRUSTLESS in 4.11.0, if you are targeting an older version, you can also just not use the flag, but the explosion will push actors away. As for the player not being affected, you can also try changing the explosion radius from Radius*2 to something a bit higher. That's just because of how explosions work (The victims' origin must be in radius in particular). You could set the radius to something like Radius*3 instead, and that should be enough to keep human-sized monsters like Imps inside the damage radius.

Share this post


Link to post
  • 0
8 minutes ago, inkoalawetrust said:

What version of GZDoom are you using ? Like the wiki says, I added those XF_ flags like XF_THRUSTLESS in 4.11.0, if you are targeting an older version, you can also just not use the flag, but the explosion will push actors away. As for the player not being affected, you can also try changing the explosion radius from Radius*2 to something a bit higher. That's just because of how explosions work (The victims' origin must be in radius in particular). You could set the radius to something like Radius*3 instead, and that should be enough to keep human-sized monsters like Imps inside the damage radius.

 

I changed my GZDOOM to 4.11.0. Since then,  there is no error message. (I am a donkey. Thank you!) I changed the radius to 5 and then to 50, yet the player does not suffer any damage.

 

Maybe i am in need for a loop? Is this damage repetitive?

Edited by Lanie

Share this post


Link to post
  • 0
14 minutes ago, jaeden said:

I offer this straightforward solution (without any explosions)

 


actor CACUE0 25524
{
    //$Category Obstacles
    Radius 25
    Height 128
    +SOLID
    +BUMPSPECIAL
    States
    {
    Spawn:
      CACU E 0
      CACU E 0 A_SetSpecial(73,6,0,0,0)
      CACU E -1
      Stop    
    }
}

Has its special set to DamageThing and activation type set to bump.

Does 6 damage to player when they touch it (change the number 6 in the A_SetSpecial second argument if you want different damage).

 

That worked flawlessly! I also learned something new due both of you! Thank you very much.

Edited by Lanie

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...