gokitty1199 225 Posted July 31, 2018 in my mission i have 2 sides, blufor/opfor and they each have their own base and map markers to show themselves on the map via this Spoiler while {!_mapOpen} do { if (visibleMap) then { _mapOpen = true; _marker = name _unit; _mrk = createMarkerLocal [_marker, position _unit]; _marker setMarkerColorLocal ([side _unit, true] call BIS_fnc_sideColor); _marker setMarkerShapeLocal "ICON"; _marker setMarkerTypeLocal "mil_dot"; _marker setMarkerTextLocal "Me"; while {_mapOpen} do { _marker setMarkerPosLocal position _unit; if !(visibleMap) then {_mapOpen = false}; }; }; sleep 0.1; }; but randomly when testing with a friend my marker color went to yellow, and so did the area that i captured(i also have it going by BIS_fnc_sideColor). it also wouldnt let me teleport back to the marker with an addaction that has a side check. it makes no sense why this happened. i have allowDamage set to false and am using a handleDamage EH to detect hits but nothing to cause changing sides anywhere. _unit addAction ["Return to base", { _unit = (_this select 0); _unit setVariable ["isHit", false, true]; switch ((side _unit)) do { case WEST: {_unit setPos getMarkerPos "bluforBase";}; case EAST: {_unit setPos getMarkerPos "opforBase";}; }; removeAllActions _unit; }]; Share this post Link to post Share on other sites
HazJ 1289 Posted July 31, 2018 Hmm. Just to make sure, you aren't killing each other are you (rating)? This will alter the side of the unit and same for captive state. Also, why do you have two while loops? Not needed. 1 Share this post Link to post Share on other sites
gokitty1199 225 Posted July 31, 2018 7 minutes ago, HazJ said: Hmm. Just to make sure, you aren't killing each other are you (rating)? This will alter the side of the unit and same for captive state. Also, why do you have two while loops? Not needed. no killing, just detecting hits and then going from there and no captive states either. the first loop is to detect if the player has the map open, if he does have the map open then it creates a marker and jumps into the second loop which keeps updating the markers position until the player closes the map. Share this post Link to post Share on other sites
HazJ 1289 Posted July 31, 2018 No idea, that is odd. Are there any other scripts running? You can use an if statement inside the first while loop. Maybe share a basic example mission? Share this post Link to post Share on other sites
gokitty1199 225 Posted July 31, 2018 ill share some things heres the handleDamage eh Spoiler _unit addEventHandler ["handleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_shooter"]; _hit = _unit getVariable ["isHit", false]; if !((side _unit) isEqualTo (side _shooter)) then { if (!_hit && isPlayer _shooter) then { _unit setVariable ["isHit", true, true]; [_unit, _shooter] spawn BUF_fnc_takenHit; }; }; }]; takenHit function Spoiler params ["_unit", "_shooter"]; serverAward = ["kill", _shooter]; publicVariableServer "serverAward"; _unit addAction ["Return to base", { _unit = (_this select 0); _unit setVariable ["isHit", false, true]; switch ((side _unit)) do { case WEST: {_unit setPos getMarkerPos "bluforBase";}; case EAST: {_unit setPos getMarkerPos "opforBase";}; }; removeAllActions _unit; }]; _hit = _unit getVariable ["isHit", false]; while {_hit} do { _hit = _unit getVariable ["isHit", false]; _h = _unit action ["SwitchWeapon", _unit, _unit, 100]; sleep 1; }; serverAward public event handler Spoiler "serverAward" addPublicVariableEventHandler { (_this select 1) params ["_type", "_unit"]; _id = owner _unit; switch (_type) do { case "flag": {gotAward = 100; _id publicVariableClient "gotAward";}; case "kill": { gotAward = 10; _id publicVariableClient "gotAward"; switch ((side _unit)) do { case WEST: {opforTickets = opforTickets - 1}; case EAST: {bluforTickets = bluforTickets - 1}; }; }; }; }; gotAward doesnt do anything but increment a variable, heres the flag capture. Spoiler { (_x) params ["_flag", "_marker"]; _flag setVariable ["marker", _marker, true]; _flag setVariable ["holdSide", CIVILIAN, true]; [ _flag, "Capture", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_this distance _target < 1.7 AND _target getVariable ['holdSide', CIVILIAN] != side _this AND _this getVariable ['isHit', false] isEqualTo false", "_this distance _target < 1.7", {}, {}, { _target = (_this select 0); _unit = (_this select 1); _target setVariable ["holdSide", (side _unit), true]; [_target getVariable ["marker", ""], _unit] call BUF_fnc_zoneCaptured }, {}, [], 10, 0, false, false ] remoteExec ["BIS_fnc_holdActionAdd", 0, _flag]; } forEach _arry; the issue happened randomly, i had captured and shot my friend a few times as well as being shot, then it just randomly happened. Share this post Link to post Share on other sites
HazJ 1289 Posted July 31, 2018 "_this distance _target < 1.7 AND _target getVariable ['holdSide', CIVILIAN] != side _this AND _this getVariable ['isHit', false] isEqualTo false", If I had to guess... isHit is defaulting to civilian side? Is it set before hand or no? Share this post Link to post Share on other sites
gokitty1199 225 Posted July 31, 2018 6 minutes ago, HazJ said: "_this distance _target < 1.7 AND _target getVariable ['holdSide', CIVILIAN] != side _this AND _this getVariable ['isHit', false] isEqualTo false", If I had to guess... isHit is defaulting to civilian side? Is it set before hand or no? isHit is set to the unit when they load into the mission beforehand and is set to false by default. isHit only toggles when the player is hit by a bullet, once he is hit then it changes to true until the player hits the addAction to return to base where isHit is set to false. Share this post Link to post Share on other sites
HazJ 1289 Posted July 31, 2018 @gokitty1199 My bad, I meant holdSide lol. _target getVariable ['holdSide', CIVILIAN] _target setVariable ["holdSide", (side _unit), true]; Just check the actual output of the variable. Share this post Link to post Share on other sites
gokitty1199 225 Posted July 31, 2018 49 minutes ago, HazJ said: @gokitty1199 My bad, I meant holdSide lol. _target getVariable ['holdSide', CIVILIAN] _target setVariable ["holdSide", (side _unit), true]; Just check the actual output of the variable. the holdSide variable is only on the flags, not the unit as its just used as a comparison for the action conditions. i need to be able to reproduce this issue with the debugger on so i can see because yellow is just an object isnt it? purple is civ and green is indi and so on. Share this post Link to post Share on other sites
HazJ 1289 Posted July 31, 2018 Are you able to provide a short example mission to reproduce? Share this post Link to post Share on other sites
gokitty1199 225 Posted July 31, 2018 8 minutes ago, HazJ said: Are you able to provide a short example mission to reproduce? not reliably for testing as it requires my mod. its a no limit mission right now thats just free to do what you want for as long as you want, ive played it before for about 40 minutes without that issue happening, then i played it again for 20 minutes and it happened, and another time i played for awhile and it didnt happen so idk yet. ill have the debug console on for the mission next time my friend want to play incase it happens to see what it returns Share this post Link to post Share on other sites
HazJ 1289 Posted July 31, 2018 When testing, what are you doing? Are there vehicles, units, weapons, etc? Are any of you destroying assets at all as this will affect your rating? Also, add a ton of debug outputs using systemChat in all files. You can also use onEachFrame with hintSilent to see exactly when it changes your side. Just take note of what you were doing at the time. Etc... Sorry I can't be more help at this point, I would need more info... Share this post Link to post Share on other sites
gokitty1199 225 Posted July 31, 2018 48 minutes ago, HazJ said: When testing, what are you doing? Are there vehicles, units, weapons, etc? Are any of you destroying assets at all as this will affect your rating? Also, add a ton of debug outputs using systemChat in all files. You can also use onEachFrame with hintSilent to see exactly when it changes your side. Just take note of what you were doing at the time. Etc... Sorry I can't be more help at this point, I would need more info... nope thats the strange part, literally nothing is getting destroyed and nothing killed lol. thats alright ill find it eventually, thanks for the help Share this post Link to post Share on other sites