Jump to content
Sign in to follow this  
d3lta

addAction failing with publicVariable

Recommended Posts

Hi masters,

PublicVariable is failing when I use publicVariable. see:

init.sqf:

_actionId1 = lidergeral addAction ["<t color='#FF0000'>Falar</t>", { nul= [] execVM "FalarComLider.sqf" } ];

FalarComLider.sqf

objtFOXTROT=1;

publicVariable "objtFOXTROT"; <-------- don't broadcast to others PC....

What's the problem?

obs 1.: I tested on dedicated (arma 3).

best regards...

D3lta

Edited by D3lta

Share this post


Link to post
Share on other sites

make sure each client knows what the variable is prior to being transmitted across the network - (publicVariable);

for example - in the init.sqf - you could have if (isnil objtFOXTROT) then {objtFOXTROT = 0};

that way when each client loads in they will have access to the variable objtFOXTROT.

Very crude explanation i know...sorry

Share this post


Link to post
Share on other sites
make sure each client knows what the variable is prior to being transmitted across the network - (publicVariable);

for example - in the init.sqf - you could have if (isnil objtFOXTROT) then {objtFOXTROT = 0};

that way when each client loads in they will have access to the variable objtFOXTROT.

Very crude explanation i know...sorry

Thanks Mikie boy. But "isnil" isn't the problem, I tested. =( Is Arma3 introducing a new role security with addAction and publicvariable?

Best regards.

Edited by D3lta

Share this post


Link to post
Share on other sites

not solved.

Edited by D3lta

Share this post


Link to post
Share on other sites

Please, what's wrong with this code?

init.sqf


task4 = player createSimpleTask ["tskc4"];
task4 setSimpleTaskDescription ["Blah Blah Blah","Zamaks","Zamaks"];
task4 settaskstate "Created";
task4 setSimpleTaskDestination markerpos "obj4";


hand1= leaderSoldier addaction ["Speak","missaook.sqf"];

if (isServer || isDedicated) then
{



"DisparadorDeEventoGlobal" addPublicVariableEventHandler {

localize "SERVER XXXXXXXXXXXXXXXXXXXXXX";   


       _NomeEvento = _this select 1 select 0;
       _ValEvento  = _this select 1 select 1;


       DisparadorDeEventoParaCliente = [_NomeEvento,_ValEvento];

       publicVariable "DisparadorDeEventoParaCliente";
   };


}
else
{

  "DisparadorDeEventoParaCliente" addPublicVariableEventHandler {
       _params = _this select 1;
       _ne = _params select 0;
       hintSilent "MEH MEH MEH MEH";
   };


};




missaook.sqf <------ FIRED BY ADDACTION


DisparadorDeEventoGlobal=["facaAlgo","1"];
publicVariableServer "DisparadorDeEventoGlobal";

Here, using the speak menu on leader, don't show nothing, no hintSilent, no log info... :butbut:

Share this post


Link to post
Share on other sites

The PVEH will not fire on the machine that executed the broadcast command. So if you're testing on your own machine, then you will not receive what's being broadcasted via the PVEH.

Share this post


Link to post
Share on other sites
The PVEH will not fire on the machine that executed the broadcast command. So if you're testing on your own machine, then you will not receive what's being broadcasted via the PVEH.

Hi

I'm testing in dedserver, not preview mode.

Share this post


Link to post
Share on other sites

Did you add a debug hint to the server PVEH?

---------- Post added at 18:30 ---------- Previous post was at 18:29 ----------

IE;

hint localize "SERVER XXXXXXXXXXXXXXXXXXXXXX";

or

hint "SERVER XXXXXXXXXXXXXXXXXXXXXX";

Share this post


Link to post
Share on other sites

hint localize "SERVER XXXXXXXXXXXXXXXXXXXXXX";

Don't have HINT in my code, only localize that writes to arma's log.

---------- Post added at 03:40 AM ---------- Previous post was at 03:39 AM ----------

Obs. Only HintSilent can to fire to display on client PC.

Share this post


Link to post
Share on other sites
Obs. Only HintSilent can to fire to display on client PC.

Not quite sure what you're getting at. Even if hint is local, it should be broadcasted to clients because it's in a PVEH. In any case, good luck with your script.

Edited by Iceman77

Share this post


Link to post
Share on other sites

He shouldn't need to use bis_fnc_mp though. I thought code within the PVEH should broadcast ?

Edited by Iceman77

Share this post


Link to post
Share on other sites
He shouldn't need to use bis_fnc_mp though. I thought code within the PVEH should broadcast ?

Of course but the MP function has been developped for doing the job and less publicvariable decrease network consumption

Edited by Mariodu62

Share this post


Link to post
Share on other sites

Gotcha. I thought you meant he needed to use bis_fnc_mp within the pveh.

Share this post


Link to post
Share on other sites
Not quite sure what you're getting at. Even if hint is local, it should be broadcasted to clients because it's in a PVEH. In any case, good luck with your script.

publicVariable "DisparadorDeEventoParaCliente"; and "DisparadorDeEventoParaCliente" addPublicVariableEventHandler does not broadcast to all clients?

---------- Post added at 11:28 AM ---------- Previous post was at 11:26 AM ----------

try with bis_fnc_mp...

hummm.. I will try.

Share this post


Link to post
Share on other sites

Not sure what the problem is but....

"FOCK_GHint" addPublicVariableEventHandler
 {
   private ["_GHint"];
  _GHint = _this select 1;
   hint format["%1", _GHint];
 };

and

// FOCK_GHint = "Hello everyone on the server except me!"; publicVariable "FOCK_GHint"; 

works fine - the only person who this doesn't see the message is the player/machine that executed the broadcast command.

maybe you need to explain more about what your trying to do or what code you are using.

Share this post


Link to post
Share on other sites
Not sure what the problem is but....

"FOCK_GHint" addPublicVariableEventHandler
 {
   private ["_GHint"];
  _GHint = _this select 1;
   hint format["%1", _GHint];
 };

and

// FOCK_GHint = "Hello everyone on the server except me!"; publicVariable "FOCK_GHint"; 

works fine - the only person who this doesn't see the message is the player/machine that executed the broadcast command.

maybe you need to explain more about what your trying to do or what code you are using.

Exactly... That said, the OP could just use bis_fnc_mp though and do away with PVEH's.

Edited by Iceman77

Share this post


Link to post
Share on other sites
Not sure what the problem is but....

"FOCK_GHint" addPublicVariableEventHandler
 {
   private ["_GHint"];
  _GHint = _this select 1;
   hint format["%1", _GHint];
 };

and

// FOCK_GHint = "Hello everyone on the server except me!"; publicVariable "FOCK_GHint"; 

works fine - the only person who this doesn't see the message is the player/machine that executed the broadcast command.

maybe you need to explain more about what your trying to do or what code you are using.

The main problem is using addPublicVariableEventHandler with addaction. When I use with radio trigger , no problem.

Share this post


Link to post
Share on other sites

But why not just use bis_fnc_mp?

Delta_fnc_message = {
    [{hint "MEH MEH MEH MEH";},"BIS_fnc_spawn",true,false] spawn BIS_fnc_MP;
    // do stuff
};

player addAction ["Broadcast Message", {call Delta_fnc_message;}, [], 1, false, true, "", "_target == lidergeral"];

Edited by Iceman77

Share this post


Link to post
Share on other sites
But why not just use bis_fnc_mp?

Delta_fnc_message = {
    [{hint "MEH MEH MEH MEH";},"BIS_fnc_spawn",true,false] spawn BIS_fnc_MP;
    // do stuff
};

player addAction ["Broadcast Message", {call Delta_fnc_message;}, [], 1, false, true, "", "_target == lidergeral"];

YEAHHHHHH, I tested here now and bis_fnc_mp run's fine. THANKS A LOT Mariodu62, Iceman77 and Mikie Boy.

Best regards!!

:D:D:D

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  

×