Adding cheat codes
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!)
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!)
- Korni27
- Posts: 46
- Joined: Sun Jan 31, 2021 9:18 am
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 10
- Location: Poland
- Contact:
Adding cheat codes
Can you add your own cheat godes to GZDoom? If yes then how?
- Player701
-
- Posts: 1710
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: Adding cheat codes
As far as I know, it is not possible to add, change or remove any of the "classic" cheat codes (like IDDQD, IDKFA etc). You also cannot add new console commands, but you can leverage stuff like network events to implement a cheat-like command that would have the form of netevent <mycommand>. You can even check in your handler if cheating is currently disabled and refuse to run the command if that's the case. For example:
Code to check for cheat mode taken from here.
Upd: You can also use KEYCONF to create an alias for your netevent command, e.g.
So, technically, it's almost as a new console command, so what I said about not being able to add new ones wasn't entirely true.
Code: Select all
class TestHandler : EventHandler
{
override void NetworkProcess(ConsoleEvent e)
{
if (e.Name ~== "mycheat")
{
if ((G_SkillPropertyInt(SKILLP_DisableCheats) || netgame || deathmatch) && (!sv_cheats))
{
if (e.Player == consoleplayer)
{
// print this message for the local player only
Console.Printf("sv_cheats must be true to enable this command.");
}
}
else
{
// TODO: Do something
}
}
}
}
Upd: You can also use KEYCONF to create an alias for your netevent command, e.g.
Code: Select all
alias mycheat "netevent mycheat"
- ramon.dexter
- Posts: 1562
- Joined: Tue Oct 20, 2015 12:50 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Kozolupy, Bohemia
Re: Adding cheat codes
If I can add my two cents, I've achieved this with ACS. I'm following the quake paradigm "impulse #", but instead of 'impulse', I use 'puke' and simply call numbered scripts with required content.
Not the full "cheat" like the IDDQD, but it works.
Not the full "cheat" like the IDDQD, but it works.
- MartinHowe
- Posts: 2062
- Joined: Mon Aug 11, 2003 1:50 pm
- Preferred Pronouns: He/Him
- Location: East Suffolk (UK)
Re: Adding cheat codes
I forget the syntax off the top of my head, but you can also include a basic check for cheating enabled as part of the alias.