Random one liners

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!)
Post Reply
Visceral_Nightmare
Posts: 21
Joined: Sat Feb 08, 2020 8:49 am

Random one liners

Post by Visceral_Nightmare »

Is there a way to get the player to say one liners randomly like a 1 in 50 chance? If someone would pointe in the right direction that'd be awesome!
User avatar
Dan_The_Noob
Posts: 880
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Random one liners

Post by Dan_The_Noob »

do you mean when they kill something?
you could probably just make a custom inventory or something that has a 2% chance to give to you when things die?
or a zscript variable.
Visceral_Nightmare
Posts: 21
Joined: Sat Feb 08, 2020 8:49 am

Re: Random one liners

Post by Visceral_Nightmare »

Yes on kill that's what I meant. Awesome I'll see what I can. Come up with. Is there any mod that already does this that I could take a look at?

Edit: looking at samsara and going to use what I learn there, if I even actually want to do it.
User avatar
RailedRobin
Posts: 37
Joined: Thu Aug 01, 2019 5:00 pm

Re: Random one liners

Post by RailedRobin »

Sorry about posting in an old thread, but I found this when searching for a way to do one liners myself, but couldn't find any answer. Figured I post that I eventually found the Shadow Warrior mod ( viewtopic.php?f=19&t=46168 ) where they had a good way of doing it. If anyone else wants to do one liners, check the player decorate in Shadow Warrior.


My version of the code (which is pretty much copy/pasted, but with different Actor handles.
Spoiler:
You have to add "A_GiveToTarget" to the monsters, though. I added this to the death of a monster as such: " POSS H 0 A_GiveToTarget ("Quip") " So when the monster dies, the player will say a one liner. The powerup duration in the above code decides how long before the player can say another one liner. You could also limit this by adding a A_Jump frame before the A_GiveToTarget frame, and set it for however big chance you want the one liners to have.
Post Reply

Return to “Scripting”