Heya, I'm working on Duke Nukem mod using quotes from Duke Nukem Forever and weapons from Duke3D and Duke64.
How can i make it so that when i kill a monster, Duke has a chance to taunt (like 33%)? I tried with DECORATE, but using CustomInventory (killed monster calls A_GiveToTarget, which gives this CI-item) i got some problems such as monsters taunting in Duke voice when they killed each other.
Is this best done via ACS or ZScript? I'm still learning DECORATE and i know nothing about coding, ACS or ZScript.
Taunting when killing monsters
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Re: Taunting when killing monsters
I'd make this with DECORATE and ACS only, by:
* first, making the monsters "A_GiveToTarget" a CustomInventory to its target in its Death state/label, just like you've done; For the 33% chance, I'd just use "A_Jump (83, 2)".
* second, make my custom player calls an ACS script that constantly checks for this item, and playing the sound if so (and also taking the CustomInventory at the same time).
As the monsters would not call said script, it'd not happen when they kill each others.
* first, making the monsters "A_GiveToTarget" a CustomInventory to its target in its Death state/label, just like you've done; For the 33% chance, I'd just use "A_Jump (83, 2)".
* second, make my custom player calls an ACS script that constantly checks for this item, and playing the sound if so (and also taking the CustomInventory at the same time).
As the monsters would not call said script, it'd not happen when they kill each others.
- Hellser
- Global Moderator
- Posts: 2780
- Joined: Sun Jun 25, 2006 4:43 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Manjaro Linux
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: Citadel Station
Re: Taunting when killing monsters
Should also probably add some sort of cooldown so Duke doesn't keep insulting monsters if he slaughters 100 of them at once.
- TensorMatrix
- Posts: 41
- Joined: Wed Mar 29, 2017 7:05 am
Re: Taunting when killing monsters
In what state should i put "ACS_NamedExecuteAlways("DukeTaunt")" in the players decorate(currently it's in Spawn state)
I'm using "XDeath" as taunt sound for now.
This is the ACS code:
And this one is the CustomInventory:
And this is from the Zombiemans death state (jump is commented for now):
Are those OK? Duke does not taunt when killing zombiemen, only printing "taunt not ready".
I'm using "XDeath" as taunt sound for now.
This is the ACS code:
Code: Select all
#include "zcommon.acs"
script "DukeTaunt" (void)
{
if (CheckInventory("Taunting"))
{
PlaySound("Duke/XDeath", 2);
Print(s:"Taunting!");
TakeInventory("Taunting", 1);
}
else
{
Print(s:"taunt not ready!");
}
}
Code: Select all
ACTOR Taunting : CustomInventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
+INVENTORY.ALWAYSPICKUP
+INVENTORY.UNDROPPABLE
+INVENTORY.AUTOACTIVATE
}
Code: Select all
Death:
//TNT1 A 0 A_Jump(83,2)
TNT1 A 0 A_GiveToTarget("Taunting", 1)
POSS H 5
POSS I 5 A_Scream
POSS J 5 A_NoBlocking
POSS K 5
POSS L -1
Stop
- 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: Taunting when killing monsters
From the looks of that setup, I'd put the call not in the player's state but in the "Taunting"'s pickup state.
And you'd need a better counter than that. It should be an inventory item that's added each time the taunt happens, prevents a taunt from happening when it is present, and is taken away in increments either every tic or every time the player enters the see state or something. (Given what this is for there is no need for precision as long as the delay is long enough to make your cooldude not sound like an overcaffeinated, overthinking stammerer.)
So something more like (in ZScript rather than DECORATE+ACS):
EDIT:
And you'd need a better counter than that. It should be an inventory item that's added each time the taunt happens, prevents a taunt from happening when it is present, and is taken away in increments either every tic or every time the player enters the see state or something. (Given what this is for there is no need for precision as long as the delay is long enough to make your cooldude not sound like an overcaffeinated, overthinking stammerer.)
So something more like (in ZScript rather than DECORATE+ACS):
Code: Select all
//here's what the monster has to give the player
class Taunting:CustomInventory{
states{
spawn:
//the way we're doing this now we don't need anything that can be picked up
//(though that might be a neat idea, making the player taunt as they step over the corpse)
stop;
pickup:
TNT1 A 0{
if(self is "PlayerPawn" && !countinv("TauntingCounter")){ //only if the item count is zero or null
A_GiveInventory("TauntingCounter",35*2); //is DSBOSSIT 2 seconds? this can be randomized as well
A_PlaySound("*baron/sight"); //or whatever you want
}
}
fail; //we do *not* need to keep this in inventory
}
}
//here's the cooldown counter
class TauntingCounter:Inventory{
default{
+inventory.untossable
inventory.maxamount 35*5; //I don't think you need more than ten seconds...
}
override void DoEffect(){
if(amount>0)amount--; //I'm not actually sure this works, if not just use A_TakeInventory on the owner, per commented out line below:
//if(owner&&amount)owner.A_TakeInventory("TauntingCounter",1);
}
}
Updated the above to add a check to ensure the actor making the sound is a player pawn.i got some problems such as monsters taunting in Duke voice when they killed each other.
Last edited by Matt on Mon Jun 12, 2017 1:43 pm, edited 1 time in total.
Re: Taunting when killing monsters
You really don't even need ACS to do this, you can use inventory items to play the taunts:
I whipped this up rather quickly, but you should get the general idea. There's no need to use ACS to take the inventory item away since it's automatically being used on its own.
Code: Select all
Actor dukeTaunts : CustomInventory
{
// [JD] We really don't need to specify an inventory amount of 1 because it already defaults to 1.
Inventory.MaxAmount 1
+INVENTORY.ALWAYSPICKUP
+INVENTORY.AUTOACTIVATE
States
{
Pickup:
Use:
TNT1 A 0
TNT1 A 0 A_Jump(82, 1) // [JD] You only need to jump one frame ahead to skip over the 'Stop' keyword and play the sound.
Stop
TNT1 A 0 A_PlaySound("whateverSoundYouWant", CHAN_VOICE)
Stop
}
}
Actor myMonster : ZombieMan Replaces ZombieMan
{
// [JD] All we need to do in the Death states is give the inventory item to the player when the monster dies. After that, we can proceed with the rest of the death animation.
States
{
Death:
TNT1 A 0
TNT1 A 0 A_GiveToTarget("dukeTaunts")
Goto Super::Death
}
}
- TensorMatrix
- Posts: 41
- Joined: Wed Mar 29, 2017 7:05 am
Re: Taunting when killing monsters
I went with Vaecrius's method and it seems to be working perfectly. Thank you all for helping me with this.
Edit:
jdagenet, that's what i did at first, but monsters started taunting in Duke's voice
Edit:
jdagenet, that's what i did at first, but monsters started taunting in Duke's voice
