HazJ 1289 Posted February 12, 2014 // Author: Dirty Haz if (!isServer) exitWith {}; #include "Functions.sqf" sleep 2; _unit = _this select 0; _cntBlufor = 0; _cntOpfor = 0; { _cntBlufor = _cntBlufor + ({side _x == west} count crew _x); _cntOpfor = _cntOpfor + ({side _x == east} count crew _x); } forEach list Camp1; switch (!end) do { case (side _unit == west && _unit in list Camp1 || vehicle _unit in list Camp1 && _cntBlufor != _cntOpfor && _cntBlufor > _cntOpfor) : { Neutralized1 = false; publicVariable "Neutralized1"; OpforCamp1 = false; publicVariable "OpforCamp1"; if !(BluforCamp1) then { [["Camp 1 captured by Blufor troops."], "func_systemChat", nil, false] spawn BIS_fnc_MP; [["Camp 1", "ColorBlufor"], "func_setMarkerColour", nil, true] spawn BIS_fnc_MP; }; BluforCamp1 = true; publicVariable "BluforCamp1"; sleep 60; ticketsBlufor = ticketsBlufor + bluforTicketsToAdd; publicVariable "ticketsBlufor"; }; case (side _unit == east && _unit in list Camp1 || vehicle _unit in list Camp1 && _cntOpfor != _cntBlufor && _cntOpfor > _cntBlufor) : { Neutralized1 = false; publicVariable "Neutralized1"; BluforCamp1 = false; publicVariable "BluforCamp1"; if !(OpforCamp1) then { [["Camp 1 captured by Opfor troops."], "func_systemChat", nil, false] spawn BIS_fnc_MP; [["Camp 1", "ColorOpfor"], "func_setMarkerColour", nil, true] spawn BIS_fnc_MP; }; OpforCamp1 = true; publicVariable "OpforCamp1"; sleep 60; ticketsOpfor = ticketsOpfor + opforTicketsToAdd; publicVariable "ticketsOpfor"; }; case (_cntBlufor != 0 && _cntOpfor != 0 && _cntBlufor == _cntOpfor) : { if !(Neutralized1) then { [["Camp 1 is now neutralized and frozen."], "func_systemChat", nil, false] spawn BIS_fnc_MP; [["Camp 1", "ColorWhite"], "func_setMarkerColour", nil, true] spawn BIS_fnc_MP; }; BluforCamp1 = false; publicVariable "BluforCamp1"; OpforCamp1 = false; publicVariable "OpforCamp1"; Neutralized1 = true; publicVariable "Neutralized1"; sleep 30; ticketsBlufor = ticketsBlufor - bluforTicketsToRemove; publicVariable "ticketsBlufor"; ticketsOpfor = ticketsOpfor - opforTicketsToRemove; publicVariable "ticketsOpfor"; }; default {}; }; sleep 2; [_unit] spawn {sleep 2; _unit = _this select 0; nul = [_unit] execVM "Camp1.sqf";}; This seems to break after some time, not sure why. No errors in .rpt but while sometimes testing in editor I get an "Type bool, expected array" error but not sure for what exactly... Any help is much appreciated. Dirty Haz Share this post Link to post Share on other sites
IndeedPete 1038 Posted February 13, 2014 Does it say in which line the error occurs? And could you also post the "functions.sqf" you include? Share this post Link to post Share on other sites
HazJ 1289 Posted February 13, 2014 No error in .rpt, just in the editor at the top of screen. // Author: Dirty Haz func_createMarker = { _mName = _this select 0; _mPos = getMarkerPos (_this select 1); _mText = _this select 2; _mSize1 = _this select 3; _mSize2 = _this select 4; _mDir = _this select 5; _mType = _this select 6; _mShape = _this select 7; _mBrush = _this select 8; _mColour = _this select 9; _mAlpha = _this select 10; _m = createMarker [_mName, _mPos]; _m setMarkerText _mText; _m setMarkerSize [_mSize1, _mSize2]; _m setMarkerDir _mDir; _m setMarkerType _mType; _m setMarkerShape _mShape; _m setMarkerBrush _mBrush; _m setMarkerColor _mColour; _m setMarkerAlpha _mAlpha; }; func_createMarkerP = { _mName = _this select 0; _mPos = getPos (_this select 1); _mText = _this select 2; _mSize1 = _this select 3; _mSize2 = _this select 4; _mDir = _this select 5; _mType = _this select 6; _mShape = _this select 7; _mBrush = _this select 8; _mColour = _this select 9; _mAlpha = _this select 10; _m = createMarker [_mName, _mPos]; _m setMarkerText _mText; _m setMarkerSize [_mSize1, _mSize2]; _m setMarkerDir _mDir; _m setMarkerType _mType; _m setMarkerShape _mShape; _m setMarkerBrush _mBrush; _m setMarkerColor _mColour; _m setMarkerAlpha _mAlpha; }; func_createAssetMarker = { _mName = _this select 0; _mPos = getPos (_this select 1); _mText = _this select 2; _mType = _this select 3; _mColour = _this select 4; _m = createMarker [_mName, _mPos]; _m setMarkerText _mText; _m setMarkerSize [1, 1]; _m setMarkerDir 0; _m setMarkerType _mType; _m setMarkerShape "ICON"; _m setMarkerBrush "SOLID"; _m setMarkerColor _mColour; _m setMarkerAlpha 1; }; func_setMarkerColour = { _mName = _this select 0; _mColour = _this select 1; _mName setMarkerColor _mColour; }; func_createTask = { _id = _this select 0; _text1 = _this select 1; _text2 = _this select 2; _text3 = _this select 3; _marker = _this select 4; [ player, _id, [ _text1, _text2, _text3 ], markerPos _marker, true ] call BIS_fnc_taskCreate; {sleep 0.5; [_id] call BIS_fnc_taskSetCurrent;} forEach allUnits; }; func_setTaskState = { _id = _this select 0; _state = _this select 1; [ _id, _state, false, true ] call BIS_fnc_taskSetState; sleep 0.5; _id = true; }; func_sideChatC = { _who = _this select 0; _message = _this select 1; _who sideChat _message; }; func_sideChatS = { _who = _this select 0; _message = _this select 1; HQ = [_who, "HQ"]; HQ sideChat _message; }; func_globalChatC = { _who = _this select 0; _message = _this select 1; _who globalChat _message; }; func_globalChatS = { _who = _this select 0; _message = _this select 1; _who globalChat _message; }; func_systemChat = { _message = _this select 0; systemChat _message; }; func_hintFormatS = { _message = _this select 0; _something = _this select 1; hint format [_message, _something]; }; Dirty Haz Share this post Link to post Share on other sites
IndeedPete 1038 Posted February 13, 2014 Hm, even in an editor error it should give you the exact line and script of the origin. Share this post Link to post Share on other sites
HazJ 1289 Posted February 13, 2014 Error: http://s26.postimg.org/igfcal46x/Error.jpg Dirty Haz Share this post Link to post Share on other sites
brians200 51 Posted February 13, 2014 Are you using this? https://community.bistudio.com/wiki/preprocessFileLineNumbers That should make the rpt tell you what line it is on Share this post Link to post Share on other sites
HazJ 1289 Posted February 13, 2014 (edited) No, I will try it. Thanks. Dirty Haz ---------- Post added at 04:55 PM ---------- Previous post was at 04:11 PM ---------- Thanks. I used compile with call instead and fixed all errors however I had to make use of player instead of _unit therefore this won't work for AIs now. Any idea how to make it work again for them? Any help is much appreciated. Dirty Haz Edit: Think I have sorted this now. Thanks for all your help, I will post back here if I haven't sorted it. Dirty Haz Edited February 13, 2014 by Dirty Haz Updated Share this post Link to post Share on other sites
HazJ 1289 Posted February 13, 2014 // Author: Dirty Haz if (!isServer) exitWith {}; #include "Functions.sqf" _unit = _this select 0; _cntBlufor = 0; _cntOpfor = 0; { _cntBlufor = _cntBlufor + ({side _x == west} count crew _x); _cntOpfor = _cntOpfor + ({side _x == east} count crew _x); } forEach list Camp1; switch (!end) do { case (side _unit == west && _unit in list Camp1 || vehicle _unit in list Camp1 && _cntBlufor >= _cntOpfor) : { Neutralized1 = false; publicVariable "Neutralized1"; OpforCamp1 = false; publicVariable "OpforCamp1"; if (!Neutralized1 && !BluforCamp1) then { [["Camp 1 captured by Blufor troops."], "func_systemChat", nil, false] spawn BIS_fnc_MP; globalNotification = ["C1_B", nil]; publicVariable "globalNotification"; [["Camp 1", "ColorWEST"], "func_setMarkerColour", nil, true] spawn BIS_fnc_MP; }; BluforCamp1 = true; publicVariable "BluforCamp1"; [] spawn { sleep 60; ticketsBlufor = ticketsBlufor + bluforTicketsToAdd; publicVariable "ticketsBlufor"; }; }; case (side _unit == east && _unit in list Camp1 || vehicle _unit in list Camp1 && _cntOpfor >= _cntBlufor) : { Neutralized1 = false; publicVariable "Neutralized1"; BluforCamp1 = false; publicVariable "BluforCamp1"; if (!Neutralized1 && !OpforCamp1) then { [["Camp 1 captured by Opfor troops."], "func_systemChat", nil, false] spawn BIS_fnc_MP; globalNotification = ["C1_O", nil]; publicVariable "globalNotification"; [["Camp 1", "ColorEAST"], "func_setMarkerColour", nil, true] spawn BIS_fnc_MP; }; OpforCamp1 = true; publicVariable "OpforCamp1"; [] spawn { sleep 60; ticketsOpfor = ticketsOpfor + opforTicketsToAdd; publicVariable "ticketsOpfor"; }; }; case (_cntBlufor != 0 && _cntOpfor != 0 && _cntBlufor == _cntOpfor) : { BluforCamp1 = false; publicVariable "BluforCamp1"; OpforCamp1 = false; publicVariable "OpforCamp1"; if (!Neutralized1 && !BluforCamp1 && !OpforCamp1) then { [["Camp 1 is now neutralized and frozen."], "func_systemChat", nil, false] spawn BIS_fnc_MP; globalNotification = ["C1_N", nil]; publicVariable "globalNotification"; [["Camp 1", "ColorWhite"], "func_setMarkerColour", nil, true] spawn BIS_fnc_MP; }; Neutralized1 = true; publicVariable "Neutralized1"; [] spawn { sleep 30; ticketsBlufor = ticketsBlufor - bluforTicketsToRemove; publicVariable "ticketsBlufor"; ticketsOpfor = ticketsOpfor - opforTicketsToRemove; publicVariable "ticketsOpfor"; }; }; default {}; }; [_unit] spawn {sleep 2; _unit = _this select 0; nul = [_unit] execVM "Camp1.sqf";}; Does anyone know how to stop the messages spamming (without removing them :D) when a player/AI from both sides are in the camp together? Any help is much appreciated. Dirty Haz Share this post Link to post Share on other sites
brians200 51 Posted February 14, 2014 Create a hasBroadcasted variable and set it to false initially. Then check this before messaging everybody. If it is false, go ahead and message everybody, then set it to true. Once the state of this camp has changed, set that variable to false, so it will message again. Share this post Link to post Share on other sites
HazJ 1289 Posted February 14, 2014 I thought I have done this already... With Neutralized1, BluforCamp1 and OpforCamp1? Dirty Haz Share this post Link to post Share on other sites