Martinez.E 14 Posted December 25, 2014 So before, i used the trigger 0-0-Alpha and it was start the target range. worked fine in the editor, all lanes worked perfect. put it in a multiplayer server and it was putting up random amounts of targets for no reason! so then i read on a google a little..tried to put the condition as this && isServer but all that did was make lane 1 work and the others did nothing. Anyone know whats going on? Share this post Link to post Share on other sites
jshock 513 Posted December 25, 2014 You have provided no information for us to help other than something isn't working, so how are you accomplishing your range, code and all. Share this post Link to post Share on other sites
Martinez.E 14 Posted December 25, 2014 so on the "ON ACT." nopop=true; nul=[20,1,5] execVM "popup.sqf" POPUP.SQF // How to use. // 1. Place a popup target and name it to pt1 // 2. copy it 8 times and it will auto name the targets // 3. place this line in a trigger or init nul=[max,set,time] execVM "popup.sqf" // max is the total number of targets that will popup // set is the max number of targets that can popup per set upto a max of 3 // time is the amount of time to hit the targets before they go down _maxtarg = _this select 0; _numtargs = _this select 1; _skill = _this select 2; _targets = [pt1,pt1_1, pt1_2, pt1_3, pt1_4, pt1_5];// target names _many = count _targets; // count the number of possible targets _inc = 0;// keeps track of the number of popup targets triggered _score = 0;// keep count of the targets hit {_x animate["terc",1]} forEach _targets;//puts the targets down before the start _rnumber1=0; _rnumber2=0; _rnumber3=0; _flag1=0; _flag2=0; hint "Setting up the Range"; sleep 2; hint "Ready"; sleep 2; while {_inc<_maxtarg} do { _rnumber1 = random _many; _int = _rnumber1%1; _rnumber1 = _rnumber1-_int; // 1. Check for duplicate targets while {(_rnumber1 == _rnumber2) or (_rnumber1 == _rnumber3) or (_rnumber2 == _rnumber3)} do { _rnumber2 = random _many; _int = _rnumber2%1; _rnumber2 = _rnumber2-_int; _rnumber3 = random _many; _int = _rnumber3%1; _rnumber3 = _rnumber3-_int; }; // 1. END // 2. Set the targets that will popup _rtarget1 = _targets select _rnumber1; _rtarget2 = _targets select _rnumber2; _rtarget3 = _targets select _rnumber3; // 2. END // 3. Popup target one always active _rtarget1 animate["terc", 0]; _inc=_inc+1; // 3. END // 3a. Check to see if more than one target is required and opopup at random // 3b. second target If (_numtargs > 1 ) then { if ((random 2 > 1) and (_inc < _maxtarg)) then { _rtarget2 animate["terc", 0]; _inc=_inc+1; _flag1=1; }; }; //3b. END //3c. Third target If (_numtargs > 2 ) then { if ((random 2 < 1) and (_inc < _maxtarg)) then { _rtarget3 animate["terc", 0]; _inc=_inc+1; _flag2=1; }; }; // 3c. END // 3a. END // 4. Time allowed for shooting. sleep _skill; // 4. END // 5. Check to see if targets have been hit and count the score if (_rtarget1 animationPhase "terc" > 0.1) then { _score = _score+1; }; if ((_rtarget2 animationPhase "terc" > 0.1) and (_flag1 == 1)) then { _score = _score+1; }; if ((_rtarget3 animationPhase "terc" > 0.1) and (_flag2 == 1)) then { _score = _score+1; }; // 4. END // 5. Display Score hint format ["Targets :%1 Hit :%2",_inc,_score]; // 5. END // 6. Reset targets down and restet flags _rtarget1 animate["terc", 1]; _rtarget2 animate["terc", 1]; _rtarget3 animate["terc", 1]; _flag1=0; _flag2=0; // 6. END sleep 2; }; sleep 8; hint "Session Complete"; at the moment, the targets are going up and down, but what i want is for them to only do ONE target at a time. right now its random at 1 or 2 targets which i dont want. i want it to be any random target but only ONE target at a time. the trigger is working now but its the amount of random targets that are popping up that is wrong. Share this post Link to post Share on other sites
austin_medic 109 Posted December 25, 2014 (edited) numbers are randomly generated for every client. you'd need to syncronize a global var across everybody with bis_fnc_mp or write out some simple logic for your targets to go up and down in a specific order. EDIT: though that may not be your big problem here. Whats with the %1's behind the random _int stuff? Edited December 25, 2014 by austin_medic Share this post Link to post Share on other sites
Martinez.E 14 Posted December 25, 2014 Tried changing the nopop=true; nul=[20,1,5] execVM "popup.sqf" to [20,0,5] to see if it wouldt change but it didnt do anything, went in to dedicated server and it still was putting up either 2 targets at random, or sometimes just one target. i just want one target popping up at a time. for some reason it works fine in the editor but doesnt work in the server ---------- Post added at 10:56 AM ---------- Previous post was at 10:55 AM ---------- numbers are randomly generated for every client. you'd need to syncronize a global var across everybody with bis_fnc_mp or write out some simple logic for your targets to go up and down in a specific order. any idea how to do this? ---------- Post added at 11:23 AM ---------- Previous post was at 10:56 AM ---------- numbers are randomly generated for every client. you'd need to syncronize a global var across everybody with bis_fnc_mp or write out some simple logic for your targets to go up and down in a specific order.EDIT: though that may not be your big problem here. Whats with the %1's behind the random _int stuff? Not sure, i didnt make this script. its freely available here on the forum for a basic shooting range. Share this post Link to post Share on other sites
f2k sel 164 Posted December 25, 2014 Some times when you copy and paste to the forum I've seen a space added to certain variables maybe it's something like that that may be adding the %1. It shouldn't be there anyway, the script was never intended for MP and was more just a test for A2. The variable that controls the number of targets popping at anyone up should be the one passed here _numtargs = _this select 1; make sure it's set to 1 to only have one target at a time pop up. Share this post Link to post Share on other sites
Martinez.E 14 Posted December 25, 2014 So should the percent sign be replaced with a _ ? cause there are a few spots like when you say make sure only one is popping up, where do i do that i at? i have tried multiple things but normally one target will pop up, then it will go down, then 2 targets come up and go down, then it repeats it self. is there something in the popup.sqf i need to change? i also checked the current script and it says _numtargs = _this select 1; while {_inc<_maxtarg} do { _rnumber1 = random _many; _int = _rnumber1%1; _rnumber1 = _rnumber1-_int; // 1. Check for duplicate targets while {(_rnumber1 == _rnumber2) or (_rnumber1 == _rnumber3) or (_rnumber2 == _rnumber3)} do { _rnumber2 = random _many; _int = _rnumber2%1; _rnumber2 = _rnumber2-_int; _rnumber3 = random _many; _int = _rnumber3%1; _rnumber3 = _rnumber3-_int; }; ---------- Post added at 01:30 PM ---------- Previous post was at 01:18 PM ---------- alright so i tested again in the editor. targets pop up one at a time in the EDITOR. as soon as i pbo it to go to the dedicated server, it all of a sudden forgets to do one target at a time. wtf? Share this post Link to post Share on other sites
f2k sel 164 Posted December 25, 2014 They should just be _int = _rnumber1; _int = _rnumber2; ect I can't really help with MP scripting as I've never done any. There was a version of the code that will only ever run one target at a time. This is a slightly modified version someone made I can't find the original. _inc = 0; _count = 0; _targets = [pt1, pt1_1, pt1_2, pt1_3, pt1_4, pt1_5, pt1_6, pt1_7, pt1_8, pt1_9, pt1_10, pt1_11, pt1_12]; _many = count _targets; {_x animate["terc",1]} forEach _targets; hint "Welcome to Avery's Rifle Qualification Range"; sleep 5; hint "Setting up the Range"; sleep 3; hint "The Qualification Course will begin in 10 Seconds"; sleep 2; hint "The Qualification Course will begin in 8 Seconds"; sleep 2; hint "The Qualification Course will begin in 6 Seconds"; sleep 2; hint "The Qualification Course will begin in 4 Seconds"; sleep 2; hint "The Qualification Course will begin in 2 Seconds"; sleep 2; hint "Begin!"; while {_inc<20} do { _rnumber = floor random _many; _rtarget = _targets select _rnumber; _rtarget animate["terc", 0]; sleep 6; if (_rtarget animationPhase "terc" > 0.1) then { _count = _count+1; }; hint format ["Targets :%1 Hit :%2",_inc+1,_count]; _rtarget animate["terc", 1]; _inc = _inc + 1; }; sleep 8; hint "Session Complete,"; sleep5; if (_count >= 19) then {hint "You Scored MARKSMAN";}; if (_count <= 18) then {hint "You Scored RIFLEMAN";}; if (_count <= 15) then {hint "You Scored GRUNT";}; if (_count <= 9) then {hint "You Scored TRUCK DRIVER";}; Share this post Link to post Share on other sites
Martinez.E 14 Posted December 25, 2014 Edited the hint and the amount of targets but i loaded that one on the editor, worked fine..did one target at a time. Loaded on to the dedicated server and right at the beginning it was going 2 at a time! what am i doing wrong? Share this post Link to post Share on other sites