Causing pain state to master

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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!)
andreboomer
Posts: 21
Joined: Wed Feb 16, 2022 9:04 pm
Graphics Processor: nVidia with Vulkan support

Causing pain state to master

Post by andreboomer »

To my knowledge there isn't a decorate function that allows you to cause a master to go into a pain state. With zscript and pointers it may be possible. How could I go about doing this?
JaedenDuhreis
Posts: 8
Joined: Sun Jan 02, 2022 7:19 am

Re: Causing pain state to master

Post by JaedenDuhreis »

You can make ZScript function like this:

Code: Select all

void A_PainMaster()
{
  if (master && master.health > 0)  // check that master exists and is not dead
  {
    master.SetStateLabel("Pain");
  }
}
then just use the A_PainMaster function in the actor's states wherever you want.
andreboomer
Posts: 21
Joined: Wed Feb 16, 2022 9:04 pm
Graphics Processor: nVidia with Vulkan support

Re: Causing pain state to master

Post by andreboomer »

Gonna try it out, thanks.

Return to “Scripting”