derox 3 Posted August 19, 2013 Heey I am making a mission with units that have custom skins. using this setObjectTexture [0, "texture\Camo4.paa"];this setObjectTexture [1, "texture\Camo.paa"];this setObjectTexture [2, "texture\Camo2.paa"];[/Code]This is the code in the unit.[Code]this setObjectTexture [0, "texture\Camo4.paa"];this setObjectTexture [1, "texture\Camo.paa"];this setObjectTexture [2, "texture\Camo2.paa"];removeallweapons this;this addweapon "M16A2";this addMagazine "30Rnd_556x45_Stanag";this addMagazine "30Rnd_556x45_Stanag";this addMagazine "30Rnd_556x45_Stanag";this addMagazine "30Rnd_556x45_Stanag";this addMagazine "30Rnd_556x45_Stanag";this addMagazine "30Rnd_556x45_Stanag";[/Code]What my problem is that if a Unit get killed. He will respawn but not with his custom skin i made.I tryed to do this with a trigger. i gave the unit a name "P1" and the trigger wil activate if P1 dies.then after a few second he will run this line that replaces the texture. But it has too be MP comptable. And it works some times but i need it too work 100%And i have to make a trigger for evrey single unit. (25 units).So can anybody help me with this problem?TriggerMin[Code]5[/Code]Mid[Code]5[/Code]Max[Code]5[/Code]Condition[Code]!alive p1[/Code]On Act[Code]p1 setObjectTexture [0, "texture\Camo4.paa"];p1 setObjectTexture [1, "texture\Camo.paa"];p1 setObjectTexture [2, "texture\Camo2.paa"]; removeallweapons p1;[/Code] Share this post Link to post Share on other sites
xxanimusxx 2 Posted August 19, 2013 In your init.sqf: if (!isDedicated) then { waitUntil {player == player}; player addEventHandler ["Respawn", { _unit = _this select 0; _unit setObjectTexture [0, "texture\Camo4.paa"]; _unit setObjectTexture [1, "texture\Camo.paa"]; _unit setObjectTexture [2, "texture\Camo2.paa"]; removeAllWeapons _unit; _unit addWeapon "M16A2"; for "_i" from 1 to 6 do { _unit addMagazine "30Rnd_556x45_Stanag"; }; }]; }; Share this post Link to post Share on other sites
derox 3 Posted August 19, 2013 In your init.sqf: if (!isDedicated) then { waitUntil {player == player}; player addEventHandler ["Respawn", { _unit = _this select 0; _unit setObjectTexture [0, "texture\Camo4.paa"]; _unit setObjectTexture [1, "texture\Camo.paa"]; _unit setObjectTexture [2, "texture\Camo2.paa"]; removeAllWeapons _unit; _unit addWeapon "M16A2"; for "_i" from 1 to 6 do { _unit addMagazine "30Rnd_556x45_Stanag"; }; }]; }; THX it worked. one question can i make this work for cars too? Share this post Link to post Share on other sites
xxanimusxx 2 Posted August 19, 2013 Car's cant "respawn" like players do, you have to keep track of the damage and create a new vehicle of the same type and then you can do the same. You could use the "killed" eventhandler. Share this post Link to post Share on other sites
derox 3 Posted August 19, 2013 Ill try somting out XD i am not a realy good scripter. But thx again :D Share this post Link to post Share on other sites
xxanimusxx 2 Posted August 19, 2013 Well if you describe your exact scenario with your vehicles, I could try to throw you some chunks of code :) Share this post Link to post Share on other sites
derox 3 Posted August 19, 2013 Well i am gona have diffrent sets of cars like Trucks and hummwv's and they all gona have textures on it with a logo from biohazard. same as the units. but if they get destroyed they have to respawn. but they need too hold there texture if they spawn. Init of the hummwv this setObjectTexture [0, "texture\Camo4.paa"];this setObjectTexture [1, "texture\Camo4.paa"];this setObjectTexture [2, "texture\Camo4.paa"];this setObjectTexture [3, "texture\Camo4.paa"];this setObjectTexture [4, "texture\Camo4.paa"]; And i dont have a truck yet. but i am gona make like hummwv's truck's heli's all that stuff. ---------- Post added at 18:05 ---------- Previous post was at 17:42 ---------- In your init.sqf: if (!isDedicated) then { waitUntil {player == player}; player addEventHandler ["Respawn", { _unit = _this select 0; _unit setObjectTexture [0, "texture\Camo4.paa"]; _unit setObjectTexture [1, "texture\Camo.paa"]; _unit setObjectTexture [2, "texture\Camo2.paa"]; removeAllWeapons _unit; _unit addWeapon "M16A2"; for "_i" from 1 to 6 do { _unit addMagazine "30Rnd_556x45_Stanag"; }; }]; }; There is only one problem. I just found out in MP if i die i can see the texture if i respawn but my friend just sees my normal texture that belongs too the game. But if the mission start he sees me with the custom skin but if i die and respawn I can only see my custom skin and he cant Share this post Link to post Share on other sites
xxanimusxx 2 Posted August 20, 2013 Ah yes, didn't look up the setObjectTexture command, it's effect is local, so we have to broadcast the command to every client: changeVehicleTexture = { private ["_vehicle", "_textures", "_initCmmd", "_textureID"]; _vehicle = _this select 0; _textures = _this select 1; _initCmmd = ""; _textureID = 0; { _initCmmd = _initCmmd + format["this setObjectTexture [%1, ""%2""];", _textureID, _x]; _textureID = _textureID + 1; } forEach _textures; _vehicle setVehicleInit _initCmmd; processInitCommands; }; if (!isDedicated) then { waitUntil {player == player}; player addEventHandler ["Respawn", { _unit = _this select 0; removeAllWeapons _unit; _unit addWeapon "M16A2"; for "_i" from 1 to 6 do { _unit addMagazine "30Rnd_556x45_Stanag"; }; [_unit, ["texture\Camo4.paa","texture\Camo.paa","texture\Camo2.paa"]] call changeVehicleTexture; }]; }; And to show you the direction to vehicle-respawns: myCar addEventHandler ["killed", { // this will create the same type of vehicle at the same position where the former one was damaged _newVehicle = createVehicle [typeOf (_this select 0), position (_this select 0), [], 0, "NONE"]; deleteVehicle (_this select 0); [_newVehicle, ["texture\Camo4.paa","texture\Camo4.paa","texture\Camo4.paa","texture\Camo4.paa"]] call changeVehicleTexture; }]; This is highly experimental though, didn't test any of these and there are far better respawn-scripts out there! Share this post Link to post Share on other sites
derox 3 Posted August 20, 2013 Ah yes, didn't look up the setObjectTexture command, it's effect is local, so we have to broadcast the command to every client: changeVehicleTexture = { private ["_vehicle", "_textures", "_initCmmd", "_textureID"]; _vehicle = _this select 0; _textures = _this select 1; _initCmmd = ""; _textureID = 0; { _initCmmd = _initCmmd + format["this setObjectTexture [%1, ""%2""];", _textureID, _x]; _textureID = _textureID + 1; } forEach _textures; _vehicle setVehicleInit _initCmmd; processInitCommands; }; if (!isDedicated) then { waitUntil {player == player}; player addEventHandler ["Respawn", { _unit = _this select 0; removeAllWeapons _unit; _unit addWeapon "M16A2"; for "_i" from 1 to 6 do { _unit addMagazine "30Rnd_556x45_Stanag"; }; [_unit, ["texture\Camo4.paa","texture\Camo.paa","texture\Camo2.paa"]] call changeVehicleTexture; }]; }; And to show you the direction to vehicle-respawns: myCar addEventHandler ["killed", { // this will create the same type of vehicle at the same position where the former one was damaged _newVehicle = createVehicle [typeOf (_this select 0), position (_this select 0), [], 0, "NONE"]; deleteVehicle (_this select 0); [_newVehicle, ["texture\Camo4.paa","texture\Camo4.paa","texture\Camo4.paa","texture\Camo4.paa"]] call changeVehicleTexture; }]; This is highly experimental though, didn't test any of these and there are far better respawn-scripts out there! Okey i am gona test it Thx again XD Share this post Link to post Share on other sites