Zmiana munduru (podmiana jednostki)

Edytor Arma (Arma, Arma2, Arma2OA)

Moderatorzy: kondor, Inkwizytor

ODPOWIEDZ
VeaVictis
Posty: 79
Rejestracja: 19 września 2008, 08:02
ID Steam:
Numer GG: 1489462
ID gracza: 0
Lokalizacja: lubuskie

Zmiana munduru (podmiana jednostki)

Post autor: VeaVictis »

Witam,

Znalazłem na forum BI Studio temat dotyczący zmiany ubrania przez jednostki http://forums.bistudio.com/showthread.p ... ng+clothes

Poniżej zamieszczam skrypt autorstwa Cyborga11
/*
======================================================================================
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", "uniformchange.sqf", ["GUE_Soldier_1",guerr]];
Example 2: player addAction ["Change uniform", "uniformchange.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", "uniformchange.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)];


Problem w tym,że skrypt działa częściowo, tzn. po wybraniu opcji "change uniform" obraz sciemnia się i rozjaśnia się i nadal mam te samą jednostkę. Dodam,że wstawiam w edytorze dwie jednostki, jedna jest nazwana aP (_unit) druga to a1 (_newunit). W sktypcie pojawia się jeszcze inna nazwa (_uniform) nie wiem skąd ona się bierze i do jakiej jednostki sie odnosi, zakładam,że do (_newunit) ale po zmianie zazw i tak nie działa. Pozdrawiam
"Spadochroniarze nie umierają.... Idą do piekła,żeby się przegrupować."
tom3kb
Posty: 511
Rejestracja: 04 marca 2011, 06:30
ID Steam:
ID gracza: 209283
Lokalizacja: Sieradz

Re: Zmiana munduru (podmiana jednostki)

Post autor: tom3kb »

Parę miechów temu już komuś to zapodawałem jak coś takiego prosto zrobić jeden skrypt z kampanii gambit royale i wszystko było ok o ile pamiętam.
http://www.forum.armacenter.pl/viewtopi ... orm+tom3kb
ODPOWIEDZ

Wróć do „Edycja oraz tworzenie misji, skrypty oraz programowanie”