Jump to content
  • 0

How do I make the player breathe heavily when low on health?


asd1994

Question

4 answers to this question

Recommended Posts

  • 1

So I spent a while trying to make it sound ok in DECORATE and just couldn't do it. So I erased that and tried a script and that seems to work better:

 

script "LowHPBreath" ENTER
{
    int HP = GetActorProperty(0, APROP_Health);
    if(HP < 16 && HP > 0)
    {
        PlaySound(0, "grunt/death", 7, 1.0, 1);
    }

    else
    {
        StopSound(0, 7);
    }
    Delay(35);
    Restart;
}

 

It's just for the map, but could be copied to others or used with LOADACS.

 

Edited by Rifleman

Share this post


Link to post
  • 0

Someone probably has a better solution, but I tried this and it seemed to work ok, so maybe it'll help :)

 

See:
    TNT1 A 0 A_JumpIfHealthLower(16, 2)
    TNT1 A 0 A_Jump(256, 2)
    TNT1 A 0 A_StartSound("grunt/death")
    PLAY ABCDABCDABCD 4 
    Loop

 

I just modified the player actor in DECORATE - changed the See state. First it checks if you have less than 16 HP and if so it jumps to the sound and if not, then jumps over it. I tripled the frames in the end to avoid the sound being played to fast in a loop.

This way, whenever you have less than 16 HP and are moving, the sound plays. For the sound to play while idle, the Spawn state could be modified like this. The sound wouldn't play while firing.

Share this post


Link to post
  • 0
13 hours ago, Rifleman said:

Someone probably has a better solution, but I tried this and it seemed to work ok, so maybe it'll help :)

 

See:
    TNT1 A 0 A_JumpIfHealthLower(16, 2)
    TNT1 A 0 A_Jump(256, 2)
    TNT1 A 0 A_StartSound("grunt/death")
    PLAY ABCDABCDABCD 4 
    Loop

 

I just modified the player actor in DECORATE - changed the See state. First it checks if you have less than 16 HP and if so it jumps to the sound and if not, then jumps over it. I tripled the frames in the end to avoid the sound being played to fast in a loop.

This way, whenever you have less than 16 HP and are moving, the sound plays. For the sound to play while idle, the Spawn state could be modified like this. The sound wouldn't play while firing.

This kinda works, but the sound restarts whenever I start to move so it sounds strange. Same thing happens when I try to apply this to the Spawn state as well, just the other way around (sound restarts when I stop moving). Is there a way to get it to not do that constantly? 

Edited by LightwaveAlice

Share this post


Link to post
  • 0
On 9/10/2021 at 3:40 AM, Rifleman said:

So I spent a while trying to make it sound ok in DECORATE and just couldn't do it. So I erased that and tried a script and that seems to work better:

 

script "LowHPBreath" ENTER
{
    int HP = GetActorProperty(0, APROP_Health);
    if(HP < 16 && HP > 0)
    {
        PlaySound(0, "grunt/death", 7, 1.0, 1);
    }

    else
    {
        StopSound(0, 7);
    }
    Delay(35);
    Restart;
}

 

It's just for the map, but could be copied to others or used with LOADACS.

 

This works great, thank you so much! :D

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...