Sign in to follow this  
Followers 0
BeloffHost

Spawn persistent vehicle

8 posts in this topic

ExileServer_object_vehicle_createPersistentVehicle

inventory is like any others vehicle box ec.

Share this post


Link to post
Share on other sites
Advertisement
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

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

Posted (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 by BetterDeadThanZed

Share this post


Link to post
Share on other sites
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

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
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
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.