CassiusMaximus

Spawning vehicles along roads

33 posts in this topic

Advertisement
Guest

Hello @CassiusMaximus,

You don't need to add AVS just to spawn vehicles on road across the map, I have made a custom script that does this by overwriting ExileServer_world_spawnVehicles instead.

gooby

Share this post


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

Hello @CassiusMaximus,

You don't need to add AVS just to spawn vehicles on road across the map, I have made a custom script that does this by overwriting ExileServer_world_spawnVehicles instead.

gooby

Any chance you could share this?

Share this post


Link to post
Share on other sites
Guest
12 minutes ago, kuplion said:

Any chance you could share this?

Sure!

I have optimized the script for Chernarus, so make sure you know the position cords for your map.

Define how many vehicles you want spawned:

_max = 40;

Representing the center of map:

[7700, 8500, 0]

Representing roads within radius 11,000 meters from center of map:

nearRoads 11000

Replace file "ExileServer_world_spawnVehicles.sqf" in "@ExileServer/addons/exile_server/code" with this:

private["_max", "_count", "_roads", "_road", "_position", "_vehicle", "_hitpoints"];
 
_max = 40;
_count = 0;
 
for "_i" from 1 to _max do {
    _road = getPos (([7700, 8500, 0] nearRoads 11000) 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;
    _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

Enjoy

gooby

Share this post


Link to post
Share on other sites
On 4/18/2016 at 0:27 PM, gooby said:

Sure!

I have optimized the script for Chernarus, so make sure you know the position cords for your map.

Define how many vehicles you want spawned:


_max = 40;

Representing the center of map:


[7700, 8500, 0]

Representing roads within radius 11,000 meters from center of map:


nearRoads 11000

Replace file "ExileServer_world_spawnVehicles.sqf" in "@ExileServer/addons/exile_server/code" with this:


private["_max", "_count", "_roads", "_road", "_position", "_vehicle", "_hitpoints"];
 
_max = 40;
_count = 0;
 
for "_i" from 1 to _max do {
    _road = getPos (([7700, 8500, 0] nearRoads 11000) 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;
    _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

Enjoy

gooby

what would i need to change to have the vehicles spawn with a random amount of damage say from 20% too 90%? 

i would like to have some of them spawn without wheels 

Share this post


Link to post
Share on other sites

why???????????
exile have alredy near road spawn inside his code , 

on ExileServer_world_spawnVehicles.sqf just take line 35


			_positionReal = [_position, 25, _gridSize, 5, 0 , 1 , 0 , _spawnedPositions] call BIS_fnc_findSafePos;

and take from ExileServer_world_spawnSpawnZoneVehicles.sqf line 26


				_vehiclePosition = [_markerCenterPosition, _spawnRadius] call ExileClient_util_world_findRoadPosition;

then just look for the variables and finished is the rdm roadspawn , u dont need to change all stuff clientside 

Share this post


Link to post
Share on other sites
On 4/18/2016 at 7:27 AM, gooby said:

Sure!

I have optimized the script for Chernarus, so make sure you know the position cords for your map.

Define how many vehicles you want spawned:


_max = 40;

Representing the center of map:


[7700, 8500, 0]

Representing roads within radius 11,000 meters from center of map:


nearRoads 11000

Replace file "ExileServer_world_spawnVehicles.sqf" in "@ExileServer/addons/exile_server/code" with this:


private["_max", "_count", "_roads", "_road", "_position", "_vehicle", "_hitpoints"];
 
_max = 40;
_count = 0;
 
for "_i" from 1 to _max do {
    _road = getPos (([7700, 8500, 0] nearRoads 11000) 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;
    _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

Enjoy

gooby

@Eichi This would be a great feature of Exile - spawning vehicles "near" the roads to prevent them from spawning way out in "debug land".

Share this post


Link to post
Share on other sites
8 minutes ago, BetterDeadThanZed said:

@Eichi This would be a great feature of Exile - spawning vehicles "near" the roads to prevent them from spawning way out in "debug land".

I agree. I've never understood why by default the majority of vehicles spawn in the middle of fields. Some, sure, but not all.

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

  • Recently Browsing   0 members

    No registered users viewing this page.