wontialo 10 Posted April 11, 2014 (edited) Hello. Just like what the title says, how do you make the already activated trigger to have its effect on JIP players? Let me elaborate - I have a mission where there are pre-positioned AIs ambushing in certain locations. They are all hidden and their simulation is disabled with the codes : A1 this hideobject "true"; this enablesimulation false; A2 this hideobject "true"; this enablesimulation false; A3 this hideobject "true"; this enablesimulation false; ...etc When the players reach a certain trigger point, the trigger activates, making these AIs visible and enabling their simulation with these codes : {_x enablesimulation true} forEach [A1,A2,A3 ...]; {_x hideobject false} forEach [A1,A2,A3 ...]; (I know...very messy and unrefined...but for a novice editor, it would do) Now this is all fine and all but the problem exists for the later joining players. When these triggers are activated, only the players who were in the session were able to correctly see the AIs, as I understand that triggers are only locally executed. For the players who joined later, since the triggers were already activated and gone, they were not able to see the AIs. They would wonder around and get shot by 'invisible' AIs. So, in a nutshell, making the trigger also work for JIP players instead of disappearing after being activated by previous players would really solve the problem... I was thinking about making the triggers activated 'Repeatedly' instead of 'Once', but I am afraid of the consequences this might bring. (Severe lag maybe?) Any help would be greatly appreciated. Thanks! Edited April 11, 2014 by wontialo Share this post Link to post Share on other sites
Dwarden 1125 Posted April 11, 2014 there are hideObjectGlobal and enableSimulationGlobal server commands that are JIP compatible Share this post Link to post Share on other sites
wontialo 10 Posted April 11, 2014 Why, none other than Dwarden himself?! So I could just substitute the commands with the above? Simple as that? Instead of {_x enablesimulation true}, I use {_x enablesimulationglobal true} and instead of {_x hideobject false}, I use {_x hideobjectglobal false}? I must try this at once! Thanks for the input Share this post Link to post Share on other sites
wontialo 10 Posted April 12, 2014 "_x enableSimulationGlobal true" does indeed work, but for the hideObjectGlobal, there is no option for un-hiding it. This command only hides the object and can't make it visible again....hm... Share this post Link to post Share on other sites
Magirot 14 Posted April 12, 2014 but for the hideObjectGlobal, there is no option for un-hiding it. This command only hides the object and can't make it visible again....hm... That's sadly the case. Feedback ticket here: http://feedback.arma3.com/view.php?id=17299 I think in your case the reason isn't that the trigger is "gone" when the Join-In-Progress players arrive, rather it hasn't been activated yet for them, because the trigger conditions and activation is checked separately for every player. Or at least that's the way they've come to bite me in the rear. Sickboy's locality guide for Arma 2 says: Triggers created in editor exist on all machines (a trigger is created per machine, local to it), and they run on all machines (conditions checked, onActivation/onDeActivation executed when condition is true etc) Because the trigger is created on each machine, changing the trigger properties (statements, onActivation, etc. etc) has only local effects. I mean that the trigger is there, but at the moment when they join no-one is fulfilling its condition, so it doesn't activate. So what you might want to try is to add this to your init.sqf: if isServer then { ambush_activated = FALSE; [url="https://community.bistudio.com/wiki/publicVariable"]publicVariable[/url] "ambush_activated"; } and change the ambush activation trigger's On Activation field to this: ambush_activated = TRUE; [url="https://community.bistudio.com/wiki/publicVariable"]publicVariable[/url] "ambush_activated"; and finally create a new trigger which has the unhiding and enable simulation stuff, and simply ambush_activated in its Condition field. That way JIP players don't have to walk to the trigger to activate it, rather the server passes the state of ambush_activated to them during joining, after which the trigger is activated as well. Share this post Link to post Share on other sites
wontialo 10 Posted April 12, 2014 Thank you Magirot! I was browsing through this whole publicvariable, globalvariable stuffs and I was just short of fainting! I think this should do it, I will try it at once! Share this post Link to post Share on other sites
John Kozak 14 Posted April 12, 2014 That's sadly the case. Feedback ticket here: http://feedback.arma3.com/view.php?id=17299I think in your case the reason isn't that the trigger is "gone" when the Join-In-Progress players arrive, rather it hasn't been activated yet for them, because the trigger conditions and activation is checked separately for every player. Or at least that's the way they've come to bite me in the rear. Sickboy's locality guide for Arma 2 says: I mean that the trigger is there, but at the moment when they join no-one is fulfilling its condition, so it doesn't activate. So what you might want to try is to add this to your init.sqf: if isServer then { ambush_activated = FALSE; [url="https://community.bistudio.com/wiki/publicVariable"]publicVariable[/url] "ambush_activated"; } and change the ambush activation trigger's On Activation field to this: ambush_activated = TRUE; [url="https://community.bistudio.com/wiki/publicVariable"]publicVariable[/url] "ambush_activated"; and finally create a new trigger which has the unhiding and enable simulation stuff, and simply ambush_activated in its Condition field. That way JIP players don't have to walk to the trigger to activate it, rather the server passes the state of ambush_activated to them during joining, after which the trigger is activated as well. +1, way to go. That also automatically solves the problem with tasks. Share this post Link to post Share on other sites
wontialo 10 Posted April 18, 2014 (edited) I don't know what I did wrong, but the problems with JIP players not seeing the AIs continue. I did exactly like Magirot advised... In my init.sqf file I have the following codes- sleep 8; {if (side _x == east) then {_x enablesimulation false};} foreach allunits; {if (side _x == east) then {_x hideobject true};} foreach allunits; sleep 8; if isServer then { ambush_activated1 = FALSE; publicVariable "ambush_activated1"; }; if isServer then { ambush_activated2 = FALSE; publicVariable "ambush_activated2"; }; if isServer then { ambush_activated3 = FALSE; publicVariable "ambush_activated3"; }; if isServer then { ambush_activated4 = FALSE; publicVariable "ambush_activated4"; }; if isServer then { ambush_activated5 = FALSE; publicVariable "ambush_activated5"; }; if isServer then { ambush_activated6 = FALSE; publicVariable "ambush_activated6"; }; And then I have a trigger that is activated by BLUFOR, with condition "This" and On Act. ambush_activated1 = TRUE; publicVariable "ambush_activated1"; And on another separate trigger I have on condition ambush_activated1 and on its On Act. {_x enablesimulation true} forEach [a,b,c,d,...]; {_x hideobject false} forEach [a,b,c,d...]; For all the initial players who were in the server from the start, it works fine. The AIs appear and they perform their duties. However for JIP players, they still can't see the AIs. Its invisible to them, but these invisible AIs can still shoot back... What could possibly be the problem? Edited April 18, 2014 by wontialo Share this post Link to post Share on other sites
Onno 22 Posted April 18, 2014 (edited) I don't know what I did wrong, but the problems with JIP players not seeing the AIs continue. I did exactly like Magirot advised...In my init.sqf file I have the following codes- sleep 8; {if (side _x == east) then {_x enablesimulation false};} foreach allunits; {if (side _x == east) then {_x hideobject true};} foreach allunits; sleep 8; if isServer then { ambush_activated1 = FALSE; publicVariable "ambush_activated1"; }; if isServer then { ambush_activated2 = FALSE; publicVariable "ambush_activated2"; }; if isServer then { ambush_activated3 = FALSE; publicVariable "ambush_activated3"; }; if isServer then { ambush_activated4 = FALSE; publicVariable "ambush_activated4"; }; if isServer then { ambush_activated5 = FALSE; publicVariable "ambush_activated5"; }; if isServer then { ambush_activated6 = FALSE; publicVariable "ambush_activated6"; }; And then I have a trigger that is activated by BLUFOR, with condition "This" and On Act. ambush_activated1 = TRUE; publicVariable "ambush_activated1"; And on another separate trigger I have on condition ambush_activated1 and on its On Act. {_x enablesimulation true} forEach [a,b,c,d,...]; {_x hideobject false} forEach [a,b,c,d...]; For all the initial players who were in the server from the start, it works fine. The AIs appear and they perform their duties. However for JIP players, they still can't see the AIs. Its invisible to them, but these invisible AIs can still shoot back... What could possibly be the problem? Your JIP players will only receive the value of the pubvar when it get's updated. Maybe you have to run a little JIP server-client init using some functions that push the values to them on the server? Also, have you seen Dr_Eyeball's comment on publicVariable? Edited April 18, 2014 by Onno Share this post Link to post Share on other sites
Magirot 14 Posted April 18, 2014 (edited) Your JIP players will only receive the value of the pubvar when it get's updated. That's not the case, JIP players will receive public variables with their latest values when they join. You might be confusing it with how addPublicVariableEventHandler works. As .kju says in the wiki: "For JIP players pV'ed variables are received and set BEFORE the init.sqf." Also, have you seen Dr_Eyeball's comment on publicVariable? If you mean this: "When initialising a public variable to handle JIP, you will usually first want to check if the public variable has already been (broadcast, received and) set locally. Otherwise you may inadvertantly overwrite the broadcast value with your default value." then it shouldn't be an issue, because that's a warning for people using init.sqf to either 1) execute publicVariables on all clients, or 2) setting values regularly for variables that are later broadcast with publicVariable. In the first case the values would be broadcast and overwritten with the default values for everyone when a JIP player joins, in the second the JIP player will first receive the pV'd values, and then init.sqf will follow and set them back to the default on the JIP player's client. Just putting the initial values under an isServer condition and then broadcasting them is enough to avoid both scenarios. Dr_Eyeball's method is more optimal, since it doesn't use additional bandwidth, but with just a few broadcast variables I've not noticed a significant difference. In my init.sqf file I have the following codes- sleep 8; {if (side _x == east) then {_x enablesimulation false};} foreach allunits; {if (side _x == east) then {_x hideobject true};} foreach allunits; Oh, sorry, I forgot this :( Initial trigger checks are done before init.sqf, so stuff probably occurs in the wrong order. First the player receives the publicVariable ambush values, then the triggers run and remove hideObject, and finally all units are hidden as init.sqf is executed (Edit: Especially with the 8sec sleep there delaying it further!) See the load order here - as far as I know, triggers are first checked at point 4 along with unit initialisation fields. Adding a short countdown (like 3sec) to the trigger that removes hideObject should be sufficient. Alternatively, as a little more complicated method, you could add individual checks to init.sqf (but I'd try the countdown first): if isServer then { ambush_activated1 = FALSE; publicVariable "ambush_activated1"; ambush_activated2 = FALSE; publicVariable "ambush_activated2"; ambush_activated3 = FALSE; publicVariable "ambush_activated3"; ambush_activated4 = FALSE; publicVariable "ambush_activated4"; ambush_activated5 = FALSE; publicVariable "ambush_activated5"; ambush_activated6 = FALSE; publicVariable "ambush_activated6"; }; if (!ambush_activated1) then { { _x enableSimulation FALSE } forEach units group unit_name_of_some_unit_in_ambush_1; { _x hideObject TRUE } forEach units group unit_name_of_some_unit_in_ambush_1; }; if (!ambush_activated2) then { { _x enableSimulation FALSE } forEach units group unit_name_of_some_unit_in_ambush_2; { _x hideObject TRUE } forEach units group unit_name_of_some_unit_in_ambush_2; }; if (!ambush_activated3) then { { _x enableSimulation FALSE } forEach units group unit_name_of_some_unit_in_ambush_3; { _x hideObject TRUE } forEach units group unit_name_of_some_unit_in_ambush_3; }; etc In case you're curious, the variable setup that doesn't involve isServer or publicVariable that Onno mentioned above would be like this: if ([url="https://community.bistudio.com/wiki/isNil"]isNil[/url] "ambush_activated1") then { ambush_activated1 = FALSE }; if (isNil "ambush_activated2") then { ambush_activated2 = FALSE }; if (isNil "ambush_activated3") then { ambush_activated3 = FALSE }; if (isNil "ambush_activated4") then { ambush_activated4 = FALSE }; if (isNil "ambush_activated5") then { ambush_activated5 = FALSE }; if (isNil "ambush_activated6") then { ambush_activated6 = FALSE }; The triggers should still use publicVariable to broadcast the values, if this is used. Edited April 18, 2014 by Magirot Share this post Link to post Share on other sites