Simple taunt system? (just sounds, no sprites)

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!)
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Simple taunt system? (just sounds, no sprites)

Post by Graaicko »

I was wondering how to create a simple taunt system. I have some taunts I created.
User avatar
NeoTerraNova
Posts: 153
Joined: Tue Mar 14, 2017 5:18 pm
Location: Western North Southlandia (East Side)

Re: Simple taunt system? (just sounds, no sprites)

Post by NeoTerraNova »

WildWeasel made it as an alt-fire to Melee Attacks in his Diaz mods. It's a very cheap (and fun) way to alert monsters and draw them in.
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: Simple taunt system? (just sounds, no sprites)

Post by Graaicko »

Good idea, but I woud like to make it use a the KEYCONF system.
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

Re: Simple taunt system? (just sounds, no sprites)

Post by m8f »

HXRTC Project has such system.
1. ACS

Code: Select all

#library "taunting"
#include "zcommon.acs"

// SCRIPTS

Script "Taunting" (void)
{
        if (UseInventory("HXRTCPlayerTauntingAction"))
        {
                terminate;
        }
}
2. Decorate

Code: Select all

ACTOR HXRTCPlayerTauntingAction : CustomInventory
{
        Inventory.MaxAmount 0x7FFFFFFF
        -INVENTORY.INVBAR
        -COUNTITEM
        States
        {
        Use:
                TNT1 A 0 A_PlaySound("PlayerTaunting", 2)
                TNT1 A 0 A_AlertMonsters
                Fail
        }
}
(this actor is given to player at start: Player.StartItem "HXRTCPlayerTauntingAction", 0x7FFFFFFF)
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: Simple taunt system? (just sounds, no sprites)

Post by Graaicko »

never used acs, ill try it. how do I make it a hotkey in the KEYCONF?
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Simple taunt system? (just sounds, no sprites)

Post by Matt »

Here's a way to do it without inventory items, playerpawn replacements or potentially cheat-disabled ACS script puking.

Define the taunt action in a ZScript eventhandler:

Code: Select all

class TauntHandler:EventHandler{
        override void NetworkProcess(ConsoleEvent e){

        //check to ensure the acting player can taunt
        let ppp=playerpawn(players[e.player].mo);
        if(!ppp)return;

        if(
            e.name~=="taunt"
            &&ppp.health>0 //delete if you want corpses taunting the enemy
        ){
            ppp.A_PlaySound("*taunt",CHAN_VOICE);
            ppp.A_TakeInventory("powerfrightener");
            ppp.A_AlertMonsters();
        }
}
Define some sounds to use in SNDINFO:

Code: Select all

$playersound    player    male    *taunt        swivethyselfm
$playersound    player    female    *taunt        swivethyselff
Enable the ZScript event handler in MAPINFO:

Code: Select all

addeventhandlers="TauntHandler"
Set a key for it in KEYCONF (same principle works for the ACS+Decorate version, just replace the netevent with using the item):

Code: Select all

//this creates a command to activate the netevent
//though you could probably just call this directly too
alias taunt "netevent taunt";

//adds the taunt to the menu (optional)
addmenukey "Taunt" taunt
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: Simple taunt system? (just sounds, no sprites)

Post by Graaicko »

This is what I get when I put in the eventhandler in mapinfo.
Image
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Simple taunt system? (just sounds, no sprites)

Post by wildweasel »

Which version of GZDoom are you using, and can you show the Mapinfo lump?
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: Simple taunt system? (just sounds, no sprites)

Post by Graaicko »

I currently updated it to v3.3.2.

Code: Select all

gameinfo
{
   PlayerClasses = "Kennic"
}

   AddEventHandlers = "TauntHandler"
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Simple taunt system? (just sounds, no sprites)

Post by wildweasel »

That line belongs in the gameinfo block.
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: Simple taunt system? (just sounds, no sprites)

Post by Graaicko »

Now I get another error, Script error, "SE.pk3:acs/taunt.txt" line 1:
Expected '{', got 'TauntHandler:EventHandler"
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Simple taunt system? (just sounds, no sprites)

Post by Matt »

It's ZScript not ACS, so it should go into the zscript.txt (or a filed #included in it).
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: Simple taunt system? (just sounds, no sprites)

Post by Graaicko »

Its one error after another.

"1 errors while parsing SE.pk3:zscript.txt"

"Script error, "SE.pk3:zscript.txt" line 17:
Unexpected end of file
Expecting '.' or 'class' or identifier or 'native' or 'ui' or 'play' or 'version' or 'color' or 'clearscope' or 'int8' or 'uint8' or 'int16' or 'uint16' or 'int' or 'uint' or 'bool' or 'float' or 'double' or 'vector2' or 'vector3' or 'name' or 'sound' or 'state' or 'let' or '@' or 'readonly' or 'map' or 'array' or 'void' or 'action' or 'deprecated' or 'static' or 'private' or 'protected' or 'latent' or 'final' or 'meta' or 'transient' or 'virtual' or 'override' or 'vararg' or 'virtualscope"
User avatar
Graaicko
Posts: 531
Joined: Tue Jun 17, 2014 11:22 pm
Graphics Processor: nVidia (Legacy GZDoom)

Re: Simple taunt system? (just sounds, no sprites)

Post by Graaicko »

And this is the code I copied earlier that is causing the current issue:

Code: Select all

class TauntHandler:EventHandler
{
 override void NetworkProcess(ConsoleEvent e)
 {
  //check to ensure the acting player can taunt
        let ppp=playerpawn(players[e.player].mo);
        if(!ppp)return;

        if(
            e.name~=="taunt"
            &&ppp.health>0 //delete if you want corpses taunting the enemy
        ){
            ppp.A_PlaySound("*taunt",CHAN_VOICE);
            ppp.A_TakeInventory("powerfrightener");
            ppp.A_AlertMonsters();
        }
}
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Simple taunt system? (just sounds, no sprites)

Post by Matt »

Sorry, should've been this

[multiple deletes and reposts later] FOR FUCK'S SAKE here I'll attach the txt file the forum can't take multiple tabs for whatever stupid reason
Attachments
taunthandlerzscript.txt
(423 Bytes) Downloaded 138 times
Post Reply

Return to “Scripting”