ADD WEAPON TO AN2 and MAGAZINES to UH1H on DayZ Mod 1.9.0

MikeCandys

Well-Known Member
I tried it like this in server_monitor.sqf:

if (_object isKindOf "AN2_DZ") then {
_object addWeapon "PKT"; //M240_veh
//add two magazines
//_object addMagazine "100Rnd_762x54_PK"; //"100Rnd_762x51_M240"
//_object addMagazine "100Rnd_762x54_PK"; //remove comment to add a magazine
_object setVehicleAmmo 0; //comment out if publish with ammo
};

and in the create vehicle with vehicleinit like this :

_vehicle_204561 = objNull;
if (true) then
{
_this = createVehicle ["AN2_DZ", [6251.1528,9143.0156,0.1372391], [], 0, "CAN_COLLIDE"];
_vehicle_204561 = _this;
_this setDir -4.3434052;
_this setVehicleInit "this addWeapon ""M240_veh"";this addMagazine ""100Rnd_762x51_M240"";this addMagazine ""100Rnd_762x51_M240"";this addMagazine ""100Rnd_762x51_M240"";";
_this setPos [6251.1528,9143.0156,0.1372391];
};


well the create vehicle part worked only when using infistar, without it was removed again. dunno why.

Can anyone help?
 

Inkko

OpenDayZ Rockstar!
I tried it like this in server_monitor.sqf:

if (_object isKindOf "AN2_DZ") then {
_object addWeapon "PKT"; //M240_veh
//add two magazines
//_object addMagazine "100Rnd_762x54_PK"; //"100Rnd_762x51_M240"
//_object addMagazine "100Rnd_762x54_PK"; //remove comment to add a magazine
_object setVehicleAmmo 0; //comment out if publish with ammo
};

and in the create vehicle with vehicleinit like this :

_vehicle_204561 = objNull;
if (true) then
{
_this = createVehicle ["AN2_DZ", [6251.1528,9143.0156,0.1372391], [], 0, "CAN_COLLIDE"];
_vehicle_204561 = _this;
_this setDir -4.3434052;
_this setVehicleInit "this addWeapon ""M240_veh"";this addMagazine ""100Rnd_762x51_M240"";this addMagazine ""100Rnd_762x51_M240"";this addMagazine ""100Rnd_762x51_M240"";";
_this setPos [6251.1528,9143.0156,0.1372391];
};


well the create vehicle part worked only when using infistar, without it was removed again. dunno why.

Can anyone help?
You had tried adding this in the server_monitor.sqf? What do you mean exactly with the infistar?

Code:
//Dont add inventory for traps.
        if (!(_object isKindOf "TrapItems") && !(_object isKindOf "DZ_buildables")) then {
            _cargo = _inventory;
            clearWeaponCargoGlobal _object;
            clearMagazineCargoGlobal _object;
            clearBackpackCargoGlobal _object;
            _config = ["CfgWeapons","CfgMagazines","CfgVehicles"];
            {
                _magItemTypes = _x select 0;
                _magItemQtys = _x select 1;
                _i = _forEachIndex;
                {
                    if ((isClass (configFile >> (_config select _i) >> _x)) &&
                        {(getNumber (configFile >> (_config select _i) >> _x >> "stopThis") != 1)}) then {
                        if (_forEachIndex < count _magItemQtys) then {
                            switch (_i) do {
                                case 0: {_object addWeaponCargoGlobal [_x,(_magItemQtys select _forEachIndex)];};
                                case 1: {_object addMagazineCargoGlobal [_x,(_magItemQtys select _forEachIndex)];};
                                case 2: {_object addBackpackCargoGlobal [_x,(_magItemQtys select _forEachIndex)];};
                            };
                        };
                    };
                } forEach _magItemTypes;
            } forEach _cargo;
            if (_object isKindOf "AN2_DZ") then {
                _object addWeapon "M240_veh";
                _object addMagazine "100Rnd_762x51_M240";
                _object addMagazine "100Rnd_762x51_M240";
                _object addMagazine "100Rnd_762x51_M240";
            };
        };
 

MikeCandys

Well-Known Member
You had tried adding this in the server_monitor.sqf? What do you mean exactly with the infistar?

So ive tried adding with server_monitor.sqf and create vehicle. but without infistar it would disappear/not spawn.
Now i am running with infistar and the an2 works with guns.

also added m107 to the loottable it doesnt spawn but with infistar it does. i think it is banned in the fakeweapon section, same as m240_veh.
infistar probably found a way to allow the guns in the game. ( maybe the forbittenweapon part)
idk but sad it is not running without it or i hvnt found the reason yet.
 

MikeCandys

Well-Known Member
and also for example if i add the "DMR"(from arma2) into the loottable after a relog it changes to DMR_DZ
 

Inkko

OpenDayZ Rockstar!
and also for example if i add the "DMR"(from arma2) into the loottable after a relog it changes to DMR_DZ
dayz_code/system/player_monitor.fsm and dayz_code/compiles/player_gearset.sqf both have sections to replace variants of weapons with the dayz mod ones/ check for weapons not in the CfgWeapons.

Code:
//Add weapons
    {
        if (_x == "Crossbow") then { _x = "Crossbow_DZ" }; // Convert Crossbow to Crossbow_DZ
        // Convert to DayZ Weapons
        if (_x == "DMR") then { _x = "DMR_DZ" };
        //if (_x == "M14_EP1") then { _x = "M14_DZ" };
        if (_x == "SVD") then { _x = "SVD_DZ" }; 
        if (_x == "SVD_CAMO") then { _x = "SVD_CAMO_DZ" };

        //Is item legal?
        if (isClass(configFile >> "CfgWeapons" >> _x)) then {
            player addWeapon _x;
        };
    } count _wpns;

I just find it odd that it would work with infistar, I would have thought it would be the opposite way around.

As for the vehicles weapons tho I have no idea. I'm just assuming that infistar overwrites something that normally would remove it.
 

MikeCandys

Well-Known Member
So the dmr into dmr_dz change is not broken via infistar but the add weapon to vehicle and spawn m107 is
 

MikeCandys

Well-Known Member
so i checked both files: dayz_code/system/player_monitor.fsm and dayz_code/compiles/player_gearset.sqf
and realised something different: when i find a ksvk_DZN (namalsk ksvk) which is in the loot table and i put the ksvk into objects, for example tent or vehicle. after the next restart the magazines of it are gone. any idea why?
 

MikeCandys

Well-Known Member
so i checked both files: dayz_code/system/player_monitor.fsm and dayz_code/compiles/player_gearset.sqf
and realised something different: when i find a ksvk_DZN (namalsk ksvk) which is in the loot table and i put the ksvk into objects, for example tent or vehicle. after the next restart the magazines of it are gone. any idea why?
I made it work for the dmr to dmr_dz but no idea why the ksvk mags are dissapearing out of vehicle inventoryxD
 

MikeCandys

Well-Known Member
maybe it has something to do with this code

[] spawn {
while{1 == 1}do
{
_inv = [];
_inv = _inv + (magazines player);
_inv = _inv + (weapons player);
if(!isNull (unitBackpack player))then
{
_BW = (getWeaponCargo unitBackpack player) select 0;
_BM = (getMagazineCargo unitBackpack player) select 0;
_inv = _inv + _BW + _BM;
};
if(isNil 'DayZ_onBack')then{DayZ_onBack = '';};
_inv = _inv + [DayZ_onBack];

{
if((_x in _inv) && (_x != ''))then
{
[_x] spawn {
_y = _this select 0;
for '_i' from 0 to ({_x == _y} count (weapons player)) do {player removeWeapon _y;};
player removeMagazines _y;
for '_w' from 0 to 10 do {uiSleep 0.1;player removeWeapon _y;player removeMagazines _y;};
};
if(player distance "+str _mPos+" > 500)then
{
[] spawn {
player setDamage 1;
deleteVehicle player;
};

[] spawn "+_randvar2+";
_log = format['BadItem: %1',_x];
_name = 'DEAD';if((alive player)&&(getPlayerUID player != ''))then{_name = name player;};
[_name,getPlayerUID player,'BAN',toArray (_log)] call "+_randvar37+";
};
};
} forEach ("+str _ForbiddenItems+" + ['FakeWeapon','RocketPods','GyroGrenadeLauncher','FFARLauncher','FFARLauncher_12','Rifle','M16_base',
'HandGunBase','Put','M240_veh_2','M240_veh_MG_Nest','PKT','PKT_MG_Nest','PKT_veh','DT_veh','M2',
'M3P','DSHKM','KORD','KPVT','M168','M197','AZP85','2A14','GAU12','2A42','M242','GAU8','2A38M','AGS30','AGS17',
'MK19','M119','M256','D30','D81','ZiS_S_53','2A46M','FFARLauncher_14','CamelGrenades','57mmLauncher',
'57mmLauncher_64','57mmLauncher_128','80mmLauncher','S8Launcher','MissileLauncher','SidewinderLaucher',
'SidewinderLaucher_F35','SidewinderLaucher_AH1Z','AT5Launcher','AT5LauncherSingle','2A46MRocket','AT10LauncherSingle',
'AT11LauncherSingle','AT13LauncherSingle','TOWLauncher','TOWLauncherSingle','HellfireLauncher','VikhrLauncher',
'BombLauncher','BombLauncherF35','BombLauncherA10','SEARCHLIGHT','CarHorn','BikeHorn','TruckHorn','TruckHorn2',
'SportCarHorn','MiniCarHorn','R73Launcher','R73Launcher_2','Ch29Launcher','Ch29Launcher_Su34','2A70Rocket','2A70',
'AT6Launcher','AT9Launcher','AT2Launcher','HeliBombLauncher','AirBombLauncher','Mk82BombLauncher','Mk82BombLauncher_6',
'StingerLaucher','StingerLauncher_twice','AALauncher_twice','Igla_twice','MaverickLauncher','9M311Laucher',
'WeaponExplosive','M252','2B14','MeleeWeapon','m8_base','PKT_2','PKT_3','SidewinderLaucher_AH64','M230','BAF_L2A1',
'BAF_M240_veh','BAF_L7A2','BAF_L94A1','BAF_static_GMG','BAF_GMG','CTWS','CRV7_PG','CRV7_HEPD','CRV7_FAT','M621','M68',
'D10','PKTBC','PKTBC_veh','SGMT','HellfireLauncher_AH6','StingerLaucher_4x','M242BC','M240BC_veh','M2BC','MK19BC',
'M120','GrenadeLauncher_EP1','SCAR_Base','SCAR_L_Base','SCAR_H_Base','PKT_high_AI_dispersion','PKT_high_AI_dispersion_tank',
'AGS30_heli','M32_heli','CZ805_A1_ACR','CZ805_A1_GL_ACR','CZ805_B_GL_ACR','2A42_AI','ATKMK44_ACR_AI','M242_AI','M242BC_AI',
'CTWS_AI','M256_AI','M68_AI','D81_AI','2A46M_AI','D81CZ_AI','D10_AI','ZiS_S_53_AI','ATKMK44_ACR','D81CZ','2A72','ItemMap_Debug',
'CMFlareLauncher','FlareLauncher','GRAD','GSh23L','GSh23L_L39','GSh301','GSh302','M134','M134_2','MLRS',
'SmokeLauncher','SPG9','TwinM134','TwinVickers','YakB']);
uiSleep 15;
};
};


it is removing weapons from the server but also overwriting something from dayz mod so weapon m107 is spawning.

now i think i need to edit the script so also mags are checked and i can put all banned mags from dayz mod out of there.
 

MikeCandys

Well-Known Member
if((_x in _inv) && (_x != ''))then
{
[_x] spawn {
_y = _this select 0;
_z = _this select 1;
for '_i' from 0 to ({_x == _y} count (weapons player)) do {player removeWeapon _y;};
for '_i' from 0 to ({_x == _z} count (magazines player)) do {player removeMagazines _z;};

for '_w' from 0 to 10 do {uiSleep 0.1;player removeWeapon _y;player removeMagazines _z;};
};

maybe something like that? idk :D
 
Top