BetterDeadThanZed

Random uniforms for bambis

14 posts in this topic

Using resources I found on these forums, I found out how to give my players a random uniform when spawning in as a bambi. It is working fine for Lingor, which allows players to choose a spawn point. When I tested it on Namalsk, with spawn selection turned off (removed the spawn markers so players spawn randomly), I spawn with the regular convict coveralls. I'm guessing when spawning with this method, it doesn't use the same file I am overriding when using spawn selection.

I am overriding ExileServer_object_player_network_createPlayerRequest.sqf with this version: 

Spoiler

/**
 * ExileServer_object_player_network_createPlayerRequest
 *
 * 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["_sessionID","_parameters","_requestingPlayer","_spawnLocationMarkerName","_playerUID","_accountData","_bambiPlayer","_cargoType"];
_sessionID = _this select 0;
_parameters = _this select 1;
_requestingPlayer = _sessionID call ExileServer_system_session_getPlayerObject;
_bambiuniforms = ["U_C_Journalist","U_C_Poloshirt_blue","U_C_Poloshirt_burgund","U_C_Poloshirt_salmon","U_C_Poloshirt_stripped","U_C_Poloshirt_tricolour","U_C_Poor_1","U_C_Poor_2","U_C_Poor_shorts_1"] call BIS_fnc_selectRandom;
try
{
	if (isNull _requestingPlayer) then 
	{
		throw format ["Session %1 requested a bambi character, but doesn't have a player object. Hacker or Monday?", _sessionID];
	};
	_spawnLocationMarkerName = _parameters select 0;
	_playerUID = getPlayerUID _requestingPlayer;
	if(_playerUID isEqualTo "")then
	{
		throw format ["Player: '%1' has no player UID. Arma/Steam Sucks!.",name _requestingPlayer];
	};
	_accountData = format["getAccountStats:%1", _playerUID] call ExileServer_system_database_query_selectSingle;
	_group = createGroup independent;
	_bambiPlayer = _group createUnit ["Exile_Unit_Player", [0,0,0], [], 0, "CAN_COLLIDE"];
	_bambiplayer forceadduniform _bambiuniforms;
	removeHeadgear _bambiPlayer;
	{
		_cargoType = _x call ExileClient_util_cargo_getType;
		switch (_cargoType) do
		{
			case 1: 	{ _bambiPlayer addItem _x; };
			case 2: 	{ _bambiPlayer addWeaponGlobal _x; };
			case 3: 	{ _bambiPlayer addBackpackGlobal _x; };
			case 4:		{ _bambiPlayer linkItem _x; };
			default 					{ _bambiPlayer addItem _x; };
		};
	}
	forEach getArray(configFile >> "CfgSettings" >> "BambiSettings" >> "loadOut");
	[_sessionID, _requestingPlayer, _spawnLocationMarkerName, _bambiPlayer, _accountData] call ExileServer_object_player_createBambi;
}
catch
{
	_exception call ExileServer_util_log;
};

 

The lines I added/changed were these:

_bambiuniforms = ["U_C_Journalist","U_C_Poloshirt_blue","U_C_Poloshirt_burgund","U_C_Poloshirt_salmon","U_C_Poloshirt_stripped","U_C_Poloshirt_tricolour","U_C_Poor_1","U_C_Poor_2","U_C_Poor_shorts_1"] call BIS_fnc_selectRandom;

and this line was changed to load one of the uniforms:

	_bambiplayer forceadduniform _bambiuniforms;

So, does the new method of spawning (removal of spawn markers) cause a player to spawn without loading this file or is the uniform overwritten somewhere else with this method?

Share this post


Link to post
Share on other sites
Advertisement
9 hours ago, Digital Purge said:

Did you resolve this?

Yes, I also had to override ExileServer_object_player_createBambi.sqf and put the same lines in that file.

1 person likes this

Share this post


Link to post
Share on other sites
On 4/10/2016 at 0:03 PM, BetterDeadThanZed said:

Yes, I also had to override ExileServer_object_player_createBambi.sqf and put the same lines in that file.

when i do this i spawn with a random uniform but i have no gear only a gun? i had it set up to spawn with a gun, ammo and food in my exile_server_config but when i do this non of those things are in my gear.

Share this post


Link to post
Share on other sites
On 08/03/2016 at 4:01 PM, BetterDeadThanZed said:

Using resources I found on these forums, I found out how to give my players a random uniform when spawning in as a bambi. It is working fine for Lingor, which allows players to choose a spawn point. When I tested it on Namalsk, with spawn selection turned off (removed the spawn markers so players spawn randomly), I spawn with the regular convict coveralls. I'm guessing when spawning with this method, it doesn't use the same file I am overriding when using spawn selection.

I am overriding ExileServer_object_player_network_createPlayerRequest.sqf with this version: 

  Reveal hidden contents


/**
 * ExileServer_object_player_network_createPlayerRequest
 *
 * 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["_sessionID","_parameters","_requestingPlayer","_spawnLocationMarkerName","_playerUID","_accountData","_bambiPlayer","_cargoType"];
_sessionID = _this select 0;
_parameters = _this select 1;
_requestingPlayer = _sessionID call ExileServer_system_session_getPlayerObject;
_bambiuniforms = ["U_C_Journalist","U_C_Poloshirt_blue","U_C_Poloshirt_burgund","U_C_Poloshirt_salmon","U_C_Poloshirt_stripped","U_C_Poloshirt_tricolour","U_C_Poor_1","U_C_Poor_2","U_C_Poor_shorts_1"] call BIS_fnc_selectRandom;
try
{
	if (isNull _requestingPlayer) then 
	{
		throw format ["Session %1 requested a bambi character, but doesn't have a player object. Hacker or Monday?", _sessionID];
	};
	_spawnLocationMarkerName = _parameters select 0;
	_playerUID = getPlayerUID _requestingPlayer;
	if(_playerUID isEqualTo "")then
	{
		throw format ["Player: '%1' has no player UID. Arma/Steam Sucks!.",name _requestingPlayer];
	};
	_accountData = format["getAccountStats:%1", _playerUID] call ExileServer_system_database_query_selectSingle;
	_group = createGroup independent;
	_bambiPlayer = _group createUnit ["Exile_Unit_Player", [0,0,0], [], 0, "CAN_COLLIDE"];
	_bambiplayer forceadduniform _bambiuniforms;
	removeHeadgear _bambiPlayer;
	{
		_cargoType = _x call ExileClient_util_cargo_getType;
		switch (_cargoType) do
		{
			case 1: 	{ _bambiPlayer addItem _x; };
			case 2: 	{ _bambiPlayer addWeaponGlobal _x; };
			case 3: 	{ _bambiPlayer addBackpackGlobal _x; };
			case 4:		{ _bambiPlayer linkItem _x; };
			default 					{ _bambiPlayer addItem _x; };
		};
	}
	forEach getArray(configFile >> "CfgSettings" >> "BambiSettings" >> "loadOut");
	[_sessionID, _requestingPlayer, _spawnLocationMarkerName, _bambiPlayer, _accountData] call ExileServer_object_player_createBambi;
}
catch
{
	_exception call ExileServer_util_log;
};

 

The lines I added/changed were these:


_bambiuniforms = ["U_C_Journalist","U_C_Poloshirt_blue","U_C_Poloshirt_burgund","U_C_Poloshirt_salmon","U_C_Poloshirt_stripped","U_C_Poloshirt_tricolour","U_C_Poor_1","U_C_Poor_2","U_C_Poor_shorts_1"] call BIS_fnc_selectRandom;

and this line was changed to load one of the uniforms:


	_bambiplayer forceadduniform _bambiuniforms;

So, does the new method of spawning (removal of spawn markers) cause a player to spawn without loading this file or is the uniform overwritten somewhere else with this method?

Zed I had this workiing- im settiing up a new server and t doesnt want to play 

Share this post


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

Zed I had this workiing- im settiing up a new server and t doesnt want to play 

You can't bring your car to a mechanic and say "It doesn't work." 

More information, perhaps?

Share this post


Link to post
Share on other sites
19 hours ago, BetterDeadThanZed said:

You can't bring your car to a mechanic and say "It doesn't work." 

More information, perhaps?

So im setting up a second server, on the first one i have "random" uniforms. (which I followed from above)

I have copied the files over and it doesn't spawn with random outfits. Is there another file I should be looking at? 

 

 

Share this post


Link to post
Share on other sites

It's just a matter of copying over the two files and adding the entries in the customcode section of your config.cpp.

Share this post


Link to post
Share on other sites

Just like all the other scripts out there, the version posted here uses the 0.9.6 files. If you want to make it work for 0.9.8, you'll need to get the new version of the files and modify them using the old files as an example. I am still in the process of updating my server so I haven't gotten around to updating this yet. It may be Sunday or Monday before I can edit this.

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.