One-Liners / Taunt button?

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze 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.
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

One-Liners / Taunt button?

Post by Hidden Hands »

I have a set of 40 one-liners recorded and ready for my player character to use when taunting a monster. But the problem is, I don't know how to make a taunt command in the code? I need there to be a particular key that can be pressed and it will allow the game to randomly pick a one-liner from my list of 40 each time it is pressed. I have seen brutal doom (i think) use a taunt button so is there a way I can include it in mine?

Also, I wonder if it is possible to have a similar feature for when you dispatch a monster - ie; a monster pops up and says "i'll kill you" and when you kill it, your player comes back with a cocky one-liner randomly picked from a selection of responses. Is this possible? Thing of something along the lines of ASH from EVIL DEAD.

Please help, it is much appreciated. Thank you in advance.
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: One-Liners / Taunt button?

Post by Caligari87 »

For the taunt key:

1. [wiki]SNDINFO[/wiki] - Define your sounds with logical names

2. [wiki]KEYCONF[/wiki] - Create a [addmenukey] which will execute a script on a buttonpress.

3. [wiki]ACS[/wiki] - Set up the script which will be executed when you press the button.
--a. [wiki]Random[/wiki] - Pick a random number
--b. [wiki]A quick beginner's guide to ACS[/wiki] - See "flow control" For if/then statements to decide which sound based on the random number
--c. [wiki]PlaySound[/wiki] - The ACS command to play your defined sounds.

For the monster deaths, have the monsters call a similar script in their death state to play different sounds.

8-)
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

Thank you so much for the quick response ... do you have any examples I can look at?
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: One-Liners / Taunt button?

Post by Caligari87 »

Not really, I'm at work right now. Sorry.

8-)
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

Oh thank you anyway. I'm really having trouble getting this to work. I'm pretty certain I'm doing the whole coding set up wrong. If anyone can show me an example I would be so grateful.
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

Okay, I'm not having any luck. If anyone out there knows how to help me structure this they would be the bomb for helping me. I've spent about God-knows how many hours on this so far and still nothing. I have now over 70 one-liners all in the wad but no way to get them working. I know it has something to do with what Caligari87 posted but I really don't know where to start.

Please help if you can.

This is my code so far:

KEYCONF

Code: Select all

 [addmenukey] Y
ACS

Code: Select all

 script 1 (Playsound)
{
    Y (Random (1, 10));
}
SNDINFO

Code: Select all

$random Taunts/Ash { Taunts/Taunt01 Taunts/Taunt02 Taunts/Taunt03 Taunts/Taunt04 }
ash/taunt01 ASHT01
ash/taunt02 ASHT02
ash/taunt03 ASHT03
ash/taunt04 ASHT04
ash/taunt05 ASHT05
ash/taunt06 ASHT06
ash/taunt07 ASHT07
ash/taunt08 ASHT08
ash/taunt09 ASHT09
ash/taunt10 ASHT10
I know I'm doing this wrong.... badly. I need the Y button to play random one-liners. What am I doing wrong here?
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

Can anyone help me with this? I'm still having Hell getting this to work.
User avatar
ramon.dexter
Posts: 1520
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: One-Liners / Taunt button?

Post by ramon.dexter »

You should start at wiki, acs reference...

1. You have defined a key, but you have not defined what your key should do. How the engine should.know, that pressing a Y should trigger the script?
It should look like this:

Code: Select all

alias player_taunt "pukename taunt" //"player_taunt " is a menu reference, "pukename..." is console command referencing the script you want
defaultBind "K" "player_taunt " //defaultbind with the menu reference
addMenuKey "Taunt" player_taunt  //and this allows you to re-assign the key to your desire.
2. Script could have a OPEN, ENTEr, etc. (playsound) is nonsense. Looks like you really dont know how ro set up a script. So, open zdoom wiki, head over to "ACS reference" and read the basics.

Soo, you want a user called script. Something like this:

Code: Select all

script "taunt" (void) //you want the user to call the script, so "(void)" is a thing here.
{
	PlaySound(TID, "yoursound"); //the sound has to beplayed from something. For player taunts, I advise you use the player's TID. So unique TID for player is a good thing to have.
}
Only sndinfo looks it's set-up correctly.
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

ramon.dexter wrote:You should start at wiki, acs reference...

1. You have defined a key, but you have not defined what your key should do. How the engine should.know, that pressing a Y should trigger the script?
It should look like this:

Code: Select all

alias player_taunt "pukename taunt" //"player_taunt " is a menu reference, "pukename..." is console command referencing the script you want
defaultBind "K" "player_taunt " //defaultbind with the menu reference
addMenuKey "Taunt" player_taunt  //and this allows you to re-assign the key to your desire.
2. Script could have a OPEN, ENTEr, etc. (playsound) is nonsense. Looks like you really dont know how ro set up a script. So, open zdoom wiki, head over to "ACS reference" and read the basics.

Soo, you want a user called script. Something like this:

Code: Select all

script "taunt" (void) //you want the user to call the script, so "(void)" is a thing here.
{
	PlaySound(TID, "yoursound"); //the sound has to beplayed from something. For player taunts, I advise you use the player's TID. So unique TID for player is a good thing to have.
}
Only sndinfo looks it's set-up correctly.
Thank you so much for your response. Where about to I put these code examples? In the WAD, do they go in Language, KEYCONF, SNDINFO, etc...? or do I make a whole ACS entry with all of this inside it?
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

Okay I still can't get it working. Here is my complete code setup.

MAPINFO

Code: Select all

gameinfo
{
    playerclasses = "AxePlayer" 
}
LOADACS

Code: Select all

script "taunt" (void)
{
   PlaySound(TID, "AxePlayer"); 
}
KEYCONF

Code: Select all

 [addmenukey] Y
 
 addkeysection
 
   addmenukey "Taunt" oneliner
   alias oneliner "puke taunt"
   defaultbind "Y" "oneliner"
 
SNDINFO

Code: Select all

$random Taunt/Ash { Taunts/Taunt01 Taunts/Taunt02 Taunts/Taunt03 Taunts/Taunt04 Taunts/Taunt05 Taunts/Taunt06 Taunts/Taunt07 Taunts/Taunt08 Taunts/Taunt09 Taunts/Taunt10 }
ash/taunt01 ASHT01
ash/taunt02 ASHT02
ash/taunt03 ASHT03
ash/taunt04 ASHT04
ash/taunt05 ASHT05
ash/taunt06 ASHT06
ash/taunt07 ASHT07
ash/taunt08 ASHT08
ash/taunt09 ASHT09
ash/taunt10 ASHT10
What is wrong with this? I tried to follow it well but something just ain't having it. Help please.

Thanks in advance.
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: One-Liners / Taunt button?

Post by wildweasel »

LOADACS isn't where to put ACS code. You need to create an ACS script (name it anything you like, like TAUNTSCR or something), make sure it's defined as a library at the top:

Code: Select all

#library "TAUNTACS"
Remember what the library name is! Then compile it, and rename the output (it'll probably come up as a lump named BEHAVIOR, or TAUNTSCR.o in /scripts/ if it's a PK3 file) to match the #library name.

Then just add this to LOADACS:

Code: Select all

TAUNTSCR
That's it. Your code should now run.
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

wildweasel wrote:LOADACS isn't where to put ACS code. You need to create an ACS script (name it anything you like, like TAUNTSCR or something), make sure it's defined as a library at the top:

Code: Select all

#library "TAUNTACS"
Remember what the library name is! Then compile it, and rename the output (it'll probably come up as a lump named BEHAVIOR, or TAUNTSCR.o in /scripts/ if it's a PK3 file) to match the #library name.

Then just add this to LOADACS:

Code: Select all

TAUNTSCR
That's it. Your code should now run.
Thank you so much. But how do I compile this? I've done as you said, made a new entry and did the #library "TAUNTACS" but it just saved as a random text file. How do I compile it? When I click compile I'm getting an error. I've attached a screenshot of it.

Also, where do I add TAUNTSCR in the LOADACS? Just on its own or somewhere particular?
Attachments
acserror.png
acserror.png (9.71 KiB) Viewed 3800 times
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

edit: i just downloaded an acc compiler but now its doing nothing. I click on it, nothing happens. Screen flashes for a millisecond and nothing happens.
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: One-Liners / Taunt button?

Post by wildweasel »

You have to tell SLADE where ACC is, and then compile it from within there. TAUNTSCR is just the source code for your script; GZDoom does nothing with it on its own, and you technically don't even need to have it in your file, but it's usually a nice courtesy to leave it in there after you've compiled it.
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: One-Liners / Taunt button?

Post by Hidden Hands »

wildweasel wrote:You have to tell SLADE where ACC is, and then compile it from within there. TAUNTSCR is just the source code for your script; GZDoom does nothing with it on its own, and you technically don't even need to have it in your file, but it's usually a nice courtesy to leave it in there after you've compiled it.
But I downloaded the ACC program, told the SLADE where it is in the preferences... but now when I click on the "compile ACS" it just makes the screen give a very quick flicker white and nothing happens. Like it didn't do anything. No lump has been made to my knowledge. Its not in my wad, or any folders connected to it? Do you know why its doing this?

There is a file at the very bottom of my wad with the same name ie; TAUNTSCR but its called "unknown" and its not triggering my Y button to taunt in game. Am I missing something am I doing something wrong here? Where do I add the TAUNTACS into the LOADAcs file?

Thanks in advance.
Post Reply

Return to “Assets (and other stuff)”