[zScript] Check if player has godmode activated

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
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

[zScript] Check if player has godmode activated

Post by Cherno »

I simply want to check, in zScript, if a PlayerPawn is invulnerable from having activated godmode ("god" in console, or IDDQD).
Checking for the INVULNERABLE flag doesn't work.
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: The Netherlands

Re: [zScript] Check if player has godmode activated

Post by gwHero »

Not tested, but this should work:

let player = self.player;
if (player.cheats & CF_GODMODE)
...

(see player.zs in gzdoom.pk3)
User avatar
Cherno
Posts: 1337
Joined: Tue Dec 06, 2016 11:25 am

Re: [zScript] Check if player has godmode activated

Post by Cherno »

Thanks. 3saster provided a solution on Discord

Code: Select all

CPlayer.cheats & (CF_GODMODE | CF_GODMODE2)
https://github.com/coelckers/gzdoom/blo ... 1155-L1186
User avatar
Logan MTM
Posts: 678
Joined: Mon Jan 16, 2006 8:53 pm
Location: Rio de Janeiro - Brazil

Re: [zScript] Check if player has godmode activated

Post by Logan MTM »

There is a way to do this check in ACS?
Post Reply

Return to “Scripting”