Jump to content
Twiznak

SOLVED. Custom Warlords missions not working on dedicated sever. WHY?

Recommended Posts

Hello. I know how to use the Warlords modules and make custom missions that work on locally hosted multiplayer just fine. But when I upload these missions to my dedicated server NONE of them work. The mission launches from the lobby as intended but when I load into the mission I see no warlords sector markers on the map, no announcer and no request menu. What make this infuriating is the THE AI PLAY THE MISSION WITHOUT ME! How? I see them req squad members and issue orders to the sectors but nothing for me. I sing out and and back in and I can see that my character has played in my absence. I have tested it for a day now and Even a basic vanilla (no mods or scripts) warlords mission will not load correctly. what am I doing wrong? Will someone please show/link to me a custom warlords mission that works on a dedicated server so I have an example. I'm lost and frustrated. Please help thank you.

 

Solution! I had the warlords init module synced to the warlords base. I am an idiot.

Share this post


Link to post
Share on other sites

Usually, the main difference between something rolling on hosted and breacking on dedicated is ... player.

You should have a script with the command: player which fails on dedicated, or  disabled AI in lobby (not tested)....

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

Usually, the main difference between something rolling on hosted and breacking on dedicated is ... player.

You should have a script with the command: player which fails on dedicated, or  disabled AI in lobby (not tested)....

Would you please be more specific and give me an example. I don't know where to go with this because the players characters don't need to be synced to the warlords modules. Have you ever made a warlords mission and tried it out on a dedicated server? Do you know of a warlords mission that works on a dedicated server?

Share this post


Link to post
Share on other sites
52 minutes ago, Twiznak said:

 Have you ever made a warlords mission and tried it out on a dedicated server? Do you know of a warlords mission that works on a dedicated server?

Follow my signature.

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

Follow my signature.

OK. i took your latest warlords for winter chernarus and unpacked it. If i wanted to to play a bare bones warlords missions on a dedicated server. Which line in which file would i add to my mission.pbo to get dedicated server functionality?

init.sqf? i'm so lost .

Spoiler

/*if (!isMultiplayer) exitWith {
  ["This scenario must run in multiplayer",1,2] call BIS_fnc_WLSmoothText;
  uisleep 2;
  "loser" call BIS_fnc_endMission
};
*/

_terrainGrid = "grass" call BIS_fnc_getParamValue;
setTerrainGrid _terrainGrid;

waitUntil {time > 0};
enableEnvironment [false, true];


[] spawn {
  params ["_allUnits","_allUnitsPlayer","_allVehicles","_allCannons","_allDeadMen","_allAIGroups"];
  while {true} do {
    uiSleep 4;

    _allUnits = (allUnits select {!(_x getVariable ["admitUnit",false])});
    _allUnitsPlayer = (units player select {!(_x getVariable ["admitUnitPlayer",false])});

    _allVehicles = (vehicles select {!(_x getVariable ["admitVeh",false]) && !(_x isKindOf "WeaponHolderSimulated")});
    if (isServer) then {
      _allCannons = (vehicles select {local _x && isNil {_x getVariable "admitCanon"} && !(_x isKindOf "WeaponHolderSimulated") && (getText (configfile >> "CfgVehicles" >> typeOf _x >> "editorSubcategory") in ["EdSubcat_APCs","EdSubcat_Tanks","EdSubcat_Artillery"])});
      _allDeadMen = (allDeadMen select {!(_x getVariable ["mrkdead",false])});
      _allAIGroups = (allGroups select {!(_x getVariable ["admitGrp",false]) && {!(isPlayer leader _x)}});
    };
    //_______vehicles______
    {
      _veh = _x;
      if (isServer) then {
        _veh lock 0;
        _veh setUnloadInCombat [true, false]; //cargo,turrets
        _veh allowCrewInImmobile true;

        if (_veh isKindOf "LandVehicle") then {
          _veh addItemCargoGlobal ["MediKit",selectRandom [0,0,1]];
          _veh addItemCargoGlobal ["firstAidKit",8];
          if (random 10 < 3) then {
            _veh addItemCargoGlobal ["toolKit",1];
            _veh addItemCargoGlobal ["mineDetector",1];
          };

          /*if (!isNull attachedTo _veh) then {
            _para = attachedTo _veh;
            detach _para; deleteVehicle _para;
            _pos = getPos _veh;
            _pos set [2,0];
            _veh setPos _pos;
          };*/
          //_veh addBackpackCargoGlobal ["B_Kitbag_mcamo_Eng",selectRandom [0,1]];
          //_veh addMagazineCargoGlobal ["laserbatteries",floor random 4];
          };
        if (_veh isKindOf "air") then {
          _veh addBackpackCargoGlobal ["B_Kitbag_mcamo_Eng",selectRandom [0,1]];
          /*if (_veh isKindOf "UAV") then {
            _veh  spawn {
              while {alive _this} do {
                uiSleep 10;
                if (fuel _this < 0.3 && _this getHitPointDamage "hitFuel" < 0.5) then {
                  [_this,1] remoteExec ["setFuel",_this]
                };
                if (_this AmmoOnPylon "pylons2" == 0) then {
                  uiSleep 20;
                  _this setAmmoOnPylon [2,1];
                };
                if (_this AmmoOnPylon "pylons1" == 0) then {
                  uiSleep 20;
                  _this setAmmoOnPylon [1,3];
                };
              };
            };
          };*/
        };
      };
      _veh call MGI_fnc_flipVeh;
      _veh addEventHandler ["epeContactStart", {
        params ["_veh","_obj"];
        if (["wall",typeOf _obj] call bis_fnc_inString) then {
          [_veh,false] remoteExecCall ["enableSimulationGlobal",2];
          _obj setDamage [1,false];
          _veh setVelocity [0,0,0];
          [_veh,true] remoteExecCall ["enableSimulationGlobal",2];
        };
      }];

      _veh setVariable ["admitVeh",true];
      nil
    } count _allVehicles;

    {
      _unit = _x;

      if (isServer && side _unit in [WEST,EAST] && !(_unit in MGI_Bros) && getPosATL _unit #2 > 10) then {
          if (["_spotter","_sniper","_pilot","_marksman","_crew"] findif {[_x,typeOf _unit] call bis_fnc_instring} == -1) then {
            _unifThings = getUnitLoadout _unit #3#1;
            _unit forceAddUniform  uniform (leader _unit);
            { for "_i" from 1 to _x#1 do {_unit addItemToUniform _x#0};nil} count _unifThings;
            _unit addHeadgear (headgear (leader _unit));
          };
        };
      if (isPlayer leader _unit) then {MGI_Bros pushBack _unit};

      //_________markers unconscious________
      if ("markInconscious" call BIS_fnc_getParamValue == 1 && {hasInterface && side group _unit == playerSide}
        ) then {
        _unit spawn {
          params ["_unit"];
          while {hasInterface && {side group _unit == playerSide}} do {
            waituntil {uiSleep 3; lifeState _unit == "incapacitated"};
            _mrk2 = createMarkerLocal [str (_unit), getposATL _unit];
            _mrk2 setMarkerTypeLocal "mineField";
            _mrk2 setMarkerSizeLocal [0.7,0.7];
            _mrk2 setMarkerColorLocal ([side group _unit,true] call BIS_fnc_sideColor);
            waituntil {uiSleep 3; isnull _unit or !alive _unit or lifeState _unit != "incapacitated"};
            if (isNull _unit or !alive _unit) exitWith {deleteMarkerLocal _mrk2};
            deleteMarkerLocal _mrk2;
          };
        };
      };
      //__________adding damage__________________
      if (isServer) then {
        private "_eh";
        if !(leader _x in (playableUnits + switchableUnits)) then {
          _eh = _x addMPEventHandler ["MPHit",{call MGI_fnc_addDamageEffect}];
        };
      };

      _x setVariable ["admitUnit",true];
      nil
    } count _allUnits;

    //_________units of player______________
    {
      _x addEventHandler ["AnimChanged", {
        call MGI_fnc_silencer;
        if (isPlayer (_this select 0)) then {
          if ("MineDetector" in items (_this select 0)) then {
            {
              if (mineActive _x && !(_x mineDetectedBy side (_this select 0))) then {
                playerSide revealMine _x;
              };
            } forEach ((_this select 0) nearObjects ["MineBase", 3]);
          };
        };
      }];
      _x setVariable ["admitUnitPlayer",true];
      nil
    } count _allUnitsPlayer;

    if (isServer ) then {
      //____________all AI cannons (server)_________
      {
        _cannon = _x;
        _cannon setVariable ["admitCanon",true];
        _cannon spawn {
          _this call MGI_fnc_enhancedTurret;
        };
        nil
      } count _allCannons;

      //_____________all dead men____________________
      if ("markDead" call BIS_fnc_getParamValue == 1) then {
        {
          _x spawn {
            params ["_unit"];
            if !(_unit getVariable ["mrkdead",false]) then {
              _unit setVariable ["mrkdead",true];
              _mrk = createMarker [str (_unit), getposATL _unit];
              _mrk setMarkerType "mineFieldAP";
              _mrk setMarkerSize [0.7,0.7];
              _mrk setMarkerColor ([side group _unit,true] call BIS_fnc_sideColor);
              waituntil {uiSleep 3; isnull _unit};
              deleteMarker _mrk
            };
          };
          _x getVariable ["mrkdead",true];
          nil
        } count _allDeadMen;
      };

      //__________delete groups_____________________
      {
        _grp = _x;
        if ((units _grp) findIf {!isNil {_x getVariable "passedBros"}} < 0) then {
          _grp deleteGroupWhenEmpty true;
          _grp setVariable ["admitGrp",true];
        };
        nil
      } count _allAIGroups;
    };

      //____________ end loop______
    };
  };



fn_prep_playableAI= {
  params ["_unit"];
  _unit enableStamina ([false,true] select BIS_WL_fatigueEnabled);
  if (BIS_WL_fatigueEnabled == 0) then {
    _unit setCustomAimCoef 0
  };
};
{_x call fn_prep_playableAI} forEach (switchableUnits + playableUnits); // double emploi avec player



["Preload"] call BIS_fnc_arsenal; // also for anticheat
if (("arsenal" call BIS_fnc_getParamValue) == 1 or !isMultiplayer) then {
  {_x spawn MGI_fnc_arsenalCrate} forEach [crate1,crate2,crate3,crate4]
};




//_______________________________RESPAWN____________________________

addMissionEventHandler ["Entitykilled", {
  params ["_victim","_killer","_instigator"];
  if (isNull _instigator) then {
    _instigator = UAVControl vehicle _killer select 0
  };
  if (isNull _instigator) then {_instigator = _killer};
  if (isServer && !isnil {_victim getVariable "kamikaze"}) then {
    if (_victim getVariable "kamikaze") then {[_instigator,1000] remoteExecCall ["addRating",_instigator]};
  };
  removeAllActions _victim;
  if (local _victim) then {
    _victim setVariable ["ldout",getUnitLoadout _victim];
    _victim setVariable ["MGI_weapon",currentWeapon _victim];

  if (isPlayer _victim) then {
    deleteMarkerLocal format ["respawn_%1_zz%2",side group _victim,name _victim];
  _mark2 = createMarkerLocal [format ["respawn_%1_zz%2",side group _victim,name _victim],getPosATL _victim];
  _mark2 setMarkerTextLocal (name _victim);
  {
  deleteMarkerLocal format ["respawn_%1_zz%2",side group _x,name _x];
  if (_x iskindof "CAManBase" && alive _x && {!(isObjectHidden _x)} && {!((getposatl _x) isEqualTo [0,0,0])}) then {
    _mark = createMarkerLocal [format ["respawn_%1_zz%2",side group _x,name _x],getPosATL _x];
    _mark setMarkerTextLocal (name _x);
    [_x, _mark] spawn {
     params ["_unit","_marker"];
     while {alive _unit && {!(isObjectHidden _unit)} && {!((getposatl _unit) isEqualTo [0,0,0])}} do {
       _marker setMarkerPosLocal (getPosATL _unit);
       sleep 0.1};
       deleteMarkerLocal format ["respawn_%1_zz%2",side group _unit,name _unit];
    };
  };
  } forEach ((playableUnits + units player) - [player]);
};
};
}];

addMissionEventHandler ["EntityRespawned", {
  _unit = _this select 0;
  _corpse = _this select 1;
  if (local _unit) then {

comment 'if (!isPlayer _unit && ("AIRespawn" call BIS_fnc_getParamValue) == 0) exitWith {deleteVehicle _unit}';

   _unit setUnitLoadout (_corpse getVariable ["ldout",getUnitLoadout _unit]);
  _unit selectWeapon (_unit getVariable "MGI_weapon");
  if (isPlayer _unit) then {
    _unit call fn_prep_player;
  } else {
    _unit call fn_prep_playableAI;
  };
  {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
  deleteVehicle _corpse;
 };
}];


//_____________________________________REVIVE__________________________
call MGI_fnc_Revive;

 

Here is a link to my missions. https://steamcommunity.com/sharedfiles/filedetails/?id=1719925556 If it would help you help me, i can google docs all the files in my mission.pbo so you and anyone else reading this can see my work and point out my mistake.

 

 

Share this post


Link to post
Share on other sites

It was just an example for a working mission on dedi as you doubted for that. You are not supposed to "unpack" and "pick" the init.sqf to extract some lines. As you can see I'm referring to many extra codes for personal functions. So, I will not clear this mission to make it work in your scope.

There is no "special things" to do for  dedicated, but scripting for MP and avoiding player as command on server.

You just have to place your Warlord modules, only link paths between sectors. What else?

The specific spawning units come with your CfgWLRequisitionPresets in description.ext or any.hpp from it.

You can add plenty of scripts. I spawn civilians and extra indep... loot in houses... There is no problem for custom scenario.

 

So, your best bet is to send here what your files are (via gitub or dropBox for example), because it's impossible to tell you what you miss or apply some homemade codes at random in your scenario.

 

 

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

So, your best bet is to send here what your files are (via gitub or dropBox for example), because it's impossible to tell you what you miss or apply some homemade codes at random in your scenario.

 

 

https://github.com/Twiznak/My-Warlords-Mission . Thank you for offering to look over these.

Share this post


Link to post
Share on other sites

Your warlord init module must not be linked to any other module. Should work if you remove this link.

Share this post


Link to post
Share on other sites

Why am I so dumb? this is the cause, I figured it out this morning. I came back here to update the thread and I see you figured it out to, which mean that you took time and looked over my mission. I really appreciate it Pierre. Thank you.

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×