Jump to content

publicVariable not working?


blckeagls

Recommended Posts

I have three scripts..   
This one launchs only at spawn from server_functions.sqf:
 

   _a=0;
   _b=1;
  _danespawn = true;
  _natespawn = true;
  _alynxispawn = true;
  publicVariable "_danespawn"; 
  publicVariable "_natespawn"; 
  publicVariable "_alynxispawn"; 
  
while { _a < _b } do {
	if (_danespawn && _natespawn && _alynxispawn) then {
			[[1187,4138,1],"ItemAmethyst"] execVM "PlayerBase\spawnguards.sqf"; 
			waitUntil {!_danespawn || !_natespawn || !_alynxispawn};
	} else {
			{
			_rb = magazines _x;
				if ("ItemAmethyst" in _rb) then {
					deleteVehicle _x;
				};
			}forEach allUnits;
			waitUntil {_danespawn && _natespawn && _alynxispawn};
		};
};

This one that executes when a player enters an area:
 

if ((getPlayerUID player) in ["163214982","11032256"]) then {
{
  _danespawn = false;  
  publicVariable "_danespawn"; 
};

if ((getPlayerUID player) in ["13192774"]) then {
{
  _natespawn = false;  
  publicVariable "_natespawn"; 
};

if ((getPlayerUID player) in ["164931206"]) then {
{
  _alynxispawn = false;
  publicVariable "_alynxispawn"; 
};

And this one that executes when a player leaves an area:

if ((getPlayerUID player) in ["163214982","11032256"]) then {
{
  _danespawn = true;  
  publicVariable "_danespawn"; 
};

if ((getPlayerUID player) in ["13192774"]) then {
{
  _natespawn = true;  
  publicVariable "_natespawn"; 
};

if ((getPlayerUID player) in ["164931206"]) then {
{
  _alynxispawn = true;
  publicVariable "_alynxispawn"; 
};

Why does this not work?  It spawns the AI..  but it doesn't remove them when they enter the area...

Link to comment
Share on other sites

Ok I changed them... Still doenst work...  Here is latest scripts....  (This is a AI Base Guard Script...  When a player enters an area the ai gets removed.. when all leave they come back)

At server start this runs:
 

   _a=0;
   _b=1;
  danespawn = true;
  natespawn = true;
  alynxispawn = true;
  publicVariable "danespawn"; 
  publicVariable "natespawn"; 
  publicVariable "alynxispawn"; 
  [[1288,4078,1],"ItemAmethyst"] execVM "PlayerBase\spawnguards.sqf"; 
while { _a < _b } do {
		if ( danespawn && natespawn && alynxispawn ) then {
			[[1288,4078,1],"ItemAmethyst"] execVM "PlayerBase\spawnguards.sqf"; 
			while { danespawn && natespawn && alynxispawn } do { };
		};
	};
	if ( !danespawn || !natespawn || !alynxispawn ) then {
		{
		_rb = magazines _x;
			if ("ItemAmethyst" in _rb) then {
				deleteVehicle _x;
			};
		}forEach allUnits;
		while { !danespawn || !natespawn || !alynxispawn } do { };
	};
};

When player enters area:

if ((getPlayerUID player) in ["163214982","11032256"]) then {
{
  danespawn = false;  
  publicVariable "danespawn"; 
};

if ((getPlayerUID player) in ["13192774"]) then {
{
  natespawn = false;  
  publicVariable "natespawn"; 
};

if ((getPlayerUID player) in ["164931206"]) then {
{
  alynxispawn = false;
  publicVariable "alynxispawn"; 
};

When player leaves area: 

if ((getPlayerUID player) in ["163214982"]) then {
{
  danespawn = true;  
  publicVariable "danespawn"; 
};

if ((getPlayerUID player) in ["13192774"]) then {
{
  natespawn = true;  
  publicVariable "natespawn"; 
};

if ((getPlayerUID player) in ["164931206"]) then {
{
  alynxispawn = true;
  publicVariable "alynxispawn"; 
};
Link to comment
Share on other sites

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
  • Advertisement
  • Discord

×
×
  • Create New...