Erase HudMessage when player dies in multiplayer

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.

Erase HudMessage when player dies in multiplayer

Postby hima3009 » Wed Oct 13, 2021 4:58 am

So i've created a ace script that show the name of the item once activated , in single player mode i didn't notice any issue since the map restarts rather than the player respawns.
but in my server the HudMessages still presist after the death of players ,even though the item effect is no longer exist. So if anyone knows a solution it would be much appreciated .

Code: Select allExpand view
Script 1 (void)
{
    SetFont ("CONFONT");
   HudMessage(s:"DOOMSPHERE"; HUDMSG_PLAIN, 1, CR_DARKRED, 0.5, 0.15, 0);
}

Script 2 (void)
{
    SetFont ("CONFONT");
   HudMessage(s:"GUARDSPHERE"; HUDMSG_PLAIN,-1,CR_GRAY, 0.5, 0.2, 0);


}

Script 3 (void)
{
    SetFont ("CONFONT");
   HudMessage(s:"AMMOSUPPLY"; HUDMSG_PLAIN,-2,CR_BROWN, 0.5, 0.25, 0);


}
hima3009
 
Joined: 06 Oct 2021

Re: Erase HudMessage when player dies in multiplayer

Postby Jarewill » Wed Oct 13, 2021 7:49 am

You can use DEATH or RESPAWN script types to make them automatically execute on player's death/respawn.
Then in those scripts you can remove all HudMessages by calling the function again with nothing in the text field.
For example:
Code: Select allExpand view
Script "ResetHudMessage" RESPAWN
{
   HudMessage(s:""; HUDMSG_PLAIN, 1, CR_DARKRED, 0.5, 0.15, 0);
   HudMessage(s:""; HUDMSG_PLAIN,-1,CR_GRAY, 0.5, 0.2, 0);
   HudMessage(s:""; HUDMSG_PLAIN,-2,CR_BROWN, 0.5, 0.25, 0);
}
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Erase HudMessage when player dies in multiplayer

Postby hima3009 » Thu Oct 14, 2021 2:23 pm

Hey sorry for the late response...
RESPAWN script fixed my issue, i used DEATH script first but for some reason it did not excute after player's death.
thank you for the help.
hima3009
 
Joined: 06 Oct 2021


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests