Jump to content
Sign in to follow this  
gummybear_qc

How can I make a skin changer?

Recommended Posts

How can I make a Skin Changer mod so I can use it as a skin changer in my missions. I dont wanna script the mission, Itl be simplier to have it as .pbo for me. Thank you!

Share this post


Link to post
Share on other sites
By skin I mean like switching from a medic to a sniper, sniper to enginier, and etc.

You can:

1. If you are leader - get all your group units and save it to the variable

2. create new unit with sniper model on your position

3. select this unit using selectPlayer command

4. make all units in group variable join your group with joinSilent

5. delete old soldier object

Share this post


Link to post
Share on other sites

Hi, check the cba switch player function. (https://dev-heaven.net/docs/cba/files/common/fnc_switchPlayer-sqf.html#CBA_fnc_switchPlayer)

But be careful, in multiplayer there can be perhaps some sideeffects because of locality issues.

for more informations check http://community.bistudio.com/wiki/selectPlayer

also search the forums, there are some different solutions nowadays.

Edit: another thing to mention, my knowledge is quite old. With DayZ they might have done a lot on this functions too to solve issues.

Share this post


Link to post
Share on other sites

Ok wrote a small script that changes your model/skin, keeps your weapons, scores, rank, group, units in group, unit name set in the editor.

Usage:

1. Create script file (for ex. changeClass.sqf)

2. Copy/Paste code below and save file

3. Execute script with two arguments - current unit and new model class

For example:

[player, "UN_CDF_Soldier_Officer_EP1"] execVM "scripts\changeClass.sqf";

This will change class of player to UN Soldier;

private ["_unit", "_newUnitType", "_unitType", "_side", "_weapons", "_magazines", "_rank", "_score", "_group", "_units", "_position", "_dir", "_leader", "_varName", "_primWeapon", "_secWeapon", "_newGroup"];

_unit = _this select 0;
_newUnitType = _this select 1;

_unitType = typeOf _unit;

_side = side _unit;
_weapons = weapons _unit;
_magazines = magazines _unit;
_rank = rank _unit;
_score = score _unit;
_group = group _unit;
_units = units _group;
_position = getPosATL _unit;
_dir = getDir _unit;
_leader = leader _unit;
_varName = vehicleVarName _unit;
_primWeapon = primaryWeapon _unit;
_secWeapon = secondaryWeapon _unit;

_newGroup = createGroup _side;
_newUnit = _newGroup createUnit [_newUnitType, [0,0,0], [], 0, "NONE"];

addSwitchableUnit _newUnit;
titleCut ["","black faded", 0];

_unit setVehicleVarName format["old%1", round(random 999)];
_newUnit setVehicleVarName _varName;

_newUnit setPosATL _position;
_newUnit setDir _dir;

_newUnit setRank _rank;
_newUnit addScore _score;

selectPlayer _newUnit;
removeAllWeapons _newUnit;
{ _newUnit addMagazine _x } forEach _magazines;
{ _newUnit addWeapon _x } forEach _weapons;

if (_primWeapon != "") then { _newUnit selectWeapon _primWeapon };
if (_secWeapon != "") then { _newUnit selectWeapon _secWeapon };

_units joinSilent _newGroup;

_newGroup selectLeader _leader;
deleteVehicle _unit;
deleteGroup _group;

removeSwitchableUnit _newUnit;
titleCut ["","PLAIN",0];

Enjoy :)

Share this post


Link to post
Share on other sites

You cant turn SQF to a PBO :)

PBO is just an archive like RAR, ZIP but ArmA compatible

Just use CPBO, PBOView or Mikero's Eliteness to pack your scripts/models/images and other stuff to a PBO file.

Share this post


Link to post
Share on other sites

@BlenderRus How would one go about setting this as an addaction for the player might i ask? So far i've tried the following:

h1 addaction ["Change clothes", "changeskin.sqf" (h1, "UN_CDF_Soldier_Officer_EP1");

To no avail. Though keep in mind I have a very basic basic knowledge of scripting in Arma and as suck, might be doing a simple mistake (and asking a real simple and obvious question)

EDIT: Disregard, i got it to work with some simple modifications :P

Edited by Giorox

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  

×