OberSchutze 19 Posted April 13, 2014 Hello all, a few years ago my group built a rifle range that worked great in arma 2, so we ported the script we wrote over to A3 and I am trying to figure out why it is not working. When I shoot a pop up target it does not fall, further, the scripts to drop the targets does not work either. Any help would be greatly appreciated. Range start nul=[] execVM "20thSFG Scripts\Rifle Range\L1Rpopup.sqf"; pop up file //Variables _l1targets = [l1t1, l1t2, l1t3, l1t4, l1t5, l1t6, l1t7, l1t8, l1t9, l1t10, l1t11, l1t12, l1t13, l1t14, l1t15, l1t16, l1t17, l1t18, l1t19, l1t20, l1t21, l1t22, l1t23, l1t24, l1t25, l1t26, l1t27, l1t28, l1t29, l1t30]; // So that the targets don't pop up by them selves. nopop = true; // Should be 0 but needs to be 1 to make the target count correct. _l1foo = 1; // Current Hit count. _l1hc = 0; // Number of targets in the variable... For randomness. _l1ntargets = count _l1targets; // Script {_x animate["terc",1]} forEach _l1targets; nul=["Lane 1 Rifle Range Starting in 5...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 4...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 3...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 2...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 1...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Active...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; while {_l1foo<21} do { _l1rnumber = random _l1ntargets-1; _l1rtarget = _l1targets select _l1rnumber; _l1rtarget animate["terc", 0]; sleep 3; if (_l1rtarget animationPhase "terc" > 0.1) then { _l1hc = _l1hc+1; }; _l1rtarget animate["terc", 1]; _l1foo = _l1foo + 1; sleep random 5; }; nul=[format["Lane 1 Firing Range Inactive... Final Score: %1/20.", _l1hc],"side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 3; // Reset the targets. {_x animate["terc",0]} forEach _l1targets; reset in down position script //Variables _targets = [l1t1, l1t2, l1t3, l1t4, l1t5, l1t6, l1t7, l1t8, l1t9, l1t10, l1t11, l1t12, l1t13, l1t14, l1t15, l1t16, l1t17, l1t18, l1t19, l1t20, l1t21, l1t22, l1t23, l1t24, l1t25, l1t26, l1t27, l1t28, l1t29, l1t30]; // So that the targets don't pop up by them selves. nopop = true; // Knock the targets down {_x animate["terc",1]} forEach _targets; Share this post Link to post Share on other sites
f2k sel 164 Posted April 13, 2014 http://feedback.arma3.com/view.php?id=11978 Share this post Link to post Share on other sites
OberSchutze 19 Posted April 13, 2014 Crap. Looks like I will have to wait till the bug is fixed. Thanks for the reply. Share this post Link to post Share on other sites
f2k sel 164 Posted April 13, 2014 I think you can work around it, maybe add a hit eventhandler to lower the target. Share this post Link to post Share on other sites
OberSchutze 19 Posted April 14, 2014 I have been out of the loop on making these things for a while now. How would I go about making this event handler? Share this post Link to post Share on other sites
f2k sel 164 Posted April 14, 2014 (edited) in main code replace this line {_x animate["terc",1]} forEach _l1targets; with this {_x removealleventHandlers "Hit"; _x addEventHandler ["Hit", { (_this select 0) animate["terc", 1];}];_x animate["terc",1]} forEach _l1targets; and in the knockdown replace this {_x animate["terc",1]} forEach _targets; with this {_x removealleventHandlers "Hit"; _x addEventHandler ["Hit", { (_this select 0) animate["terc", 1];}];_x animate["terc",1]} forEach _targets; seems to work ok on popup targets Edited April 14, 2014 by F2k Sel Share this post Link to post Share on other sites
OberSchutze 19 Posted April 14, 2014 (edited) EDIT: Disregard, that seems to have done it thank you. however my chat dialog does not work or give a score when completed. mp chat script //nul=["text","hintS","",0] execVM "mp_chat.sqf"; _text = _this select 0; _type = _this select 1; _par1 = _this select 2; _par2 = _this select 3; if (isNil "_par2") then { _par2 = 1; }; _init = ""; _cone = createVehicle ["RoadCone",[0,0,0], [], 0, "FLY"]; mp_chat = _par1; publicVariable "mp_chat"; switch(_type)do { case "group": { _init = format["mp_chat groupchat '%1'",_text]; }; case "vehicle": { _init = format["mp_chat vehiclechat '%1'",_text]; }; case "side": { _init = format["mp_chat sidechat '%1'",_text]; }; case "global": { _init = format["mp_chat globalchat '%1'",_text]; }; case "command": { _init = format["mp_chat commandchat '%1'",_text]; }; case "cutText": { _init = format["cutText ['%1','%2',%3]",_text,_par1,_par2]; }; case "echo": { _init = format["echo '%1'",_text]; }; case "hint": { _init = format["hint '%1'",_text]; }; case "hintC": { _init = format["hintC '%1'",_text]; }; case "hintS": { _init = format["hintSilent '%1'",_text]; }; }; _cone setVehicleInit _init; processInitCommands; deleteVehicle _cone; Relevant portion of main script nul=["Lane 1 Rifle Range Starting in 5...","side",RRL1] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 4...","side",RRL1] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 3...","side",RRL1] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 2...","side",RRL1] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 1...","side",RRL1] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Active...","side",rRRL1] execVM "20thSFG Scripts\mp_chat.sqf"; while {_l1foo<21} do { _l1rnumber = random _l1ntargets-1; _l1rtarget = _l1targets select _l1rnumber; _l1rtarget animate["terc", 0]; sleep 3; if (_l1rtarget animationPhase "terc" > 0.1) then { _l1hc = _l1hc+1; }; _l1rtarget animate["terc", 1]; _l1foo = _l1foo + 1; sleep random 5; }; nul=[format["Lane 1 Firing Range Inactive... Final Score: %1/20.", _l1hc],"side",RRL1] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 3; // Reset the targets. {_x animate["terc",0]} forEach _l1targets; Edited April 14, 2014 by MikeJHunter Share this post Link to post Share on other sites
f2k sel 164 Posted April 14, 2014 I know what's wrong but not how to fix it exactly although I took a stab at it. It is working in single play. Also I don't think you need the RoadCone. you can't use these two commands in A3 they have been replaced with spawn BIS_fnc_MP; and a function. _cone setVehicleInit _init; processInitCommands; tag_fnc_sideChat = { call compile format ["%1",_this]; true; }; //nul=["text","hintS","",0] execVM "mp_chat.sqf"; _text = _this select 0; _type = _this select 1; _par1 = _this select 2; _par2 = _this select 3; if (isNil "_par2") then { _par2 = 1; }; _init = ""; _cone = createVehicle ["RoadCone",[0,0,0], [], 0, "FLY"]; mp_chat = _par1; publicVariable "mp_chat"; switch(_type)do { case "group": { _init = format["mp_chat groupchat '%1'",_text]; }; case "vehicle": { _init = format["mp_chat vehiclechat '%1'",_text]; }; case "side": { _init = format["mp_chat sidechat '%1'",_text]; }; case "global": { _init = format["mp_chat globalchat '%1'",_text]; }; case "command": { _init = format["mp_chat commandchat '%1'",_text]; }; case "cutText": { _init = format["cutText ['%1','%2',%3]",_text,_par1,_par2]; }; case "echo": { _init = format["echo '%1'",_text]; }; case "hint": { _init = format["hint '%1'",_text]; }; case "hintC": { _init = format["hintC '%1'",_text]; }; case "hintS": { _init = format["hintSilent '%1'",_text]; }; }; [_init,"tag_fnc_sideChat",true,false,false] spawn BIS_fnc_MP; //_cone setVehicleInit _init; //processInitCommands; deleteVehicle _cone; Share this post Link to post Share on other sites
OberSchutze 19 Posted April 14, 2014 Works perfect man. Much kudos to you for your help! Works in MP flawlessly. Share this post Link to post Share on other sites
OberSchutze 19 Posted April 15, 2014 Looks like it worked for a few min then the targets started popping up again. Do I need to remove the nopop=true statement? Share this post Link to post Share on other sites
f2k sel 164 Posted April 15, 2014 I wouldn't think that was the answer as that disables popup and it works fine in SP. It sounds like a locality issue, are you starting the script through a trigger? In which case your getting multiple scripts running at the same time one fore each player. You could try using an addaction to start the script place an object (laptop) and place this in it's init this addaction ["Start",{ execVM "20thSFG Scripts\Rifle Range\L1Rpopup.sqf"; }]; If you do need a trigger then try adding this to the trigger condition it may help this and isserver I've also added a variable to stop the same lane running more than once at the same time //Variables _l1targets = [l1t1, l1t2, l1t3, l1t4, l1t5, l1t6, l1t7, l1t8, l1t9, l1t10, l1t11, l1t12, l1t13, l1t14, l1t15, l1t16, l1t17, l1t18, l1t19, l1t20, l1t21, l1t22, l1t23, l1t24, l1t25, l1t26, l1t27, l1t28, l1t29, l1t30]; // // prevent multiple starts if ((l1t1 getvariable ["lane_active",false])) exitWith {nul=["Sorry Lane 1 in Use","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf";}; l1t1 setvariable ["lane_active",true,true]; // So that the targets don't pop up by them selves. nopop = true; // Should be 0 but needs to be 1 to make the target count correct. _l1foo = 1; // Current Hit count. _l1hc = 0; // Number of targets in the variable... For randomness. _l1ntargets = count _l1targets; // Script {_x removealleventHandlers "Hit"; _x addEventHandler ["Hit", { (_this select 0) animate["terc", 1];}];_x animate["terc",1]} forEach _l1targets; nul=["Lane 1 Rifle Range Starting in 5...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 4...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 3...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 2...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Starting in 1...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 1; nul=["Lane 1 Rifle Range Active...","side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; while {_l1foo<21} do { _l1rnumber = random _l1ntargets-1; _l1rtarget = _l1targets select _l1rnumber; _l1rtarget animate["terc", 0]; sleep 3; if (_l1rtarget animationPhase "terc" > 0.1) then { _l1hc = _l1hc+1; }; _l1rtarget animate["terc", 1]; _l1foo = _l1foo + 1; sleep random 5; }; nul=[format["Lane 1 Firing Range Inactive... Final Score: %1/20.", _l1hc],"side",rangeofficer] execVM "20thSFG Scripts\mp_chat.sqf"; sleep 3; // Reset the targets. {_x animate["terc",0]} forEach _l1targets; // Deactivate lane If none of that works then you'll need someone who is better at MP scripting than I'm as my knowledge is almost zero on that. Share this post Link to post Share on other sites
OberSchutze 19 Posted April 15, 2014 I am using addaction on a ranger master dude. It worked fine when I hosted the mission MP on my gaming computer, but when I put it on my dedicated is when the issues started. Share this post Link to post Share on other sites
f2k sel 164 Posted April 15, 2014 (edited) Yea that happens quite a bit with scripts, it will need someone with MP experience which is beyond me I'm afraid. I'd also like to know the answer myself. It may help if you upload the whole mission so if someone does want to try and sort it they won't have to labour trying to set every thing up from scratch. Have a read of this and see if it helps (Icemans examples) http://forums.bistudio.com/showthread.php?171342-Making-hints-pop-up-only-for-certain-slots-in-multiplayer&highlight=dedicated try placing you main code between {} if (isDedicated || {isServer}) then { //yourcode goes here }; or if (!isDedicated) then { //yourcode goes here }; I really am only guessing Edited April 15, 2014 by F2k Sel Share this post Link to post Share on other sites