Sign in to follow this  
Followers 0
kuplion

[Released] Spawn location vehicles random damage.

10 posts in this topic

Posted (edited)

Afternoon folks,

In the Exile config we can set randomly located vehicles to have a random damage allocated to them but this does not affect vehicles in the spawn zones (probably because by default they're all bikes in spawn zones). Is it possible for anyone to fix this or point me in the right direction? I'm not sure where to begin looking for the files to tinker with.

EDIT: Please see solution here:

 

Edited by kuplion

Share this post


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

Afternoon folks,

In the Exile config we can set randomly located vehicles to have a random damage allocated to them but this does not affect vehicles in the spawn zones (probably because by default they're all bikes in spawn zones). Is it possible for anyone to fix this or point me in the right direction? I'm not sure where to begin looking for the files to tinker with.

Here: @ExileServer\addons\exile_server\exile_server\code

ExileServer_world_spawnSpawnZoneVehicles.sqf

Spoiler

/**
 * ExileServer_world_spawnSpawnZoneVehicles
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_spawnRadius","_vehiclesToSpawn","_markerName","_markerCenterPosition","_numberOfVehiclesToSpawn","_vehicleClassName","_i","_vehiclePosition","_vehicleDirection"];
"Creating spawn zone vehicles..." call ExileServer_util_log;
_spawnRadius = getNumber(configFile >> "CfgSettings" >> "BambiSettings" >> "spawnZoneRadius");
_vehiclesToSpawn = getArray(configFile >> "CfgSettings" >> "BambiSettings" >> "spawnZoneVehicles");
{
    _markerName = _x;
    if (getMarkerType _markerName == "ExileSpawnZone") then
    {
        _markerCenterPosition = getMarkerPos _markerName;
        {
            _numberOfVehiclesToSpawn = _x select 0;
            _vehicleClassName = _x select 1;
            for "_i" from 1 to _numberOfVehiclesToSpawn do
            {
                _vehiclePosition = [_markerCenterPosition, _spawnRadius] call ExileClient_util_world_findRoadPosition;
                if(_vehiclePosition isEqualTo [])exitWith{};
                _vehicleDirection = (random 360);
                [_vehicleClassName, _vehiclePosition, _vehicleDirection, true] call ExileServer_object_vehicle_createNonPersistentVehicle;
            };
        }
        forEach _vehiclesToSpawn;
    };
}
forEach allMapMarkers;
true

Hope that helps B|

1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

Haha, I was just flicking through the serverside files now.

Cheers dude, I shall have a gander and see what I can come up with. :)

Share this post


Link to post
Share on other sites

Posted (edited)

Ok, that was easier than I thought it would be..

This should work:

/**
 * ExileServer_world_spawnSpawnZoneVehicles
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_spawnRadius","_vehiclesToSpawn","_markerName","_markerCenterPosition","_numberOfVehiclesToSpawn","_vehicleClassName","_maximumDamage","_damageChance","_hitpointsData","_hitpoints","_i","_vehiclePosition","_vehicle","_vehicleDirection"];
"Creating spawn zone vehicles..." call ExileServer_util_log;
_spawnRadius = getNumber(configFile >> "CfgSettings" >> "BambiSettings" >> "spawnZoneRadius");
_vehiclesToSpawn = getArray(configFile >> "CfgSettings" >> "BambiSettings" >> "spawnZoneVehicles");
_maximumDamage = getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "maximumDamage");
_damageChance = getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "damageChance");

{
	_markerName = _x;
	if (getMarkerType _markerName == "ExileSpawnZone") then
	{
		_markerCenterPosition = getMarkerPos _markerName;
		{
			_numberOfVehiclesToSpawn = _x select 0;
			_vehicleClassName = _x select 1;
			for "_i" from 1 to _numberOfVehiclesToSpawn do
			{
				_vehiclePosition = [_markerCenterPosition, _spawnRadius] call ExileClient_util_world_findRoadPosition;
				if(_vehiclePosition isEqualTo [])exitWith{};
				_vehicleDirection = (random 360);
				_vehicle = [_vehicleClassName, _vehiclePosition, _vehicleDirection, true] call ExileServer_object_vehicle_createNonPersistentVehicle;
				_hitpointsData = getAllHitPointsDamage _vehicle;
				if !(_hitpointsData isEqualTo []) then 
				{
					_hitpoints = _hitpointsData select 0;
					{
						if ((random 100) < _damageChance) then
						{
							_vehicle setHitPointDamage [_x, random _maximumDamage];
						};
					}
					forEach _hitpoints;
				};
			};
		}
		forEach _vehiclesToSpawn;
	};
}
forEach allMapMarkers;
true

 

Edited by kuplion

Share this post


Link to post
Share on other sites

shouldn't you set it to a max of 99? 100 is full damage = big boom on spawn.

Share this post


Link to post
Share on other sites

I actually pulled that bit straight out of the Exile code in ExileServer_world_spawnVehicles.sqf so it should work fine.

1 person likes this

Share this post


Link to post
Share on other sites

The random 100 in this doesn't refer to the amount of damage applied, just decides whether or not it applies damage at all. Max damage on a player or vehicle is actually 1.  If you refer to the exile_server_config\config.cpp the default setting is 0.9.

2 people like this

Share this post


Link to post
Share on other sites

Posted (edited)

Just to confirm, this is working as intended. Thank you, @Boxman80 for pointing me at the right files.

EDIT: Haha, thank you @ka0s too because I incorrectly tagged Boxman! :P

Edited by kuplion

Share this post


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

The random 100 in this doesn't refer to the amount of damage applied, just decides whether or not it applies damage at all. Max damage on a player or vehicle is actually 1.  If you refer to the exile_server_config\config.cpp the default setting is 0.9.

Makes sense!

Share this post


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

The random 100 in this doesn't refer to the amount of damage applied, just decides whether or not it applies damage at all. Max damage on a player or vehicle is actually 1.  If you refer to the exile_server_config\config.cpp the default setting is 0.9.

 

5 minutes ago, InsertCoins said:

Makes sense!

My apologies, I could have actually explained that myself but was distracted. lol

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.