Global Variable keeps reverting to zero when entering a new map

My map has special keys that can unlock cabinets that contain weapons and ammo. I want those keys to carry over to the next level, however, it doesn't work as intended since it keeps reverting back to "0'' when the new map is loaded.

 

CODE:

Cabinet Script

#library "cabinet"
#include "zcommon.acs"
bool PowerOn = FALSE;

global int 2: cabinetKeys;

script "cabinetKeyFound" (void){
	cabinetKeys++;
	HudMessage(s: "Cabinet Card acquired"; HUDMSG_PLAIN, 0, CR_GREEN, 0.5, 0.27, 3.7);
	HudMessage(s: "Card Count:", i: cabinetKeys; HUDMSG_PLAIN, 0, CR_GREEN, 0.5, 0.32, 3.7);
}

Map01 and Map02 import the cabinet library using...

#import "main"
#import "cabinet"
#include "zcommon.acs"

 

Any ideas on how to make the variable carry over to the other map? I've been trying things for over an hour

Share this post


Link to post

Fixed it. I was importing the variables while also using a LOADACS lump. Apparently that causes problems. All good now

Edited by DoomeDx

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now