Page 1 of 2

Simple taunt system? (just sounds, no sprites)

Posted: Sun May 06, 2018 5:24 pm
by Graaicko
I was wondering how to create a simple taunt system. I have some taunts I created.

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

Posted: Sun May 06, 2018 6:05 pm
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.

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

Posted: Mon May 07, 2018 4:02 am
by Graaicko
Good idea, but I woud like to make it use a the KEYCONF system.

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

Posted: Mon May 07, 2018 4:20 am
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)

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

Posted: Mon May 07, 2018 3:13 pm
by Graaicko
never used acs, ill try it. how do I make it a hotkey in the KEYCONF?

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

Posted: Mon May 07, 2018 4:13 pm
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

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

Posted: Mon May 07, 2018 5:15 pm
by Graaicko
This is what I get when I put in the eventhandler in mapinfo.
Image

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

Posted: Mon May 07, 2018 6:13 pm
by wildweasel
Which version of GZDoom are you using, and can you show the Mapinfo lump?

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

Posted: Mon May 07, 2018 6:31 pm
by Graaicko
I currently updated it to v3.3.2.

Code: Select all

gameinfo
{
   PlayerClasses = "Kennic"
}

   AddEventHandlers = "TauntHandler"

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

Posted: Mon May 07, 2018 6:34 pm
by wildweasel
That line belongs in the gameinfo block.

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

Posted: Mon May 07, 2018 7:02 pm
by Graaicko
Now I get another error, Script error, "SE.pk3:acs/taunt.txt" line 1:
Expected '{', got 'TauntHandler:EventHandler"

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

Posted: Mon May 07, 2018 7:19 pm
by Matt
It's ZScript not ACS, so it should go into the zscript.txt (or a filed #included in it).

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

Posted: Mon May 07, 2018 7:36 pm
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"

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

Posted: Mon May 07, 2018 7:40 pm
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();
        }
}

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

Posted: Mon May 07, 2018 11:31 pm
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