Jump to content
Sign in to follow this  
derox

Change clotes

Recommended Posts

Heey:)

I am making a mission on Arma 2 OA.

And i want to make somting. That you can change clotes somting like in dayz when you find a gilli.

I want to make that there is this bag on the ground (CZ_VestPouch_EP1) there will be an option use and then you change in to a other caracter.

but you can do it once. If you activated it the bag will deisapear.

In my mission it will not be a gilli but a hazard dude from that mod.

Plz can somone help me with this that would be great thx.

Share this post


Link to post
Share on other sites

A quick search turned up this script.

this addaction ["change clothes", "uniswitch.sqf"];

private ["_snipos","_rfmpos","_dir","_group"];

_snipos = getPos sni;
_rfmpos = getPos rf;
_dir = getDir player;
_group = group player;

titleText ["Changing Clothes", "BLACK OUT", 2];
sleep 2;
sni setPos _rfmpos;
rf setPos _snipos;

if (player == rf) then
{
[rf] join grpNull;
selectPlayer sni;
[sni] joinSilent _group;
} else
{
[sni] join grpNull;
selectPlayer rf;
[rf] joinSilent _group;
};
sleep 1;
titleText ["Changing Clothes", "BLACK IN", 2];
player setDir _dir;
exit; 

http://forums.bistudio.com/showthread.php?126661-Changing-Unit-Appearance

Hope it helps

Share this post


Link to post
Share on other sites
A quick search turned up this script.

this addaction ["change clothes", "uniswitch.sqf"];

private ["_snipos","_rfmpos","_dir","_group"];

_snipos = getPos sni;
_rfmpos = getPos rf;
_dir = getDir player;
_group = group player;

titleText ["Changing Clothes", "BLACK OUT", 2];
sleep 2;
sni setPos _rfmpos;
rf setPos _snipos;

if (player == rf) then
{
[rf] join grpNull;
selectPlayer sni;
[sni] joinSilent _group;
} else
{
[sni] join grpNull;
selectPlayer rf;
[rf] joinSilent _group;
};
sleep 1;
titleText ["Changing Clothes", "BLACK IN", 2];
player setDir _dir;
exit; 

http://forums.bistudio.com/showthread.php?126661-Changing-Unit-Appearance

Hope it helps

Thx it worked but this is just for 1 player i tink. Because if you activate it player sni will change to player rf.

And i need more because my mission is a multiplayer mission.

+you dont keep your gear. Its like a survival mission where you have to find gear.

Edited by Derox

Share this post


Link to post
Share on other sites

You could change the script to create a unit and switch over instead of using an existing unit. Also you just have to save weapons player and magazines player and readd them to the new unit.

Share this post


Link to post
Share on other sites
Thx it worked but this is just for 1 player i tink. Because if you activate it player sni will change to player rf.

And i need more because my mission is a multiplayer mission.

+you dont keep your gear. Its like a survival mission where you have to find gear.

Well he gave you a good start. Now use that and add what you need.

If you are looking for ArmA 2 scripting commands, here ya go: https://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2

Share this post


Link to post
Share on other sites

Here is a script i found on the forums here somewhere. it transfers unit name and is multiplayer compatible as well.

/*
======================================================================================
by Cyborg11
Version: 1.02 @ 08.01.2010
Parameters: unit addAction ["Change Uniform", "uniformchange.sqf", [newunit,side]];
_unit = unit which gets the action to change the uniform
_newunit = classname of the new unit
_side = side of the new unit
Example: this addAction ["Change uniform", "change_clothes.sqf", ["GUE_Soldier_1",guerr]];
Example 2: player addAction ["Change uniform", "change_clothes.sqf", ["FR_GL",west,true]];

The new unit has the same weapons, magazines and the same name as the old unit
=======================================================================================
*/

// Variables
_unit = _this select 1;		// old unit
_action = _this select 2;	// action id 
_sideold = side _unit;		// side of old unit
_type = typeOf _unit;		// classname of old unit
_posunit = getPos _unit;	// position of the old unit
_VarName = (vehicleVarName _unit);	// Editorname of the old unit
_array = _this select 3;	// the new soldier array => ["FR_GL",west]
_newunit = _array select 0;	// classname of the new unit
_side = _array select 1;	// side of the new unit
_exit = _array select 2;	// if set to true the script will exit
_weapons = ((weapons _unit) - (items _unit));	// weapons of the old unit
_primweap = primaryWeapon _unit;	// primaryWeapon of the old unit
_magazines = magazines _unit;	// magazines of the old unit

_unit setPos [0,0,0];	// teleport the old unit to [0,0,0]
titleText ["Changing uniform ...", "BLACK FADED"];	// Black Screen
_unit removeAction _action;

// Create the new unit
_uniform = group _unit createUnit [_newunit, _posunit, [], 0, "NONE"];
setPlayable _uniform;
sleep 0.5;
If (!isnil ("_uniform")) then {selectPlayer _uniform};

// New Unit gets the sames weapons as the old unit
removeAllWeapons _uniform;
{_uniform addMagazine _x} forEach _magazines;
{_uniform addWeapon _x} forEach _weapons;

// Select the primaryWeapon	
_uniform selectWeapon _primweap;
// Fix for weapons with grenade launcher
_muzzles = getArray(configFile>>"cfgWeapons" >> _primweap >> "muzzles");
_uniform selectWeapon (_muzzles select 0);

sleep 0.2;
deleteVehicle _unit;			// delete old unit
sleep 1;
titleText [" ", "BLACK IN"];	// delete Black Screen
_uniform SetVehicleVarName _VarName;
_uniform call Compile Format ["%1=_This ; PublicVariable ""%1""",_VarName];
If (!isNil ("_exit") && _exit) exitWith{};
_uniform addAction ["Change uniform", "change_clothes.sqf", [_type,_side,true], 0, false, false, ""]; 

//hint format ["Unit: %1\nType: %2\nPosUnit: %3\nArray: %4\nNewUnit: %5\nSide: %6\nVarNameOld: %7\nVarNameNew: %8",_unit,_type,_posunit,_array,_newunit,_side,_VarName,(vehicleVarName _uniform)];

Share this post


Link to post
Share on other sites

Thx it works fine now.

All thx for replying!!!

Share this post


Link to post
Share on other sites

Eeeoo, as I was investing and researching a lot of time in years ago (arma I and II), I just found something very interesting a few weeks ago:

https://dev-heaven.net/docs/cba/files/common/fnc_switchPlayer-sqf.html#CBA_fnc_switchPlayer

this function makes it a lot easier, I checked the code also, and there were a few Elements which you easily forget to involve (regarding Handlers).

I don't know anymore where I saw the code, but it looked pretty well.

But I didn't test it, so I don't know if there are any sideeffects.

You want to know more about sideeffects? Look here: http://community.bistudio.com/wiki/selectPlayer

Note: All my researches were done far before DayZ, and I guess, BIS was investing some time solving locality and Sideeffect-problems.

Share this post


Link to post
Share on other sites
Here is a script i found on the forums here somewhere. it transfers unit name and is multiplayer compatible as well.

Hey 1st post here. I'm usually able to find everything I'm looking for, but too am looking for a solution to this. Nimrod, I read through the script you posted there..I mostly understand it, but I was hoping you could elaborate a touch on how to use it and what part of script goes in what file. Thanks in advance.

Chicago

-EDIT-

I figured it out...ty

Edited by axchicago

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×