curtcooll 1 Posted March 16, 2013 I've been editing tee times warfare for my game mode just for the use of the shops and money system great so far only issue is that due to my game mode mostly being 1v1 with ai team, I'm trying to get it so that you get money the same as killing a player but for ai, I've tried going through code to find exactly what i need to do to account for ai team killing and enemy killing. /* Script written by TeeTime dont remove this comment */ //Functions //Debug Tee_Debug_Spawn = { //[] spawn Tee_Player_TK_Punish; /* _mags = magazines player; player groupchat str _mags; diag_log str _mags; */ //call Tee_Base_Set_Base; //call Tee_AttackTown; //_marker = createMarker ["Test", getPos player]; //[] call Tee_CreateTownMarker; // ServicePoint Building : Military Cargo House V1 (Land_Cargo_House_V1_F) // Baracks : Military Cargo HQ V1 (Land_Cargo_HQ_V1_F) // ComandPost : Military Cargo OP V1 (Land_Cargo_Patrol_V1_F)!?! nicht sicher _veh = createVehicle ["Land_Cargo_HQ_V1_F",getPos player,[],0,""]; }; Tee_Debug_Spawn_Weapon = { //[base_1,base_2] call Tee_Marker_ConnectMarker; //[base_2,base_4] call Tee_Marker_ConnectMarker; //[player] call Tee_Town_CreateAIDef; //_mags = weapons player; //player groupchat str _mags; //diag_log str _mags; //player addMagazine "30Rnd_65x39_caseless_green"; //player addWeapon "arifle_Khaybar_ACO_point_F"; }; Tee_Debug_Teleport = { onMapSingleClick "player setPos _pos;"; }; //**************************************** //Basic //**************************************** Tee_Init_Client = { if(playerside == west) then { TW_playerside = "west"; TW_playerside_colour = "ColorBlue";}; if(playerside == east) then { TW_playerside = "east"; TW_playerside_colour = "ColorRed";}; //if(player in TW_westplayer_array) then { TW_playerside = "west"; TW_playerside_colour = "ColorBlue";}; //For Later //if(player in TW_eastplayer_array) then { TW_playerside = "east"; TW_playerside_colour = "ColorRed";}; //For Later player addEventHandler ["killed", "_this call Tee_Player_Killed;"]; "TW_Vote_Start" addPublicVariableEventHandler {[] spawn Tee_Vote_Started;}; "TW_Player_Killed" addPublicVariableEventHandler {TW_Player_Killed call Tee_Player_Killed_Pub;}; "TW_Town_Taken" addPublicVariableEventHandler {TW_Town_Taken call Tee_Town_Caputred_2;}; "TW_Mission_End" addPublicVariableEventHandler { if(TW_restart) then { [] spawn Tee_Client_Restart; } else { endMission "END1"; }; }; }; Tee_Client_Restart = { titleText["Mission ended and will be restarted in 15 seconds.", "PLAIN DOWN"]; //Msg sleep 15; Tee_Konto = 1000; [] spawn Tee_Client_Base_Build_West; //TeeTimeTest [] spawn Tee_Client_Base_Build_East; //TeeTimeTest titleText["Mission Restarted", "PLAIN DOWN"]; //Msg TW_Mission_End = false; }; //******************************* //Voting //******************************* /* Called by player who init the Vote */ Tee_Vote_Start = { private ["_kind","_text","_result","_return"]; _kind = _this select 0; //What kind of Vote is it can be "HQ", //Check and activate Vote if(TW_Voting) exitWith {titleText ["Please wait there is already a active Voting.", "PLAIN DOWN"];}; //Msg TW_Voting = true; //Reset _return = false; TW_Vote_Result = _return; //Own Vote TW_Vote_Votes = [1,0]; publicVariable "TW_Vote_Votes"; TW_Vote_Start = [TW_playerside,_kind,name player]; publicVariable "TW_Vote_Start"; _text = format ["You started a vote. The Team has now %1 Seconds to vote.",TW_Vote_Time]; titleText [_text, "PLAIN DOWN"]; //Msg if(debug) then {TW_Vote_Start spawn Tee_Vote_Started;}; sleep TW_Vote_Time; _text = format ["Voting ended. Resulst: %1 Yes %2 No",TW_Vote_Votes select 0,TW_Vote_Votes select 1]; titleText[_text, "PLAIN DOWN"]; //Msg _return = if((TW_Vote_Votes select 0) > (TW_Vote_Votes select 1)) then {true} else {false}; TW_Vote_Result = _return; TW_Voting = false; }; /* Called on all players */ Tee_Vote_Started = { private ["_side","_kind","_name","_text","_actioncode","_action","_actionarray"]; _side = _this select 0; //Side who is allowed to vote _kind = _this select 1; //What kind of Vote is it _name = _this select 2; if(_side != TW_playerside) exitWith {}; if(TW_Voting) exitWith {}; TW_Voting = true; if(_kind == "HQ") then { _text = format ["%1 wants to mobilize the HQ. Please vote!",_name]; }; titleText [_text, "PLAIN DOWN"]; //Msg _text = "Vote Yes"; _actioncode = format ["[%1] call Tee_Vote_Vote;",true]; _action = player addAction [_text, AddActionCode,_actioncode]; TW_Vote_Actions = TW_Vote_Actions + [_action]; _text = "Vote No"; _actioncode = format ["[%1] call Tee_Vote_Vote;",false]; _action = player addAction [_text, AddActionCode,_actioncode]; TW_Vote_Actions = TW_Vote_Actions + [_action]; }; /* Vote */ Tee_Vote_Vote = { if(_this select 0) then { TW_Vote_Votes = [(TW_Vote_Votes select 0) + 1,(TW_Vote_Votes select 1)]; } else { TW_Vote_Votes = [(TW_Vote_Votes select 0),(TW_Vote_Votes select 1) + 1]; }; publicVariable "TW_Vote_Votes"; { player removeAction _x; } forEach TW_Vote_Actions; TW_Voting = false; TW_Vote_Actions = []; }; //******************************* //Player //******************************* Tee_SetPlayer = { waitUntil {HQ_placed}; waitUntil {TW_HQ_Placed_Client}; waitUntil {alive player}; if(TW_playerside == "west") then {player setPos (getMarkerPos TW_West_Respawn);}; if(TW_playerside == "east") then {player setPos (getMarkerPos TW_East_Respawn);}; //check sleep 2; if(TW_playerside == "west" && player distance hq_west > 10) then {player setPos (getMarkerPos TW_West_Respawn);}; if(TW_playerside == "east" && player distance hq_east > 10) then {player setPos (getMarkerPos TW_East_Respawn);}; //Make sure that leader is a player muss für player squads angepasst werden TeeTimeTest if(! isPlayer(leader (group (vehicle player)))) then { group player selectLeader player; }; //Welcome Msg sleep 20; titleText["Welcome to TeeTimes Warfare - ALPHA", "PLAIN DOWN"]; //Msg sleep 5; titleText["I hope that you wil enjoy this mission and Arma III. Have in mind its only Alpha!", "PLAIN DOWN"]; //Msg sleep 5; titleText["Here some Tipps:", "PLAIN DOWN"]; //Msg sleep 5; titleText["1. Caputure all Cities to win this mission!", "PLAIN DOWN"]; //Msg sleep 5; titleText["2. The Boxes in your base contain different shops for AI, Vehicle and Weapons.", "PLAIN DOWN"]; //Msg sleep 5; titleText["3. Increase your Income by holding more Cities.", "PLAIN DOWN"]; //Msg sleep 5; titleText["4. Dont Spawncamp the enemy Base!", "PLAIN DOWN"]; //Msg sleep 5; titleText["5. Use AI to capture Towns faster.", "PLAIN DOWN"]; //Msg sleep 5; titleText["6. Use i to open the bought ammo boxes.", "PLAIN DOWN"]; //Msg sleep 5; titleText["Good Luke and Have Fun", "PLAIN DOWN"]; //Msg }; //Called on killed Client Tee_Player_Killed = { private ["_victim","_killer","_side","_pos"]; _victim = _this select 0; _killer = _this select 1; _side = playerSide; //TeeTimeTest kann im Moment nur auf Clients ausgeführt werden! _pos = getPos _victim; if(isPlayer _killer) then { TW_Player_Killed = [_victim,_killer,_side,_pos]; publicVariable "TW_Player_Killed"; }; //For selfhosted Missions if(isServer && isPlayer _killer) then { _this call Tee_Player_Killed_Pub; }; }; //Called on all Clients Tee_Player_Killed_Pub = { private ["_victim","_killer","_side","_text"]; _victim = _this select 0; _killer = _this select 1; _side = _this select 2; //Bonus if(player == _killer && playerside != _side) then { Tee_Konto = Tee_Konto + Tee_Money_Kill_Bonus; player groupchat format ["You got %1$ for killing %2.",Tee_Money_Kill_Bonus,(name _victim)]; //Msg }; //Punish if(player == _killer && playerside == _side) then { //Punish Tee_Money_TK_Punish call Tee_Money_Substract; _text = format ["You killed a Teammember and lost %1$",Tee_Money_TK_Punish]; titleText[_text, "PLAIN DOWN"]; //Msg //HQ if((player distance hq_west < 20 && TW_playerside == "west") or (player distance hq_east < 20 && TW_playerside == "east")) then { player setDamage 1; titleText["You killed a Teammember near the Base and got killed for this.", "PLAIN DOWN"]; //Msg }; //Kick TW_TK_Counter = TW_TK_Counter + 1; if(TW_TK_Counter >= 3) then { [] spawn Tee_Player_TK_Punish; TW_TK_Counter = 0; TW_Player_Kick = getPlayerUID player; publicVariable "TW_Player_Kick"; }; }; }; //Punish Player for TK Tee_Player_TK_Punish = { private ["_i","_pos"]; _pos = getPos player; titleText["You killed to many Teammates and have to stay here for 5 minutes!", "PLAIN DOWN"]; //Msg for [{_i=0},{_i<300},{_i=_i+30}] do { player setPos [0,0,5]; titleText["Dont TK! First look then shoot!", "PLAIN DOWN"]; //Msg sleep 30; }; player setPos _pos; }; //******************************************* //Money //******************************************* Tee_ShowMoney = { hintSilent format ["Your Account: %1$",Tee_Konto]; //Msg }; Tee_Money_Substract = { if(Tee_Konto > _this) then { Tee_Konto = Tee_Konto - _this; } else { Tee_Konto = 0; }; }; Tee_MoneyLoop = { private ["_i","_count","_enemycount"]; while{true} do { sleep 60; _count = 0; _enemycount = 0; //Basic Tee_Konto = Tee_Konto + Tee_Money_Min; //Towns { _object = _x select 0; if(TW_playerside == _object getVariable "TownSide") then { Tee_Konto = Tee_Konto + Tee_Money_Town; _count = _count + 1; } else { if("civ" != _object getVariable "TownSide") then { _enemycount = _enemycount + 1; }; }; } forEach TW_TownArray; //TK Counter Reduce if(_i >= 10) then { TW_TK_Counter = TW_TK_Counter - 1; _i = 0; }; //End Mission Loser if(_enemycount == count TW_TownArray && !TW_Mission_End) exitWith { TW_Mission_End = true; publicVariable "TW_Mission_End"; }; //End Mission Winner if(_count == count TW_TownArray && !TW_Mission_End) exitWith { TW_Mission_End = true; publicVariable "TW_Mission_End"; }; _i = _i + 1; }; }; Tee_ActionLoop = { private ["_cursertarget","_veh","_invehicle","_action","_money_action","_lock_action","_lock_action2","_lock_action3","_lock_actionarray","_townaction","_money_action2","_town_actionarray","_neartown","_hq_action","_hq_actionarray","_veh_s_action","_veh_s_actionarray","_weap_action","_weap_actionarray","_ai_action","_ai_actionarray","_repairaction","_repairactionarray","_count","_object","_weap_typ","_text","_actioncode"]; _money_action = false; _lock_action = false; _lock_action3 = false; _townaction = false; _neartown = false; _hq_action = false; _veh_s_action = false; _weap_action = false; _ai_action = false; _repairaction = false; _town_actionarray = []; _hq_actionarray = []; _veh_s_actionarray = []; _weap_actionarray = []; _ai_actionarray = []; _repairactionarray = []; while{true} do { //Reset after Death and place Player if(! alive player) then { titleText["You died and will Respawn in 30 Seconds!", "PLAIN DOWN"]; //Msg _money_action = false; player removeAction _money_action2; waitUntil{alive player}; if(! isPlayer(leader (group (vehicle player)))) then { group player selectLeader player; }; if(TW_playerside == "west") then {player setPos (getMarkerPos TW_West_Respawn);}; if(TW_playerside == "east") then {player setPos (getMarkerPos TW_East_Respawn);}; }; //Check Vehicle if(player == vehicle player) then { _invehicle = false; _cursertarget = cursorTarget; } else { _veh = vehicle player; _invehicle = true; }; //Money if(!_money_action) then { _money_action2 = player addAction ["Show Money", AddActionCode,'[] call Tee_ShowMoney;']; _money_action = true; //Debug if(debug) then { player addAction ["Spawn Veh", AddActionCode,'[] call Tee_Debug_Spawn;']; player addAction ["Add Weapon", AddActionCode,'[] call Tee_Debug_Spawn_Weapon;']; player addAction ["Teleport", AddActionCode,'[] call Tee_Debug_Teleport;']; }; }; //Lock Unlock Vehicle if(!_invehicle && (_cursertarget in TW_Vehicle_Client) && (player distance _cursertarget < 5) && !_lock_action3) then { _text = "Lock/Unlock"; _actioncode = format ["[%1] call Tee_Vehicle_Lock;",_cursertarget]; _action = player addAction [_text, AddActionCode,_actioncode]; _lock_actionarray = _lock_actionarray + [_action]; _lock_action3 = true; }; if(!_lock_action && ((player distance _cursertarget > 5) || !(_cursertarget in TW_Vehicle_Client) || _invehicle)) then { { player removeAction _x; } forEach _lock_actionarray; _lock_actionarray = []; _lock_action3 = false; }; //Unlock Action for Player in Vehicles if(_invehicle && !_lock_action) then { //Action _text = "Lock/Unlock"; _actioncode = format ["[%1] call Tee_Vehicle_Lock;",_veh]; _lock_action2 = player addAction [_text, AddActionCode,_actioncode]; _lock_action = true; }; if(!_invehicle && _lock_action) then { player removeAction _lock_action2; _lock_action = false; }; //Townshops if(!_townaction) then { { _object = _x select 0; if(player distance _object < 5 && TW_playerside == _object getVariable "TownSide") then { if(!_invehicle) then { { _text = format ["Buy %1 (%2$)",_x call Tee_GetVeh_Name,_x call Tee_GetVeh_Price]; _actioncode = format ["[%1] call Tee_CreateVehicle;",_x]; _action = player addAction [_text, AddActionCode,_actioncode]; _town_actionarray = _town_actionarray + [_action]; } forEach TW_Vehicle_Shop_Town; } else { //Repair _text = format ["Repair your Vehicle (%1$)",TW_Repair_Cost]; _actioncode = format ["[] spawn Tee_Sup_Repair;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _town_actionarray = _town_actionarray + [_action]; //Refuel _text = format ["Refuel your Vehicle (%1$)",TW_Sup_Fuel_Cost]; _actioncode = format ["[] spawn Tee_Sup_Refuel;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _town_actionarray = _town_actionarray + [_action]; }; _townaction = true; }; } forEach TW_TownArray; } else { { _object = _x select 0; if(player distance _object < 5) then { _neartown = true; } else { _neartown = false; }; } forEach TW_TownArray; if(!_neartown && _townaction) then { { player removeAction _x; } forEach _town_actionarray; _town_actionarray = []; _townaction = false; }; }; //West HQ if((player distance hq_west) < 4 && !_invehicle && !(alive driver hq_west)) then { if(TW_playerside == "west" && !_hq_action) then { //Actions _text = format ["Mobilize HQ"]; _actioncode = format ["[%1] spawn Tee_Client_Base_DeMobHQ;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _hq_actionarray = _hq_actionarray + [_action]; _hq_action = true; }; } else { if(_hq_action && TW_playerside == "west") then { { player removeAction _x; } forEach _hq_actionarray; _hq_actionarray = []; _hq_action = false; }; }; //WestHQ SetUp if(player == (driver hq_west)) then { //Actions _text = format ["Build HQ"]; _actioncode = format ["[%1] call Tee_Client_Base_HQ_setUp;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _hq_actionarray = _hq_actionarray + [_action]; _hq_action = true; }; //West Vehicle if((player distance west_shop_veh) < 4 && !_invehicle) then { if(TW_playerside == "west" && !_veh_s_action) then { titleText["Vehicle Shop", "PLAIN DOWN"]; //Msg //Actions { _text = format ["Buy %1 (%2$)",_x call Tee_GetVeh_Name,_x call Tee_GetVeh_Price]; _actioncode = format ["[%1] call Tee_CreateVehicle;",_x]; _action = player addAction [_text, AddActionCode,_actioncode]; _veh_s_actionarray = _veh_s_actionarray + [_action]; } forEach TW_Vehicle_Shop_West; _veh_s_action = true; }; } else { if(_veh_s_action && TW_playerside == "west") then { { player removeAction _x; } forEach _veh_s_actionarray; _veh_s_actionarray = []; _veh_s_action = false; }; }; //West Weapon if((player distance west_shop_weapons) < 4 && !_invehicle) then { if(TW_playerside == "west" && !_weap_action) then { titleText["Weapon Shop", "PLAIN DOWN"]; //Msg //Actions { if(TW_BoxShop) then { _text = format ["Buy %1 (%2$)",_x call Tee_GetVeh_Name,_x call Tee_GetVeh_Price]; _actioncode = format ["[%1] call Tee_CreateVehicle;",_x]; } else { _text = format ["Buy %1 (%2$)",_x call Tee_GetWeap_Name,_x call Tee_GetWeap_Price]; _weap_typ = _x call Tee_GetWeap_Typ; if(_weap_typ == "wep") then { _actioncode = format ["[%1] call Tee_AddWeapon;",_x]; }; if(_weap_typ == "mag") then { _actioncode = format ["[%1] call Tee_AddMag;",_x]; }; }; _action = player addAction [_text, AddActionCode,_actioncode]; _weap_actionarray = _weap_actionarray + [_action]; } forEach TW_Weapon_Shop_West; _weap_action = true; }; } else { if(_weap_action && TW_playerside == "west") then { { player removeAction _x; } forEach _weap_actionarray; _weap_actionarray = []; _weap_action = false; }; }; //West AI Shop if((player distance west_shop_ai) < 4 && !_invehicle) then { if(TW_playerside == "west" && !_ai_action) then { titleText["AI Shop", "PLAIN DOWN"]; //Msg //Actions { _text = format ["Buy %1 (%2$)",_x call Tee_GetUnit_Name,_x call Tee_GetUnit_Price]; _actioncode = format ["[%1] call Tee_BuyUnit;",_x]; _action = player addAction [_text, AddActionCode,_actioncode]; _ai_actionarray = _ai_actionarray + [_action]; } forEach TW_AI_Shop_West; _ai_action = true; }; } else { if(_ai_action && TW_playerside == "west") then { { player removeAction _x; } forEach _ai_actionarray; _ai_actionarray = []; _ai_action = false; }; }; //West Repair Station if((player distance hq_west) < 10 && _invehicle) then { if(TW_playerside == "west" && !_repairaction) then { //titleText["Repair Station", "PLAIN DOWN"]; //Msg //Repair _text = format ["Repair your Vehicle (%1$)",TW_Repair_Cost]; _actioncode = format ["[] spawn Tee_Sup_Repair;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _repairactionarray = _repairactionarray + [_action]; //Refuel _text = format ["Refuel your Vehicle (%1$)",TW_Sup_Fuel_Cost]; _actioncode = format ["[] spawn Tee_Sup_Refuel;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _repairactionarray = _repairactionarray + [_action]; //Reammo _text = format ["Reammo your Vehicle (%1$)",TW_Sup_Reammo_Cost]; _actioncode = format ["[] spawn Tee_Sup_Reammo;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _repairactionarray = _repairactionarray + [_action]; _repairaction = true; }; } else { if(_repairaction && TW_playerside == "west") then { { player removeAction _x; } forEach _repairactionarray; _repairactionarray = []; _repairaction = false; }; }; //******************* //East //******************* //East HQ if(player distance hq_east < 4 && !_invehicle && !(alive driver hq_east)) then { if(TW_playerside == "east" && !_hq_action) then { //Actions _text = format ["Mobilize HQ"]; _actioncode = format ["[%1] spawn Tee_Client_Base_DeMobHQ;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _hq_actionarray = _hq_actionarray + [_action]; _hq_action = true; }; } else { if(_hq_action && TW_playerside == "east") then { { player removeAction _x; } forEach _hq_actionarray; _hq_actionarray = []; _hq_action = false; }; }; //EastHQ SetUp if(player == driver hq_east) then { //Actions _text = format ["Build HQ"]; _actioncode = format ["[%1] call Tee_Client_Base_HQ_setUp;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _hq_actionarray = _hq_actionarray + [_action]; _hq_action = true; }; //East Vehicle Shop if(player distance east_shop_veh < 4 && !_invehicle) then { if(TW_playerside == "east" && !_veh_s_action) then { titleText["Vehicle Shop", "PLAIN DOWN"]; //Msg //Actions { _text = format ["Buy %1 (%2$)",_x call Tee_GetVeh_Name,_x call Tee_GetVeh_Price]; _actioncode = format ["[%1] call Tee_CreateVehicle;",_x]; _action = player addAction [_text, AddActionCode,_actioncode]; _veh_s_actionarray = _veh_s_actionarray + [_action]; } forEach TW_Vehicle_Shop_East; _veh_s_action = true; }; } else { if(_veh_s_action && TW_playerside == "east") then { { player removeAction _x; } forEach _veh_s_actionarray; _veh_s_action = false; _veh_s_actionarray = []; }; }; //East Weapon if((player distance east_shop_weapons) < 4 && !_invehicle) then { if(TW_playerside == "east" && !_weap_action) then { titleText["Weapon Shop", "PLAIN DOWN"]; //Msg //Actions { _text = format ["Buy %1 (%2$)",_x call Tee_GetWeap_Name,_x call Tee_GetWeap_Price]; _weap_typ = _x call Tee_GetWeap_Typ; if(_weap_typ == "wep") then { _actioncode = format ["[%1] call Tee_AddWeapon;",_x]; }; if(_weap_typ == "mag") then { _actioncode = format ["[%1] call Tee_AddMag;",_x]; }; _action = player addAction [_text, AddActionCode,_actioncode]; _weap_actionarray = _weap_actionarray + [_action]; } forEach TW_Weapon_Shop_East; _weap_action = true; }; } else { if(_weap_action && TW_playerside == "east") then { { player removeAction _x; } forEach _weap_actionarray; _weap_actionarray = []; _weap_action = false; }; }; //East AI Shop if((player distance east_shop_ai) < 4 && !_invehicle) then { if(TW_playerside == "east" && !_ai_action) then { titleText["AI Shop", "PLAIN DOWN"]; //Msg //Actions { _text = format ["Buy %1 (%2$)",_x call Tee_GetUnit_Name,_x call Tee_GetUnit_Price]; _actioncode = format ["[%1] call Tee_BuyUnit;",_x]; _action = player addAction [_text, AddActionCode,_actioncode]; _ai_actionarray = _ai_actionarray + [_action]; } forEach TW_AI_Shop_East; _ai_action = true; }; } else { if(_ai_action && TW_playerside == "east") then { { player removeAction _x; } forEach _ai_actionarray; _ai_actionarray = []; _ai_action = false; }; }; //East Repair Station if((player distance hq_east) < 10 && _invehicle) then { if(TW_playerside == "east" && !_repairaction) then { //titleText["Repair Station", "PLAIN DOWN"]; //Msg //Repair _text = format ["Repair your Vehicle (%1$)",TW_Repair_Cost]; _actioncode = format ["[] spawn Tee_Sup_Repair;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _repairactionarray = _repairactionarray + [_action]; //Refuel _text = format ["Refuel your Vehicle (%1$)",TW_Sup_Fuel_Cost]; _actioncode = format ["[] spawn Tee_Sup_Refuel;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _repairactionarray = _repairactionarray + [_action]; //Reammo _text = format ["Reammo your Vehicle (%1$)",TW_Sup_Reammo_Cost]; _actioncode = format ["[] spawn Tee_Sup_Reammo;"]; _action = player addAction [_text, AddActionCode,_actioncode]; _repairactionarray = _repairactionarray + [_action]; _repairaction = true; }; } else { if(_repairaction && TW_playerside == "east") then { { player removeAction _x; } forEach _repairactionarray; _repairactionarray = []; _repairaction = false; }; }; //End sleep 5; }; }; //****************************************** //Base //****************************************** Tee_Base_Create_Marker = { private ["_marker","_name"]; waitUntil {HQ_placed}; //West if(TW_playerside == "west") then { //Create Respawn _marker = CreateMarkerLocal [TW_West_Respawn, [((getPos west_shop_veh) select 0) + 5,((getPos west_shop_veh) select 1) -10,(getPos west_shop_veh) select 2]]; //TeeTimeTest Marker ist Lokal //HQ _marker = CreateMarkerLocal [TW_West_BaseMarker, position hq_west]; _marker setMarkerTypeLocal "flag_NATO"; //Shops //Vehicle //_name = format ["sh_m_%1_%2",floor(time),floor(random(1000))]; _marker = CreateMarkerLocal [TW_West_ShopMarker_V, getPos west_shop_veh]; _marker setMarkerShapeLocal "Icon"; _marker setMarkerTypeLocal "mil_dot"; _marker setMarkerTextLocal "Vehicle"; //Weapon //_name = format ["sh_m_%1_%2",floor(time),floor(random(1000))]; _marker = CreateMarkerLocal [TW_West_ShopMarker_G, getPos west_shop_weapons]; _marker setMarkerShapeLocal "Icon"; _marker setMarkerTypeLocal "mil_dot"; _marker setMarkerTextLocal "Armory"; //AI //_name = format ["sh_m_%1_%2",floor(time),floor(random(1000))]; _marker = CreateMarkerLocal [TW_West_ShopMarker_AI, getPos west_shop_ai]; _marker setMarkerShapeLocal "Icon"; _marker setMarkerTypeLocal "mil_dot"; _marker setMarkerTextLocal "Barracks"; }; //East if(TW_playerside == "east") then { //Create Respawn _marker = CreateMarkerLocal [TW_East_Respawn, [((getPos east_shop_veh) select 0) + 5,((getPos east_shop_veh) select 1) -10,(getPos east_shop_veh) select 2]]; //TeeTimeTest Marker ist Lokal _marker = CreateMarkerLocal [TW_East_BaseMarker, position hq_east]; _marker setMarkerTypeLocal "flag_Iran"; //Shops //Vehicle //_name = format ["sh_m_%1_%2",floor(time),floor(random(1000))]; _marker = CreateMarkerLocal [TW_East_ShopMarker_V, getPos east_shop_veh]; _marker setMarkerShapeLocal "Icon"; _marker setMarkerTypeLocal "mil_dot"; _marker setMarkerTextLocal "Vehicle"; //Weapon //_name = format ["sh_m_%1_%2",floor(time),floor(random(1000))]; _marker = CreateMarkerLocal [TW_East_ShopMarker_G, getPos east_shop_weapons]; _marker setMarkerShapeLocal "Icon"; _marker setMarkerTypeLocal "mil_dot"; _marker setMarkerTextLocal "Armory"; //AI //_name = format ["sh_m_%1_%2",floor(time),floor(random(1000))]; _marker = CreateMarkerLocal [TW_East_ShopMarker_AI, getPos east_shop_ai]; _marker setMarkerShapeLocal "Icon"; _marker setMarkerTypeLocal "mil_dot"; _marker setMarkerTextLocal "Barracks"; }; TW_HQ_Placed_Client = true; }; Tee_Client_Base_Build_West = { private ["_hq","_marker"]; _hq = hq_west; //Set Respawn TW_West_Respawn setMarkerPosLocal [((getPos west_shop_veh) select 0) + 5,((getPos west_shop_veh) select 1) - 10,(getPos west_shop_veh) select 2]; //TeeTimeTest Marker ist Lokal //Set Veh Spawn west_shop_veh setPosATL [(getPos _hq) select 0,((getPos _hq) select 1) + 10,(getPos _hq) select 2]; "west_vehspawn" setMarkerPos [((getPos _hq) select 0) - 10,((getPos _hq) select 1),(getPos _hq) select 2]; //Nicht genutzt //Set Weapon Shop west_shop_weapons setPosATL [(getPos _hq) select 0,((getPos _hq) select 1) + 5,(getPos _hq) select 2]; //Set AI Shop west_shop_ai setPosATL [(getPos _hq) select 0,((getPos _hq) select 1) - 5,(getPos _hq) select 2]; }; Tee_Client_Base_Build_East = { private ["_hq","_marker"]; _hq = hq_east; //Set Respawn TW_East_Respawn setMarkerPosLocal [((getPos east_shop_veh) select 0) + 5,((getPos east_shop_veh) select 1) - 10,(getPos east_shop_veh) select 2]; //TeeTimeTest Marker ist Lokal //Set Veh Spawn east_shop_veh setPosATL [(getPos _hq) select 0,((getPos _hq) select 1) + 10,(getPos _hq) select 2]; "east_vehspawn" setMarkerPos [((getPos _hq) select 0) - 10,((getPos _hq) select 1),(getPos _hq) select 2]; //Nicht genutzt //Set Weapon Shop east_shop_weapons setPosATL [(getPos _hq) select 0,((getPos _hq) select 1) + 5,(getPos _hq) select 2]; //Set AI Shop east_shop_ai setPosATL [(getPos _hq) select 0,((getPos _hq) select 1) - 5,(getPos _hq) select 2]; }; //Mobilze HQ Tee_Client_Base_DeMobHQ = { private ["_hq"]; if(TW_playerside == "west") then { _hq = hq_west; }; if(TW_playerside == "east") then { _hq = hq_east; }; //Start Voting ["HQ"] spawn Tee_Vote_Start; sleep (TW_Vote_Time + 2); if(!TW_Vote_Result) exitWith {}; //Exit if Voting failed //Mob HQ player moveInDriver _hq; _hq setFuel 1; _hq lock false; if(TW_playerside == "west") then { //[] spawn Tee_Client_Base_Build_West; }; if(TW_playerside == "east") then { //[] spawn Tee_Client_Base_Build_East; }; }; //Build HQ Tee_Client_Base_HQ_setUp = { private ["_hq"]; if(TW_playerside == "west") then { _hq = hq_west; }; if(TW_playerside == "east") then { _hq = hq_east; }; if(player != (driver _hq)) exitWith {}; //Set HQ _hq setDir 90; moveOut player; _hq setFuel 0; _hq lock true; if(TW_playerside == "west") then { [] spawn Tee_Client_Base_Build_West; }; if(TW_playerside == "east") then { [] spawn Tee_Client_Base_Build_East; }; }; //************************************************* //Towns //************************************************* Tee_Client_CreateTownMarker = { private ["_object","_markername","_text","_marker"]; { _object = _x select 0; _markername = _x select 1; _text = _x select 2; //Create Marker _marker = CreateMarkerLocal [_markername, position _object]; _marker setMarkerShapeLocal "Icon"; _marker setMarkerTypeLocal "mil_circle"; _marker setMarkerTextLocal format["%1 100/100",_text]; _marker setMarkerColorLocal "ColorBlack"; } forEach TW_TownArray; }; /* Called on all Client who took the last points */ Tee_Town_Caputred = { private ["_object","_side"]; _object = _this select 0; _side = TW_playerside; TW_Town_Taken = [_object,_side]; publicVariable "TW_Town_Taken"; TW_Town_Taken_Server = [_object,_side]; publicVariable "TW_Town_Taken_Server"; if(isServer && !isDedicated) then { TW_Town_Taken_Server call Tee_Server_Town_CreateAIDef; }; }; /* Called on all Clients when a Town got captured */ Tee_Town_Caputred_2 = { private ["_object","_side"]; _object = _this select 0; _side = _this select 1; if(player distance _object <= TW_Town_CapDis && _side == TW_playerside) then { Tee_Konto = Tee_Konto + Tee_Money_TownCap; _text = format ["You took that Town and earned %1$",Tee_Money_TownCap]; titleText[_text, "PLAIN DOWN"]; //Msg }; }; Tee_AttackTown = { private ["_object","_unitcount","_name","_points","_marker","_text"]; while{true} do { waitUntil{alive player}; { _object = _x select 0; _marker = _x select 1; _name = _x select 2; if(player distance _object <= TW_Town_CapDis) then { _points = _object getVariable "TownPoints"; if(TW_playerside != _object getVariable "TownSide") then { //Count near AI units _unitcount = 0; { if(_x distance _object <= TW_Town_CapDis) then { _unitcount = _unitcount + 1; }; } forEach (units (group player)); _points = _points - (5 * _unitcount); if(debug) then { _points = _points - 20; }; if(_points <= 0) then { _object setVariable ["TownSide",TW_playerside , true]; _object setVariable ["TownPoints", 100, true]; //_marker = _object getVariable "TownMarker"; //TeeTimeTest gedoppelt _marker setMarkerColorLocal TW_playerside_colour; _marker setMarkerTextLocal format["%1 100/100",_name]; Tee_Konto = Tee_Konto + Tee_Money_TownCap; _text = format ["You took that Town and earned %1$",Tee_Money_TownCap]; titleText[_text, "PLAIN DOWN"]; //Msg //Create AI Def [_object] call Tee_Town_Caputred; } else { _object setVariable ["TownPoints", _points, true]; _marker setMarkerTextLocal format["%1 %2/100",_name,_points]; _text = format ["%1 Points left",_points]; titleText[_text, "PLAIN DOWN"]; //Msg }; } else { if(_points < 100) then { _points = _points + 10; _object setVariable ["TownPoints", _points, true]; }; }; }; } forEach TW_TownArray; sleep 30; }; }; //********************************************************** //Support and Supply Functions //********************************************************** /* Repair Function Must be spawned */ Tee_Sup_Repair = { private ["_i","_vehicle","_pos","_damage","_text"]; _vehicle = vehicle player; _pos = getPos _vehicle; _damage = getDammage _vehicle; if(_damage == 0) exitWith { titleText["There is nothing you could repair at this vehicle!", "PLAIN DOWN"]; //Msg }; if(Tee_Konto < TW_Repair_Cost) exitWith { titleText["You dont have the money to repair this vehicle!", "PLAIN DOWN"]; //Msg }; Tee_Konto = Tee_Konto - TW_Repair_Cost; _vehicle engineOn false; _text = format ["You started to repair your vehicle. Please wait here for %1 Seconds.", TW_Repair_Time]; titleText[_text, "PLAIN DOWN"]; //Msg for [{_i=0},{_i< TW_Repair_Time},{_i=_i+5}] do { sleep 5; if(getPos _vehicle distance _pos > 1) exitWith { titleText["Repairing aborted", "PLAIN DOWN"]; //Msg }; _vehicle setDammage (getDammage _vehicle - (_damage / (TW_Repair_Time / 5))); titleText["Repairing", "PLAIN DOWN"]; //Msg }; _vehicle setDammage 0; titleText["Vehicle Repaired", "PLAIN DOWN"]; //Msg }; /* Refuel Function Must be spawned */ Tee_Sup_Refuel = { private ["_i","_vehicle","_pos"]; _vehicle = vehicle player; _pos = getPos _vehicle; if(fuel _vehicle == 1) exitWith { titleText["Your fueltank is full!", "PLAIN DOWN"]; //Msg }; if(Tee_Konto < TW_Sup_Fuel_Cost) exitWith { titleText["You dont have the money to refuel this vehicle!", "PLAIN DOWN"]; //Msg }; Tee_Konto = Tee_Konto - TW_Sup_Fuel_Cost; _vehicle engineOn false; titleText["You started to refuel your vehicle. Please wait here.", "PLAIN DOWN"]; //Msg while {fuel _vehicle < 1} do { sleep TW_Sup_Fuel_Time; if(getPos _vehicle distance _pos > 1) exitWith { titleText["Repairing aborted", "PLAIN DOWN"]; //Msg }; _vehicle setFuel ((fuel _vehicle + 0.1) min 1); titleText["Refueling", "PLAIN DOWN"]; //Msg }; titleText["Vehicle Refueled", "PLAIN DOWN"]; //Msg }; /* Reammo Function Must be spawned */ Tee_Sup_Reammo = { private ["_i","_vehicle","_pos","_text"]; _vehicle = vehicle player; _pos = getPos _vehicle; if(Tee_Konto < TW_Sup_Reammo_Cost) exitWith { titleText["You dont have the money to reammo this vehicle!", "PLAIN DOWN"]; //Msg }; Tee_Konto = Tee_Konto - TW_Sup_Reammo_Cost; _vehicle engineOn false; _text = format ["You started to load Ammunition. Please wait here for %1 Seconds.", TW_Sup_Reammo_Time]; titleText[_text, "PLAIN DOWN"]; //Msg sleep TW_Sup_Reammo_Time; if(getPos _vehicle distance _pos > 1) exitWith { titleText["You moved so you were unable to load the Ammunition", "PLAIN DOWN"]; //Msg }; _vehicle setVehicleAmmo 1; titleText["Amunition loaded!", "PLAIN DOWN"]; //Msg }; //********************************************************** //Marker //********************************************************** //Player Marker and Marker Uodate Tee_PlayerMarker_Loop = { private ["_i","_markerarray","_name","_type","_marker","_object","_text","_points","_side","_colour","_text","_actioncode","_action"]; waitUntil {HQ_placed}; _markerarray = []; while {true} do { _i = 0; //Delete PlayerMarker { deleteMarkerLocal _x; } forEach _markerarray; //Create PlayerMarker { _i = _i + 1; _name = format ["PlMa_%1",_i]; if(alive _x && isPlayer _x && playerSide == side _x) then { if(vehicle _x == _x) then { _type = "n_inf"; } else { _type = "b_motor_inf"; }; _marker = CreateMarkerLocal [_name, position _x]; _marker setMarkerShapeLocal "Icon"; _marker setMarkerTypeLocal _type; _marker setMarkerTextLocal name _x; _markerarray = _markerarray + [_marker]; }; } forEach playableUnits; //Update HQ if(TW_playerside == "west") then { TW_West_BaseMarker setMarkerPosLocal (getPos hq_west); TW_West_ShopMarker_V setMarkerPosLocal (getPos west_shop_veh); TW_West_ShopMarker_G setMarkerPosLocal (getPos west_shop_weapons); TW_West_ShopMarker_AI setMarkerPosLocal (getPos west_shop_ai); }; if(TW_playerside == "east") then { TW_East_BaseMarker setMarkerPosLocal (getPos hq_east); TW_East_ShopMarker_V setMarkerPosLocal (getPos east_shop_veh); TW_East_ShopMarker_G setMarkerPosLocal (getPos east_shop_weapons); TW_East_ShopMarker_AI setMarkerPosLocal (getPos east_shop_ai); }; //Update Town { _object = _x select 0; _name = _x select 1; _text = _x select 2; _points = _object getVariable "TownPoints"; _name setMarkerTextLocal format["%1 %2/100",_text,_points]; _side = _object getVariable "TownSide"; if(_side == "civ") then {_colour = "ColorBlack";}; if(_side == "west") then {_colour = "ColorBlue";}; if(_side == "east") then {_colour = "ColorRed";}; _name setMarkerColorLocal _colour; } forEach TW_TownArray; //Update Respawn TW_West_Respawn setMarkerPosLocal [((getPos west_shop_veh) select 0) + 5,((getPos west_shop_veh) select 1) - 10,(getPos west_shop_veh) select 2]; //TeeTimeTest Marker ist Lokal TW_East_Respawn setMarkerPosLocal [((getPos east_shop_veh) select 0) + 5,((getPos east_shop_veh) select 1) - 10,(getPos east_shop_veh) select 2]; //TeeTimeTest Marker ist Lokal //Basic Values if(playerside == west) then { TW_playerside = "west"; TW_playerside_colour = "ColorBlue";}; if(playerside == east) then { TW_playerside = "east"; TW_playerside_colour = "ColorRed";}; sleep 10; }; }; Tee_Marker_ConnectMarker = { private ["_base1","_base2","_xdif","_ydif","_xpos","_ypos","_pos","_marker"]; _base1 = getPos (_this select 0); _base2 = getPos (_this select 1); _xdif = (_base1 select 0) - (_base2 select 0); _ydif = (_base1 select 1) - (_base2 select 1); _xpos = (_base1 select 0) - _xdif / 2; _ypos = (_base1 select 1) - _ydif / 2; _pos = [_xpos,_ypos,0]; _dir = atan ( _xdif / _ydif ); player globalChat str _pos; _name = format ["CM_%1_%2",floor(time),floor(random(1000))]; _type = "RECTANGLE"; _marker = CreateMarkerLocal [_name, _pos]; _marker setMarkerShapeLocal "RECTANGLE"; _marker setMarkerBrushLocal "Solid"; _marker setMarkerDirLocal _dir; _marker setMarkerSizeLocal [10, ((_base1 distance _base2) / 2) * 0.95]; //Auf 95% runter wegen Optik _marker setMarkerColorLocal "ColorBlack"; }; //******************************************************* //Vehicles //******************************************************* Tee_GetVeh_Name = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 1;}; } forEach Tee_Veh_Array; _return }; Tee_GetVeh_Class = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 2;}; } forEach Tee_Veh_Array; _return }; Tee_GetVeh_Price = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 3;}; } forEach Tee_Veh_Array; _return }; Tee_GetVeh_Typ = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 5;}; } forEach Tee_Veh_Array; _return }; Tee_CreateVehicle = { private ["_id","_class","_price","_typ","_text","_veh"]; _id = _this select 0; _class = _id call Tee_GetVeh_Class; _price = _id call Tee_GetVeh_Price; _typ = _id call Tee_GetVeh_Typ; if(!TW_air && _typ == "Air") exitWith { titleText["You cant buy this Vehicle. It has been restricted by the server!", "PLAIN DOWN"]; //Msg }; if(Tee_Konto < _price) exitWith { titleText["You dont have the money to buy this!", "PLAIN DOWN"]; //Msg }; Tee_Konto = Tee_Konto - _price; _text = format ["You have now %1$ at your account", Tee_Konto]; titleText[_text, "PLAIN DOWN"]; //Msg //Create _veh = _class createVehicle (position player); _veh setVehicleVarName format["veh_%1_%2",floor(time),floor(random(50))]; //Lock/Unlock Action if(_typ != "Box") then { _veh lock true; TW_Vehicle_Client = TW_Vehicle_Client + [_veh]; //Action _text = "Lock/Unlock"; _actioncode = format ["[%1] call Tee_Vehicle_Lock;",_veh]; //_action = _veh addAction [_text, AddActionCode,_actioncode]; } else { //Action //_text = "Open Box"; //_actioncode = format ['createGearDialog [player, "RscDisplayGear"];',_veh]; //_action = _veh addAction [_text, AddActionCode,_actioncode]; //player groupchat str weaponCargo _veh; //Debug }; }; /* Lock Unlock given Vehicle */ Tee_Vehicle_Lock = { private ["_veh","_locked","_dis","_dis2"]; _veh = _this select 0; //Work Arround _dis2 = 999; { _dis = player distance _x; if(alive _x && _dis < _dis2) then { _dis2 = _dis; _veh = _x; }; } forEach TW_Vehicle_Client; //Work Arround _locked = locked _veh; if(_locked == 2) then { _veh lock false; titleText["Unlocked", "PLAIN DOWN"]; //Msg } else { _veh lock true; titleText["Locked", "PLAIN DOWN"]; //Msg }; }; //************************* //Weapons //************************* Tee_GetWeap_Name = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 1;}; } forEach Tee_Weapon_Array; _return }; Tee_GetWeap_Class = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 2;}; } forEach Tee_Weapon_Array; _return }; Tee_GetWeap_Price = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 3;}; } forEach Tee_Weapon_Array; _return }; Tee_GetWeap_Typ = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 5;}; } forEach Tee_Weapon_Array; _return }; Tee_AddWeapon = { private ["_id","_class","_price","_text"]; _id = _this select 0; _class = _id call Tee_GetWeap_Class; _price = _id call Tee_GetWeap_Price; if(debug) then { player groupChat "Wep"; player groupChat _class; }; if(Tee_Konto < _price) exitWith { titleText["You dont have the money to buy this!", "PLAIN DOWN"]; //Msg }; Tee_Konto = Tee_Konto - _price; player addWeapon _class; _text = format ["You have now %1$ at your account", Tee_Konto]; titleText[_text, "PLAIN DOWN"]; //Msg }; Tee_AddMag = { private ["_id","_class","_price"]; _id = _this select 0; _class = _id call Tee_GetWeap_Class; _price = _id call Tee_GetWeap_Price; if(debug) then { player groupChat "Mag"; player groupChat _class; }; if(Tee_Konto < _price) exitWith { titleText["You dont have the money to buy this!", "PLAIN DOWN"]; //Msg }; Tee_Konto = Tee_Konto - _price; player addMagazine _class; _text = format ["You have now %1$ at your account", Tee_Konto]; titleText[_text, "PLAIN DOWN"]; //Msg }; //AI Tee_GetUnit_Name = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 1;}; } forEach Tee_AI_Array; _return }; Tee_GetUnit_Class = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 2;}; } forEach Tee_AI_Array; _return }; Tee_GetUnit_Price = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 3;}; } forEach Tee_AI_Array; _return }; Tee_GetUnit_Side = { private ["_return"]; _return = 0; { if(_this == _x select 0) exitWith {_return = _x select 5;}; } forEach Tee_AI_Array; _return }; Tee_CreateUnit = { private ["_group","_class","_pos","_unit"]; _group = _this select 0; _class = _this select 1; _pos = _this select 2; _unit = _group createUnit [_class, _pos, [], 0, "FORM"]; //_unit = _class createUnit [_pos, __group]; _unit }; Tee_BuyUnit = { private ["_id","_class","_price","_group","_unit","_text"]; _id = _this select 0; _class = _id call Tee_GetUnit_Class; _price = _id call Tee_GetUnit_Price; _group = group player; if(debug) then { player groupChat "AI"; player groupChat _class; }; if(!TW_ai) exitWith { titleText["You cant buy AI. It has been restricted by the server!", "PLAIN DOWN"]; //Msg }; if(Tee_Konto < _price) exitWith { titleText["You dont have the money to buy this!", "PLAIN DOWN"]; //Msg }; if(count (units _group) >= (TW_AI_max + 1)) exitWith { titleText["You reached the AI Limit!", "PLAIN DOWN"]; //Msg }; Tee_Konto = Tee_Konto - _price; _unit = [_group,_class,position player] call Tee_CreateUnit; _text = format ["You have now %1$ at your account", Tee_Konto]; titleText[_text, "PLAIN DOWN"]; //Msg }; Share this post Link to post Share on other sites
curtcooll 1 Posted March 16, 2013 why does no one wanna help if i could script myself i would but i dont have skills ive tried doing it myself but nothing. Share this post Link to post Share on other sites