Teraz jest Cz 28 mar, 2024 13:52


Zmiana munduru (podmiana jednostki)

Dział poświęcony edytorowi ArmA II i Operation Arrowhead, czyli tworzeniu misji.
  • Autor
  • Wiadomość
Offline

VeaVictis

Kapral

Kapral

  • Posty: 53
  • Dołączył(a): Wt 23 cze, 2009 10:22
  • Lokalizacja: lubuskie

Zmiana munduru (podmiana jednostki)

PostPn 19 wrz, 2011 10:19

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ć."
"Spadochroniarze nie umierają... Idą do piekła,żeby sie przegrupować".
Offline

tom3kb

Major

Major

  • Posty: 523
  • Dołączył(a): Pt 04 mar, 2011 07:35

PostPn 19 wrz, 2011 11:03

Tutaj kiedyś pomagałem rozkminić jak takie coś prosto można zrobić, w kampanii Gambit Royale tam jest to zrobione i działało na 100%
http://www.forum.armacenter.pl/viewtopi ... orm+tom3kb
Podobny patent jest w ostatniej misji z kampanii Blood on the sand jak rozpakujesz to zobaczysz jak tam Zipper5 to zrobił.

Powrót do [ArmA II] Edytor

Kto przegląda forum

Użytkownicy przeglądający ten dział: Brak zidentyfikowanych użytkowników i 7 gości

cron