Why isn't this if statement working?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
3psilon
Posts: 12
Joined: Sat Mar 07, 2026 1:54 pm
Operating System Version (Optional): Linux Mint 22.1 Cinnamon
Graphics Processor: nVidia with Vulkan support

Why isn't this if statement working?

Post by 3psilon »

I know that mod_CasingCleanup works, however when it equals 1, nothing happens to the casings, and the same for 0. I also tried making it a bool but that had the same effect.
Any help?

Code: Select all

override void Tick() {
	
		int CasingCleanupTime = GetCVar("mod_CasingCleanupTime");
		int CasingCleanup = GetCVar("mod_CasingCleanup");

        super.Tick();
		
		if (CasingCleanup) {
		
			age++;

			if (age > 3*35) {

				self.Destroy();

			}
		
		}

    }
User avatar
m8f
 
 
Posts: 1524
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Location: Siberia (UTC+7)

Re: Why isn't this if statement working?

Post by m8f »

Maybe mod_CasingCleanup is a `user` CVar? Should be `server`.

GetCVar:
> If the variable could not be found, or its scope is user and the calling actor is not a player, the function returns 0.

Return to “Scripting”