Jump to content
Sign in to follow this  
Kettlewell

PublicVariables

Recommended Posts

I wondered if anyone could check out my code to spot what mistake I'm making.

Client\CaptureIran.sqf

object = _this select 0;
activator = _this select 1;

//if (side activator == east) exitWith { hint "You cannont capture your own FOB." };
if (IranCapture) exitWith { hint "The FOB is already being captured." };
if (IranInCooldown) exitWith { hint "You cannot attempt to capture the FOB again yet." };

publicVariableServer "CapRed";

Server\Init.sqf

CaptureIran = compile preprocessFileLineNumbers "server\CaptureIran.sqf";
"CapRed" addPublicVariableEventHandler {
  _name = _this select 0; 
  _params = _this select 1; 
  _params spawn CaptureIran; };

The problem is that CaptureIran.sqf on the server does not get ran, I checked the RPT file to find zero errors and I have added some debug code at the start of the file but it doesn't show up meaning it isn't getting ran.

I appreciate any help that someone can give.

Share this post


Link to post
Share on other sites

Just guessing here, but the problem may be that hints don't show up directly upon mission start (time has to be > 0 if a hint is to be shown).

Share this post


Link to post
Share on other sites
Just guessing here, but the problem may be that hints don't show up directly upon mission start (time has to be > 0 if a hint is to be shown).

The code runs around 20-40 seconds in game depending on how fast someone can run to the cap.

Share this post


Link to post
Share on other sites

Are using publicvariables the only way to retrieve variable data from the server to the client or to call a file on the server with a command on the client?

Because these public variables aren't working and it doesn't seem anyone knows why.

Thank You.

Share this post


Link to post
Share on other sites

Bumping this up once to see if anyone can assist, still stuck on the same issue.

Share this post


Link to post
Share on other sites

Did you initialize the CapRed variable somewhere on the client?

Share this post


Link to post
Share on other sites
Did you initialize the CapRed variable somewhere on the client?

I haven't initialized it in the client.

Share this post


Link to post
Share on other sites
Just guessing here, but the problem may be that hints don't show up directly upon mission start (time has to be > 0 if a hint is to be shown).

I've experienced the exact opposite. Stuff like sideChat may not work, but hints seem to show even when they run from an init line of a unit.

Then again, Arma 3 alpha seems to have many hint-related bugs (hints not showing in general or showing with a huge delay for reasons I couldn't figure out nor reproduce reliably), but this has nothing to do with mission start time, as it can happen at any point during the mission.

First make sure the script actually doesn't run at all by adding a player sideChat and/or diag_log line at its beginning (sideChat is more risky as it requires radio and player to not be null, but doesn't require looking at the RPT file like diag_log, can be scrolled up and doesn't bug out like hint does).

If the script does run, see how far it gets using a similar method and then figure why it gets stuck (undefined variable, for example, can cause strange problems and not always show an undefined variable error).

If it doesn't run, debug whatever is calling your script.

In any case, make sure you always run your game with the -showScriptErrors startup parameter, so you don't have to constantly monitor your RPT file. Either add it to the command line or use a launcher such as Play withSIX to enable it (preferably along with -nosplash and -skipintro to make the game load faster).

Share this post


Link to post
Share on other sites

What does "Server/Init.sqf" mean? Is it executed from "init.sqf", and how?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×