Jump to content

Global Variable keeps reverting to zero when entering a new map


DoomeDx

Recommended Posts

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...