Jump to content

ROTAHOE

Member
  • Content Count

    111
  • Joined

  • Last visited

  • Medals

Everything posted by ROTAHOE

  1. ROTAHOE

    Balance Teams in MP TvT

    Ok so just checking if something like this will work before I continue? private ["_bluforCount", "_opforCount", "_indyCount"]; _bluforCount = 0; _opforCount = 0; _indyCount = 0; Call { if (((getPlayerUID _x) != "") && (side _x == WEST)) exitWith { _bluforCount = (_bluforCount + 1); } forEach units _x; if (((getPlayerUID _x) != "") && (side _x == EAST)) exitWith { _opforCount = (_opforCount + 1); } forEach units _x; if (((getPlayerUID _x) != "") && (side _x == resistance)) exitWith { _indyCount = (_indyCount + 1); } forEach units _x; }; then if this is ok I want continue with like if ((playerSide == west)) then { if (((_bluforCount - _opforCount) > 1)) then { sleep 10; player enableSimulation false; titleText ["YOU ARE UNBALANCING TEAMS, BLUFOR TO OPFOR RATIO SHOULD BE 2/1, CHANGING TEAMS...", "BLACK FADED", 999]; sleep 10; endMission "END6"; }; }; I would end up doing that 2 times for each side so what way would be best? maybe after endMission } else { if (((_bluforCount - _indyCount) > 1)) then { code };}; and do this for each side?
  2. ROTAHOE

    Balance Teams in MP TvT

    Also where and what is the best the execVM this script?
  3. ROTAHOE

    Balance Teams in MP TvT

    I need some to confirm if this works as I had to edit due to it was only using EAST and WEST. I had to add the variable "_indyCount" AutoBalance.sqf private ["_bluforCount", "_opforCount", "_indyCount", "_friendlyCount", "_enemyCount"]; _bluforCount = 0; _opforCount = 0; _indyCount = 0; { { if (((getPlayerUID _x) != "")) then { if (side player == west) then { _bluforCount = (_bluforCount + 1); } else { _opforCount = (_opforCount + 2); } else { _indyCount = (_indyCount + 2); }; }; } forEach units _x; } forEach allGroups; if ((playerSide == west)) then { _friendlyCount = _bluforCount; _enemyCount = _opforCount, _indyCount; } else { _friendlyCount = _opforCount; _enemyCount = _bluforCount, _indyCount; } else { _friendlyCount = _indyCount; _enemyCount = _bluforCount, _opforCount; }; if (((_friendlyCount - _enemyCount) > 1)) then { sleep 10; player enableSimulation false; titleText ["YOU ARE UNBALANCING TEAMS, BLUFOR TO OPFOR RATIO SHOULD BE 2/1, CHANGING TEAMS...", "BLACK FADED", 999]; sleep 10; endMission "END6"; I'm worried this part will cause errors. if ((playerSide == west)) then { _friendlyCount = _bluforCount; _enemyCount = _opforCount, _indyCount; } else { _friendlyCount = _opforCount; _enemyCount = _bluforCount, _indyCount; } else { _friendlyCount = _indyCount; _enemyCount = _bluforCount, _opforCount; }; if someone can help us would be great.
  4. ROTAHOE

    Balance Teams in MP TvT

    Ok I've found this discription.ext class Header { gameType = COOP; //DM, Team, Coop, ... minPlayers = 1; //min # of players the mission supports maxPlayers = 10; //Max # of players the mission supports playerCountMultipleOf = 1; }; playerCountMultipleOf The game server would set the maximum amount of players based on bandwidth and eventually this parameter. The default is 2, so it means the mission will try to balance the game to multiples of 2 (2 vs 2, 4 vs 4, etc.) and you did not end up with a team mission with 5 maximum players(2 vs 3 is unfair?). Coop type missions use 1, Team type missions use 2(default).
  5. ROTAHOE

    Balance Teams in MP TvT

    I'm also needing this.I'll let you know if I find anything
  6. Solved: made addon: http://steamcommunity.com/sharedfiles/filedetails/?id=920910695 Even though I was trying to avoid a addon, this way seems to work better using KK's code Automatic Marker Resizing. Since I'm using player markers it was causing them to flicker as KK's code is using allMapMarkers/ICON and player markers calls onEachFrame. I added to his code to point at my addons marker classname instead of it calling on every Icon/allMapMarkers. Example: Marker classname Tower1 0 = 0 spawn { waitUntil {!isNull findDisplay 12}; findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { if (visibleMap) then { _scale = 0.05 / ctrlMapScale (_this select 0); { _m = "#markerSize_" + _x; if (markerShape _x == "ICON") then { if (getMarkerType _x == "Tower1") then { if (isNil {missionNamespace getVariable _m}) then { missionNamespace setVariable [_m, markerSize _x]; }; _x setMarkerSizeLocal [ ((missionNamespace getVariable _m) select 0) * _scale, ((missionNamespace getVariable _m) select 1) * _scale ];}; }; } forEach allMapMarkers; }; }]; };
  7. I may have found a more simple approach by having a server side addon config.cpp class CfgPatches { class Markers { units[] = {}; weapons[] = {}; requiredVersion=1.00; }; }; class CfgMarkers { class Tower1 { name="Tower1"; icon="\TowerMarkers\icons\towericon1_ca.paa"; color[]={1,1,1,1}; size=32; shadow = 0; scope = 2; markerClass = "Flags"; }; class Tower2 { name="Tower2"; icon="\TowerMarkers\icons\towericon2_ca.paa"; color[]={1,1,1,1}; size=32; shadow = 0; scope = 2; markerClass = "Flags"; }; class Tower3 { name="Tower3"; icon="\TowerMarkers\icons\towericon3_ca.paa"; color[]={1,1,1,1}; size=32; shadow = 0; scope = 2; markerClass = "Flags"; }; class Tower4 { name="Tower4"; icon="\TowerMarkers\icons\towericon4_ca.paa"; color[]={1,1,1,1}; size=32; shadow = 0; scope = 2; markerClass = "Flags"; }; }; then place the needed paa files into the icons folder then repack it into TowerMarker.pbo and place in the addons folder. I will have to place them on the map via editor and trans the the mission.sqm an TowerMarker.pbo to the server. Testing now but I can see this worrking else I will have to sign the pbo and call it as server mod ? This will save mission file size also.
  8. Everybody. works in SP then trans to MP and nothing. tried all his ways on that blog but nothing worked. Unless yous know something I don't?
  9. @pierremgi do you have any idea why its not working in mp mate?
  10. whats wrong with this ? Its not working if (surfaceIsWater getPos player) then {player addAction ["Drop rubber boat", "BoatSpawer.sqf", [], 1, TRUE, TRUE, "", "vehicle _this == _target && _target getVariable ['crrcsdropped', 0] < 2"];};
  11. Ok now I can confirm this is not working on dedicated server and its showing no error in logs ?
  12. Yup its returning true ?
  13. this works fine player addAction ["Drop rubber boat", "BoatSpawer.sqf", [], 1, TRUE, TRUE, "", "vehicle _this == _target && _target getVariable ['crrcsdropped', 0] < 2"]; But its not picking up I'm in the water to add the action to the player if (surfaceIsWater getPos player) then { };
  14. SOLVED Awesome mate thank you very much ! init.sqf MISSION_ROOT = call { private "_arr"; _arr = toArray __FILE__; _arr resize (count _arr - 8); toString _arr }; Marker.sqf findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", " _this select 0 drawIcon [ MISSION_ROOT + 'images\towericon1_ca.paa', [1,0,0,1], getPos Tower1, 24, 24, getDir Tower1, '', 1, 0.03, 'TahomaB', 'right' ] "]; Tower1 init this execVM "Marker.sqf";
  15. Its in my mission, image folder?
  16. Sorry mate I don't understand ?
  17. Ok so I've tested this and all is working using the default icons in ui_f_data\map\vehicleicons but if I go to replace the icon with my own, I get ( cannot load texture images\towericon1_ca.paa ) when I bring up the map. findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", " _this select 0 drawIcon [ 'images\towericon1_ca.paa', [1,0,0,1], getPos Tower1, 24, 24, getDir Tower1, '', 1, 0.03, 'TahomaB', 'right' ] "]; How do i call my image ?
  18. So first off here's my code that I would like to add: if (_rank >= 30) then { player spawn { _pilot = _this; private _price = 25000; if([_price] call HG_fnc_hasEnoughMoney) then { [25000,1] call HG_fnc_addOrSubCash; _jet = createVehicle ["B_Plane_CAS_01_F", [4113.665,800.764,1200], [], 0, "FLY"]; _jet setDir 0; _jet setVelocityModelSpace [0,150,0]; _pilot moveInDriver _jet; removeUniform _pilot; removeBackpackGlobal _pilot; removeHeadgear _pilot; _pilot forceAddUniform "U_O_PilotCoveralls"; _pilot addBackpackGlobal "B_parachute"; _pilot addHeadgear "H_PilotHelmetFighter_O"; _jet addAction ["Re-Arm Jet", "scripts\Rearm_Jet.sqf"]; hint format ["%1 \nYou have brought A10 Good Luck!",name _pilot]; } else { hint format ["%1 \nYou don't have enough money!",name _pilot] }; }; I've tried a few ways with adding this but with fail. The code just wont run, even after changing my xp in the datebase to match rank 30 ( 45000). Heres the getRankInfo.sqf _xp = _this; _rank = 0; _nextrankxp = 0; if (_xp >= 250000) then { _rank = 50; _nextrankxp = 0; }else{ if (_xp >= 230000) then { _rank = 49; _nextrankxp = 250000; }else{ if (_xp >= 210000) then { _rank = 48; _nextrankxp = 230000; }else{ if (_xp >= 190000) then { _rank = 47; _nextrankxp = 210000; }else{ if (_xp >= 170000) then { _rank = 46; _nextrankxp = 180000; }else{ if (_xp >= 150000) then { _rank = 45; _nextrankxp = 170000; }else{ if (_xp >= 140000) then { _rank = 44; _nextrankxp = 150000; }else{ if (_xp >= 130000) then { _rank = 43; _nextrankxp = 140000; }else{ if (_xp >= 120000) then { _rank = 42; _nextrankxp = 130000; }else{ if (_xp >= 110000) then { _rank = 41; _nextrankxp = 120000; }else{ if (_xp >= 100000) then { _rank = 40; _nextrankxp = 110000; }else{ if (_xp >= 90000) then { _rank = 39; _nextrankxp = 100000; }else{ if (_xp >= 85000) then { _rank = 38; _nextrankxp = 90000; }else{ if (_xp >= 80000) then { _rank = 37; _nextrankxp = 85000; }else{ if (_xp >= 75000) then { _rank = 36; _nextrankxp = 80000; }else{ if (_xp >= 70000) then { _rank = 35; _nextrankxp = 75000; }else{ if (_xp >= 65000) then { _rank = 34; _nextrankxp = 70000; }else{ if (_xp >= 60000) then { _rank = 33; _nextrankxp = 65000; }else{ if (_xp >= 55000) then { _rank = 32; _nextrankxp = 60000; }else{ if (_xp >= 50000) then { _rank = 31; _nextrankxp = 55000; }else{ if (_xp >= 45000) then { _rank = 30; _nextrankxp = 50000; }else{ if (_xp >= 40000) then { _rank = 29; _nextrankxp = 45000; }else{ if (_xp >= 37000) then { _rank = 28; _nextrankxp = 40000; }else{ if (_xp >= 34000) then { _rank = 27; _nextrankxp = 37000; }else{ if (_xp >= 31000) then { _rank = 26; _nextrankxp = 34000; }else{ if (_xp >= 28000) then { _rank = 25; _nextrankxp = 31000; }else{ if (_xp >= 25000) then { _rank = 24; _nextrankxp = 28000; }else{ if (_xp >= 22000) then { _rank = 23; _nextrankxp = 25000; }else{ if (_xp >= 19000) then { _rank = 22; _nextrankxp = 22000; }else{ if (_xp >= 16000) then { _rank = 21; _nextrankxp = 19000; }else{ if (_xp >= 14000) then { _rank = 20; _nextrankxp = 16000; }else{ if (_xp >= 12000) then { _rank = 19; _nextrankxp = 14000; }else{ if (_xp >= 10000) then { _rank = 18; _nextrankxp = 12000; }else{ if (_xp >= 9000) then { _rank = 17; _nextrankxp = 10000; }else{ if (_xp >= 8000) then { _rank = 16; _nextrankxp = 9000; }else{ if (_xp >= 7000) then { _rank = 15; _nextrankxp = 8000; }else{ if (_xp >= 6200) then { _rank = 14; _nextrankxp = 7000; }else{ if (_xp >= 5400) then { _rank = 13; _nextrankxp = 6200; }else{ if (_xp >= 4800) then { _rank = 12; _nextrankxp = 5400; }else{ if (_xp >= 4200) then { _rank = 11; _nextrankxp = 4800; }else{ if (_xp >= 3600) then { _rank = 10; _nextrankxp = 4200; }else{ if (_xp >= 3100) then { _rank = 9; _nextrankxp = 3600; }else{ if (_xp >= 2600) then { _rank = 8; _nextrankxp = 3100; }else{ if (_xp >= 2100) then { _rank = 7; _nextrankxp = 2600; }else{ if (_xp >= 1700) then { _rank = 6; _nextrankxp = 2100; }else{ if (_xp >= 1300) then { _rank = 5; _nextrankxp = 1700; }else{ if (_xp >= 900) then { _rank = 4; _nextrankxp = 1300; }else{ if (_xp >= 600) then { _rank = 3; _nextrankxp = 900; }else{ if (_xp >= 300) then { _rank = 2; _nextrankxp = 300; }else{ _rank = 1; _nextrankxp = 100; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; }; _output = [_rank, _nextrankxp]; _output and this is the database getPlayerStats.sqf if (isServer) then { //check if player exists in db _unit = _this select 0; _uid = getPlayerUID _unit; _name = name _unit; _query = format ["SELECT id,uid FROM player WHERE uid = '%1'", _uid]; while{!isNil("serverRunningQuery") && serverRunningQuery} do { sleep 0.5;//busy wait }; serverRunningQuery = true; _get = nil; while {isNil("_get")} do { _get = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommandAsync ['MyDataBaseName', '%1']", _query]; if (_get == "") then { _get = nil; }; sleep 0.5; }; if ((count (toArray(_get))) < 6) then { //if user doesnt exist in database _query = "INSERT into player (uid, name, xp, kills, deaths, ammo, weapons, items, assignitems, headgear, goggles, vest, vestitems, uniform, uniformitems, backpack, packitems, handgunitems, primarywep, secondarywep) VALUES("; _query = _query + "'" + (_uid) + "'," + "'" + (_name) + "'" + ",0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)"; _return = nil; while {isNil("_return")} do { _return = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommandAsync ['MyDataBaseName', '%1']", _query]; if (_return == "") then { _return = nil; }; sleep 0.5; }; }; //get saved stats from server _query = format ["SELECT xp,kills,deaths FROM player WHERE uid = '%1'", _uid]; _get = nil; while {isNil("_get")} do { _get = "Arma2Net.Unmanaged" callExtension format ["Arma2NETMySQLCommandAsync ['MyDataBaseName', '%1']", _query]; if (_get == "") then { _get = nil; }; sleep 0.5; }; serverRunningQuery = false; //This converts the string to an array _get = call compile _get; //only select the inner array, throw away this outer array shell _get = _get select 0; _get = _get select 0; _string = _get select 0; _xp = parseNumber _string; _string = _get select 1; _kills = parseNumber _string; _string = _get select 2; _deaths = parseNumber _string; player_stats_add = [_xp,_kills,_deaths]; owner _unit publicVariableClient "player_stats_add"; player_stats_got = 1; owner _unit publicVariableClient "player_stats_got"; }; Any help would be great. Just spent 6hrs trying to add this with no luck. Please don't let me try sleep on a loss LOL
  19. Thank you for posting mate :cheers:
  20. Sorry those functions work fine, it was just this script ^ adding a needed rank i.e 50
  21. I got done what was needed with player spawn { _pilot = _this; private _price = 25000; if([_price] call HG_fnc_hasEnoughMoney) then { _info = player_stats select 0 call getRankInfo; _rank = _info select 0; if (_rank >= 50) then { [25000,1] call HG_fnc_addOrSubCash; _jet = createVehicle ["B_Plane_CAS_01_F", [4113.665,800.764,1200], [], 0, "FLY"]; _jet setDir 0; _jet setVelocityModelSpace [0,150,0]; _pilot moveInDriver _jet; removeUniform _pilot; removeBackpackGlobal _pilot; removeHeadgear _pilot; _pilot forceAddUniform "U_O_PilotCoveralls"; _pilot addBackpackGlobal "B_parachute"; _pilot addHeadgear "H_PilotHelmetFighter_O"; _jet addAction ["Re-Arm Jet", "scripts\Rearm_Jet.sqf"]; hint format ["%1 \nYou have brought A10 Good Luck!",name _pilot]; } else { hint format ["%1 \nYou don't have enough money!",name _pilot] }; }; }; But interested on your input
  22. _output = [random 10000] call getNextRankAndXP;
  23. Sorry mate new to this and you lost me ?
  24. I've used this before but how to add to my code using this ? I'm thinking but unsure what you are getting at ?
×