Luckyas 2 Posted April 11, 2017 Just now, BlacKnightBK said: Try to create the trigger in the initplayerlocal.sqf That would give the same result. Share this post Link to post Share on other sites
BlacKnightBK 47 Posted April 11, 2017 Just now, Luckyas said: That would give the same result. Have you tried it? Because the initplayerlocal runs the script inside it for every player when they join the mission Share this post Link to post Share on other sites
Luckyas 2 Posted April 11, 2017 3 minutes ago, BlacKnightBK said: Have you tried it? Because the initplayerlocal runs the script inside it for every player when they join the mission Init will have the same result as initplayerlocal. https://community.bistudio.com/wiki/Initialization_Order Share this post Link to post Share on other sites
BlacKnightBK 47 Posted April 11, 2017 1 minute ago, Luckyas said: Init will have the same result as initplayerlocal. https://community.bistudio.com/wiki/Initialization_Order Share this post Link to post Share on other sites
Lucullus 71 Posted April 11, 2017 Make a local trigger and think about who must activate it. Any player or only one player... Share this post Link to post Share on other sites
pierremgi 4900 Posted April 11, 2017 Sorry, I didn't pay attention to last posts. If you write if (isServer) then {...}; obviously the code will run on server only (hosted one I guess) That's not what is intended. So think about each line of code! In init.sqf, everything will work fine on each PC if you create your trigger locally (false). Remark: same for airSiren.sqf. This code must run on each PC I presume. For markers, if you create a marker (not local), it will be visible everywhere. So, the server here is a good place. I'm not sure why you're creating a marker "marker1" on an already existing marker: "vmarker1". And, as far as you want to be sure that player variable is consistent locally, you have two ways: in initPlayerLocal, the script runs locally when the player is already defined. So, the script for triggers is OK here, in init.sqf, you can add: waitUntil {local player}; or waitUntil {!isNull player}; before your code. Share this post Link to post Share on other sites
Luckyas 2 Posted April 11, 2017 2 hours ago, pierremgi said: Sorry, I didn't pay attention to last posts. If you write if (isServer) then {...}; obviously the code will run on server only (hosted one I guess) That's not what is intended. So think about each line of code! In init.sqf, everything will work fine on each PC if you create your trigger locally (false). Remark: same for airSiren.sqf. This code must run on each PC I presume. For markers, if you create a marker (not local), it will be visible everywhere. So, the server here is a good place. I'm not sure why you're creating a marker "marker1" on an already existing marker: "vmarker1". And, as far as you want to be sure that player variable is consistent locally, you have two ways: in initPlayerLocal, the script runs locally when the player is already defined. So, the script for triggers is OK here, in init.sqf, you can add: waitUntil {local player}; or waitUntil {!isNull player}; before your code. Thank you very much. Il test it out tomorrow. And for the airsiren.sqf, this is a simple script that will play a airsiren sound across the map. So that should be isServer aswell. Share this post Link to post Share on other sites
Luckyas 2 Posted April 19, 2017 On 11-4-2017 at 7:17 PM, pierremgi said: Sorry, I didn't pay attention to last posts. If you write if (isServer) then {...}; obviously the code will run on server only (hosted one I guess) That's not what is intended. So think about each line of code! In init.sqf, everything will work fine on each PC if you create your trigger locally (false). Remark: same for airSiren.sqf. This code must run on each PC I presume. For markers, if you create a marker (not local), it will be visible everywhere. So, the server here is a good place. I'm not sure why you're creating a marker "marker1" on an already existing marker: "vmarker1". And, as far as you want to be sure that player variable is consistent locally, you have two ways: in initPlayerLocal, the script runs locally when the player is already defined. So, the script for triggers is OK here, in init.sqf, you can add: waitUntil {local player}; or waitUntil {!isNull player}; before your code. Hey man. This week I didn't have any time to test it, but yesterday I made a whole new script since it still doesn't work. Only problem is that this script also doesn't work. I made 2 script. "initServer.sqf" = This script creates the markers on the map, displays text and has all the timing in it. Once some time is over it will make a global variable become "true". "initPlayerLocal.sqf" = This script will wait untill the global variables from "InitServer.sqf" become true. It will then create local triggers on the markers. I tested this with my friend today, and he doesn't get affected by the triggers. They are not created by him I think. Do you know how I can make this work? Scripts: https://pastebin.com/S5RJ7rce initPlayerLocal.sqf https://pastebin.com/vrgvGAe7 initServer.sqf Share this post Link to post Share on other sites
pierremgi 4900 Posted April 19, 2017 initServer runs on server only. A global variable is global (for each scripts) but local (on PCs where these scripts run). A common variable for all players is public. But it's just an info. So, initPlayerLocal can wait a looong time your global but not public variable. Just proceed like this: zoneSchrink1 = true; publicVariable "zoneSchrink1"; Share this post Link to post Share on other sites
Lucullus 71 Posted April 19, 2017 On 11.4.2017 at 7:03 PM, Lucullus said: Make a local trigger and think about who must activate it. Any player or only one player... You want a local effect on one client. Why ask for "ANYPLAYER" ? Share this post Link to post Share on other sites
pierremgi 4900 Posted April 19, 2017 1 hour ago, Lucullus said: You want a local effect on one client. Why ask for "ANYPLAYER" ? I changed my previous post for more precision. ANYPLAYER wraps all players. The first who meets, the trigger fires. On the other hand, don't ask me why, the trigger seems to rearm if you kill the "winner". It's weird as far as a dead player stays a player, in allPlayers command so far. Anyway, you hit a point. ANYPLAYER will fire triggers, local or not. ANYPLAYER is handy because it sorts player units among plenty of others. You can use BLUFOR or ANYBODY to obtain a working list. But, for a specific firing on one PC only: replace <this> in cond field by: count (thislist select {local _x}) > 0 Share this post Link to post Share on other sites