BeloffHost 0 Report post Posted July 18, 2016 How to spawn persistent vehicle with inventory in sqf? Share this post Link to post Share on other sites
Warsheep 126 Report post Posted July 18, 2016 ExileServer_object_vehicle_createPersistentVehicle inventory is like any others vehicle box ec. Share this post Link to post Share on other sites
BeloffHost 0 Report post Posted July 18, 2016 12 minutes ago, Warsheep said: ExileServer_object_vehicle_createPersistentVehicle inventory is like any others vehicle box ec. ExileServer_object_vehicle_createPersistentVehicle This doesn't creates inventory. Code example? Share this post Link to post Share on other sites
Warsheep 126 Report post Posted July 18, 2016 no this spawn the pers vehicle, u just need to google howto add gear in a vehicle. ther are 1000+ examples Share this post Link to post Share on other sites
BetterDeadThanZed 1006 Report post Posted July 18, 2016 (edited) 1 hour ago, BeloffHost said: How to spawn persistent vehicle with inventory in sqf? AVS has a setting to make spawned vehicles persistent: Spawn vehicles with random items in them: In your mission.sqm, add this to the custom code section: ExileServer_world_spawnVehicles = "custom\spawnvehicles\ExileServer_world_spawnVehicles.sqf"; //Keeps vehicles spawning within the map Create a folder in your mission pbo called custom\spawnvehicles (or modify the path above and use whatever folder you want) and create a file called ExileServer_world_spawnVehicles.sqf: Spoiler private["_max", "_count", "_roads", "_road", "_position", "_vehicle", "_hitpoints"]; _max = 40; _count = 0; for "_i" from 1 to _max do { _road = getPos (([6150,6150,0] nearRoads 5000) call BIS_fnc_selectRandom); _position = [_road, 0, 5, 5, 0, 99999, 0] call BIS_fnc_findSafePos; _vehicle = [((getArray (configFile >> "CfgSettings" >> "VehicleSpawn" >> "ground")) call BIS_fnc_selectRandom), _road, random 360, true] call ExileServer_object_vehicle_createNonPersistentVehicle; // Add items to vehicle clearMagazineCargoGlobal _vehicle; clearWeaponCargoGlobal _vehicle; clearItemCargoGlobal _vehicle; _vehicleloot1 = ["Exile_Item_EMRE","Exile_Item_GloriousKnakworst","Exile_Item_Surstromming","Exile_Item_SausageGravy","Exile_Item_Catfood","Exile_Item_ChristmasTinner","Exile_Item_BBQSandwich","Exile_Item_Dogfood","Exile_Item_BeefParts","Exile_Item_Cheathas","Exile_Item_Noodles","Exile_Item_SeedAstics","Exile_Item_Raisins","Exile_Item_Moobar","Exile_Item_PlasticBottleCoffee","Exile_Item_PowerDrink","Exile_Item_PlasticBottleFreshWater","Exile_Item_Beer","Exile_Item_EnergyDrink","Exile_Item_MountainDupe","11Rnd_45ACP_Mag","16Rnd_9x21_Mag","30Rnd_9x21_Mag","6Rnd_45ACP_Cylinder","9Rnd_45ACP_Mag","ItemGPS","Exile_Item_Heatpack","ItemRadio","ItemMap","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03"] call BIS_fnc_selectRandom; _vehicleloot2 = ["Exile_Item_EMRE","Exile_Item_GloriousKnakworst","Exile_Item_Surstromming","Exile_Item_SausageGravy","Exile_Item_Catfood","Exile_Item_ChristmasTinner","Exile_Item_BBQSandwich","Exile_Item_Dogfood","Exile_Item_BeefParts","Exile_Item_Cheathas","Exile_Item_Noodles","Exile_Item_SeedAstics","Exile_Item_Raisins","Exile_Item_Moobar","Exile_Item_PlasticBottleCoffee","Exile_Item_PowerDrink","Exile_Item_PlasticBottleFreshWater","Exile_Item_Beer","Exile_Item_EnergyDrink","Exile_Item_MountainDupe","11Rnd_45ACP_Mag","16Rnd_9x21_Mag","30Rnd_9x21_Mag","6Rnd_45ACP_Cylinder","9Rnd_45ACP_Mag","ItemGPS","Exile_Item_Heatpack","ItemRadio","ItemMap","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03"] call BIS_fnc_selectRandom; _vehicleloot3 = ["Exile_Item_DuctTape","Exile_Item_InstaDoc","Exile_Item_PlasticBottleFreshWater","Exile_Item_EMRE"] call BIS_fnc_selectRandom; _vehicle addItemCargoGlobal [_vehicleloot1, (random 2)]; _vehicle addItemCargoGlobal [_vehicleloot2, (random 2)]; _hitpoints = (getAllHitPointsDamage _vehicle) select 0; { if ((random 75) < (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "damageChance"))) then { _vehicle setHitPointDamage [_x, random (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "maximumDamage"))]; }; } forEach _hitpoints; _count = _count + 1; }; format ["Vehicles Spawned: %1", _count] call ExileServer_util_log; true The above code is modified from a post someone else made. I don't recall who. I added the random items in the vehicles. This code also spawns all dynamic vehicles on roads. Edited July 18, 2016 by BetterDeadThanZed Share this post Link to post Share on other sites
BeloffHost 0 Report post Posted July 18, 2016 3 hours ago, Warsheep said: no this spawn the pers vehicle, u just need to google howto add gear in a vehicle. ther are 1000+ examples I've tried this: _vehicleObject addMagazineAmmoCargo [_vehicleCargo_magazines, 1, 1]; _vehicleObject addWeaponCargoGlobal [_vehicleCargo_weapons, 1]; _vehicleObject addBackpackCargoGlobal [_vehicleCargo_container, 1]; _vehicleObject addItemCargoGlobal [_vehicleCargo_items, 1, 1]; And this: _vehicleObject addMagazineAmmoCargo _vehicleCargo_magazines; _vehicleObject addWeaponCargoGlobal _vehicleCargo_weapons; _vehicleObject addBackpackCargoGlobal _vehicleCargo_container; _vehicleObject addItemCargoGlobal _vehicleCargo_items; Vehicle still spawns without inventory. Share this post Link to post Share on other sites
Warsheep 126 Report post Posted July 18, 2016 persistent vehicle= database= gear need to be save in the databese . some tipp: lookaround the dms system (underwater mission) ther its spawns a vehicle with gear Share this post Link to post Share on other sites
BeloffHost 0 Report post Posted July 18, 2016 22 minutes ago, Warsheep said: persistent vehicle= database= gear need to be save in the databese . some tipp: lookaround the dms system (underwater mission) ther its spawns a vehicle with gear How can I display or log value of my string? Want to check which data server receives. Share this post Link to post Share on other sites
Diddl3s 13 Report post Posted September 22, 2017 On 18/07/2016 at 1:23 PM, BetterDeadThanZed said: AVS has a setting to make spawned vehicles persistent: Spawn vehicles with random items in them: In your mission.sqm, add this to the custom code section: ExileServer_world_spawnVehicles = "custom\spawnvehicles\ExileServer_world_spawnVehicles.sqf"; //Keeps vehicles spawning within the map Create a folder in your mission pbo called custom\spawnvehicles (or modify the path above and use whatever folder you want) and create a file called ExileServer_world_spawnVehicles.sqf: Reveal hidden contents private["_max", "_count", "_roads", "_road", "_position", "_vehicle", "_hitpoints"]; _max = 40; _count = 0; for "_i" from 1 to _max do { _road = getPos (([6150,6150,0] nearRoads 5000) call BIS_fnc_selectRandom); _position = [_road, 0, 5, 5, 0, 99999, 0] call BIS_fnc_findSafePos; _vehicle = [((getArray (configFile >> "CfgSettings" >> "VehicleSpawn" >> "ground")) call BIS_fnc_selectRandom), _road, random 360, true] call ExileServer_object_vehicle_createNonPersistentVehicle; // Add items to vehicle clearMagazineCargoGlobal _vehicle; clearWeaponCargoGlobal _vehicle; clearItemCargoGlobal _vehicle; _vehicleloot1 = ["Exile_Item_EMRE","Exile_Item_GloriousKnakworst","Exile_Item_Surstromming","Exile_Item_SausageGravy","Exile_Item_Catfood","Exile_Item_ChristmasTinner","Exile_Item_BBQSandwich","Exile_Item_Dogfood","Exile_Item_BeefParts","Exile_Item_Cheathas","Exile_Item_Noodles","Exile_Item_SeedAstics","Exile_Item_Raisins","Exile_Item_Moobar","Exile_Item_PlasticBottleCoffee","Exile_Item_PowerDrink","Exile_Item_PlasticBottleFreshWater","Exile_Item_Beer","Exile_Item_EnergyDrink","Exile_Item_MountainDupe","11Rnd_45ACP_Mag","16Rnd_9x21_Mag","30Rnd_9x21_Mag","6Rnd_45ACP_Cylinder","9Rnd_45ACP_Mag","ItemGPS","Exile_Item_Heatpack","ItemRadio","ItemMap","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03"] call BIS_fnc_selectRandom; _vehicleloot2 = ["Exile_Item_EMRE","Exile_Item_GloriousKnakworst","Exile_Item_Surstromming","Exile_Item_SausageGravy","Exile_Item_Catfood","Exile_Item_ChristmasTinner","Exile_Item_BBQSandwich","Exile_Item_Dogfood","Exile_Item_BeefParts","Exile_Item_Cheathas","Exile_Item_Noodles","Exile_Item_SeedAstics","Exile_Item_Raisins","Exile_Item_Moobar","Exile_Item_PlasticBottleCoffee","Exile_Item_PowerDrink","Exile_Item_PlasticBottleFreshWater","Exile_Item_Beer","Exile_Item_EnergyDrink","Exile_Item_MountainDupe","11Rnd_45ACP_Mag","16Rnd_9x21_Mag","30Rnd_9x21_Mag","6Rnd_45ACP_Cylinder","9Rnd_45ACP_Mag","ItemGPS","Exile_Item_Heatpack","ItemRadio","ItemMap","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03","Exile_Item_Can_Empty","Exile_Item_ToiletPaper","Exile_Item_PlasticBottleEmpty","Exile_Item_Magazine01","Exile_Item_Magazine02","Exile_Item_Magazine03"] call BIS_fnc_selectRandom; _vehicleloot3 = ["Exile_Item_DuctTape","Exile_Item_InstaDoc","Exile_Item_PlasticBottleFreshWater","Exile_Item_EMRE"] call BIS_fnc_selectRandom; _vehicle addItemCargoGlobal [_vehicleloot1, (random 2)]; _vehicle addItemCargoGlobal [_vehicleloot2, (random 2)]; _hitpoints = (getAllHitPointsDamage _vehicle) select 0; { if ((random 75) < (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "damageChance"))) then { _vehicle setHitPointDamage [_x, random (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "maximumDamage"))]; }; } forEach _hitpoints; _count = _count + 1; }; format ["Vehicles Spawned: %1", _count] call ExileServer_util_log; true The above code is modified from a post someone else made. I don't recall who. I added the random items in the vehicles. This code also spawns all dynamic vehicles on roads. Hey, is it possible to make these vehicles persistent ? I've been frying my head for a good few hours today trying to figure this out, with several different codes. AVS offers way too much for me to warrant using it, it is overkill for what I want and need. I like the code that you have posted, it's simple, to the point and works really well but the only problem is the vehicles do not persist. Thank you for sharing it btw. Share this post Link to post Share on other sites