12-01-2011, 08:36 AM
Hey, This is the first time I've ever used Global Variables, and I'm having some troubles with Global variables. This is what I've added to both script files I want the global variable to apply on. This is not all of the script, only the parts that include the global variables.
Map 1:
Map 1:
Quote:void OnStart()Map 2:
{
SetGlobalVarInt("Globalvar1", 0);
}
void func_on()
{
if(GetGlobalVarInt("Globalvar1") == 1)
{
SetSwingDoorLocked("elevator_door_1", false, false);
}
}
Quote:void OnStart()Again, these are not the full .hps files because I don't want to ruin anything (and there's alot of lines). There are NO fatal errors it works perfectly, but once I do what I'm required by the script, it loads the other map and the elevator door is still locked. Any information about this would be very helpful. Thanks
{
SetGlobalVarInt("Globalvar1", 0);
SetEntityConnectionStateChangeCallback("valve_iron_1", "valve_func1");
}
void valve_func1(string &in asEntity, int alState)
{
AddLocalVarInt("Var1", 1);
{
AddGlobalVarInt("Globalvar1", 1);
func_on();
}
}
void func_on()
{
if(GetGlobalVarInt("Globalvar1") == 1)
{
SetSwingDoorLocked("elevator_door_1", false, false);
}
}