Jump to content
Sign in to follow this  
Kydoimos

Setobjecttexture Not Visible on Multiplayer for Clients

Recommended Posts

Hi chaps - can anybody give me a script or a command that will enable .paa files set with the setobjecttexture command to be visible for clients on a server? At the moment, only default textures are visible, except for the host. I saw some other threads but they related to Arma 2. Thanks in advance for any help anybody can give me with this!

Share this post


Link to post
Share on other sites

setObjectTexture is local, so every client in MP would need to run the command in order to see what you want them to see.

Share this post


Link to post
Share on other sites

In case you need to do it after the mission starts:

_unit setVehicleInit "this setObjectTexture [0, 'texture.paa']";

processInitCommands;

Share this post


Link to post
Share on other sites
In case you need to do it after the mission starts:

_unit setVehicleInit "this setObjectTexture [0, 'texture.paa']";

processInitCommands;

that command is obsolete.

Share this post


Link to post
Share on other sites

Thanks guys, that's great. I'm new to scripting for MP missions though, so how do I run the setobjecttexture command for every client? Do I put the command in the init line of all the playable units? Sorry, this is basic stuff I know, but I'm learning more every day. Thanks again for your answers :)

Share this post


Link to post
Share on other sites

In the 2D editor what ever object texture you want to change. http://i.imgur.com/V1SUsHp.jpg You only have to do it once because all clients will have to run every init of every object when they connect. This will make your code global to all who connect.

Share this post


Link to post
Share on other sites

Ah okay, thanks Johnson. So the 'this setobjecttexture [0,"texture.paa"];' command in the init line of a unit will be enough for it to be seen globally. How do I re-run the command for re-spawn? It's strange, because somebody play tested a mission template I've made and they said that, despite the command above being in the init line of the units, they could not see the textures client-side. Could be a problem their end, I'll have to check myself and report back. Thanks guys!

Share this post


Link to post
Share on other sites

When someone respawns I think it's a totally new unit. So it won't have the setObjectTexture I'm not 100% sure about this. I remember having this issue with the vehicles re spawning and for the code I had to put the init all over again.

veh = [this, 15, 10, 5, TRUE, FALSE, "this setDammage 0.5"] execVM "vehicle.sqf"

notice the *this setDammage 0.5". That is the init commands that would be put on the vehicle onced it respawned because it is a new vehicle because the old one is deleted. By the way this code won't work unless you have the file don't try to copy this code thinking it will work. Now if you are still having trouble with everyone seeing the object try this command.

[[{this setobjecttexture [0,"texture.paa"];}],"BIS_fnc_Spawn",true,true] call BIS_fnc_MP;

put this code inside the init box of the object. If that doesn't work maybe it is still a bug that has already been reported to the feedback tracker.

Share this post


Link to post
Share on other sites

Hearing some worrying things from people saying it's not possible to have setobjecttexture as global? Please tell me that's not true! :p

Share this post


Link to post
Share on other sites
Hearing some worrying things from people saying it's not possible to have setobjecttexture as global? Please tell me that's not true! :p

Yup, that's what I told you 7 minutes after you started this thread. :) Johnson posted an example of how to run it on all clients just above your latest post.

Share this post


Link to post
Share on other sites

It is possible for them to be global. They just need to be ran on everybody so everyone will see the same thing. I might release a set of functions that people can use to run stuff on all clients a bit later...

EDIT:

function needs to be ran before anything else:

fn_objecttexture =
{
_unit = _this select 0;
_texture = _this select 1;
_unit setobjecttexture _texture;
};

how to call it:

[[player,[0,'textures\police.jpg']], "fn_objecttexture",nil,false] spawn BIS_fnc_MP;

--unit to run on -- texture -- function to call

Edited by austin_medic

Share this post


Link to post
Share on other sites

Never been a global command.

Partly because the textures can be use ONLY client side.

You just need a "monitor" client script that swaps textures whenever the server changes them. Cascade out.

Share this post


Link to post
Share on other sites

Ok - thank you everybody for reiterating what you already told me - it's much clearer now. Sorry! I didn't quite grasp what you meant. I'm working on a lot of artwork and things for a server and I'm trying to take care of as much as scripting as I can - but it's mostly over my head. This makes more sense - again, thank you guys!

---------- Post added at 07:51 ---------- Previous post was at 07:42 ----------

Okay, I can see from Austin_Medic's example that I need to call the code. So, bear with me, I take it the 'function' code needs to go in the description file or something? One of those .sqf file thingy-me-bobs? And then, the code lower down goes in the .init line? I don't quite know what a monitor client script is, however? But I can look that up later. Again - thanks everybody for your patience, I've learnt so much with all your help. Here's how things are shaping up with all those user textures I want everyone to see: http://steamcommunity.com/profiles/76561198007919065/screenshots/. It might make things easier in my mind if I say we have a unit named: 'Soldier_1' and a texture named 'Soldier_Uniform_1.paa'. Does that mean Austin_Medic's function code would look like: fn_objecttexture =

{

Soldier_1 = this select 0;

Soldier_Uniform_1.paa = this select 1;

Soldier_1 setobjecttexture [0,"Soldier_Uniform_1.paa"];

};

Edited by Kydoimos

Share this post


Link to post
Share on other sites

So okay; here's what I've got: this setobjecttexture [0,"Altis_Camouflage_01.paa"]; nul = [this, [0,"Altis_Camouflage_01.paa"]] execVM "textureDisplay.sqf"; and then an .sqf file with:

_unit = _this select 0;

_texture = _this select 1;

_unit setObjectTexture _texture;

---------- Post added at 07:01 ---------- Previous post was at 06:53 ----------

Now, what this does is it enables AI uniforms to be seen on multiplayer. But the players' are still not showing up - where am I going wrong? Ignore the double "" in this, but essentially it is what I've got: removeheadgear this; removevest this; removeuniform this; this addVest ""V_PlateCarrier2_rgr""; this addHeadgear ""H_HelmetB""; this adduniform ""U_I_CombatUniform""; this setobjecttexture [0,""NRF_US_Ranger_ACU_Empty.paa""]; nul = [this, [0,""NRF_US_Ranger_ACU_Empty.paa""]] execVM ""textureDisplay.sqf""; this unassignitem ""NVGoggles"";";

};

};

---------- Post added at 07:15 ---------- Previous post was at 07:01 ----------

An example of the full code is: init="if(local this) then { removeallweapons this; removeheadgear this; removevest this; removebackpack this; removeUniform this; this unassignItem ""NVGoggles""; this removeItem ""NVGoggles""; this unassignItem ""ItemMap""; this removeItem ""ItemMap""; this unassignItem ""ItemGPS""; this removeItem ""ItemGPS""; this addUniform ""U_I_CombatUniform""; this setobjecttexture [0,""NRF_US_Ranger_ACU_Empty.paa""]; nul = [this, [0,""NRF_US_Ranger_ACU_Empty.paa""]] execVM ""textureDisplay.sqf""; this addVest ""V_TacVest_oli""; this addHeadgear ""H_HelmetCrew_I""; this addGoggles ""G_Combat""; this addWeapon ""rangefinder""; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""SmokeShellBlue"", 30]; this addMagazine [""SmokeShellBlue"", 30]; this addMagazine [""SmokeShellBlue"", 30]; this addMagazine [""SmokeShellGreen"", 30]; this addMagazine [""SmokeShellGreen"", 30]; this addMagazine [""SmokeShellGreen"", 30]; this addWeapon ""arifle_MXC_F""; this addPrimaryWeaponItem ""optic_ACO_grn""; };";

description="19D Cavalry Crewman";

Share this post


Link to post
Share on other sites

Sorry if the above is a bit of a text wall!

Share this post


Link to post
Share on other sites

Use code/php tags around code samples and look into using BIS_fnc_addWeapon :)

Share this post


Link to post
Share on other sites
So okay; here's what I've got: this setobjecttexture [0,"Altis_Camouflage_01.paa"]; nul = [this, [0,"Altis_Camouflage_01.paa"]] execVM "textureDisplay.sqf"; and then an .sqf file with:

_unit = _this select 0;

_texture = _this select 1;

_unit setObjectTexture _texture;

---------- Post added at 07:01 ---------- Previous post was at 06:53 ----------

Now, what this does is it enables AI uniforms to be seen on multiplayer. But the players' are still not showing up - where am I going wrong? Ignore the double "" in this, but essentially it is what I've got: removeheadgear this; removevest this; removeuniform this; this addVest ""V_PlateCarrier2_rgr""; this addHeadgear ""H_HelmetB""; this adduniform ""U_I_CombatUniform""; this setobjecttexture [0,""NRF_US_Ranger_ACU_Empty.paa""]; nul = [this, [0,""NRF_US_Ranger_ACU_Empty.paa""]] execVM ""textureDisplay.sqf""; this unassignitem ""NVGoggles"";";

};

};

---------- Post added at 07:15 ---------- Previous post was at 07:01 ----------

An example of the full code is: init="if(local this) then { removeallweapons this; removeheadgear this; removevest this; removebackpack this; removeUniform this; this unassignItem ""NVGoggles""; this removeItem ""NVGoggles""; this unassignItem ""ItemMap""; this removeItem ""ItemMap""; this unassignItem ""ItemGPS""; this removeItem ""ItemGPS""; this addUniform ""U_I_CombatUniform""; this setobjecttexture [0,""NRF_US_Ranger_ACU_Empty.paa""]; nul = [this, [0,""NRF_US_Ranger_ACU_Empty.paa""]] execVM ""textureDisplay.sqf""; this addVest ""V_TacVest_oli""; this addHeadgear ""H_HelmetCrew_I""; this addGoggles ""G_Combat""; this addWeapon ""rangefinder""; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""30Rnd_65x39_caseless_mag_Tracer"", 30]; this addMagazine [""SmokeShellBlue"", 30]; this addMagazine [""SmokeShellBlue"", 30]; this addMagazine [""SmokeShellBlue"", 30]; this addMagazine [""SmokeShellGreen"", 30]; this addMagazine [""SmokeShellGreen"", 30]; this addMagazine [""SmokeShellGreen"", 30]; this addWeapon ""arifle_MXC_F""; this addPrimaryWeaponItem ""optic_ACO_grn""; };";

description="19D Cavalry Crewman";

:/ no no no. You need to run it through BIS_fnc_MP in MP for everybody to see it. Your running the same command on the same player just for everybody instead of just him so everybody sees the same thing.

run this in init.sqf or another SQF that loads before anything else.

fn_objecttexture = 
{
_unit = _this select 0;
_texture = _this select 1;
_unit setobjecttexture [_texture];
};

then call it from another script with BIS_fnc_MP.

This may confuse the game with the extra comma inside the variables, if so, post here again and i'll change it around so it works.

[[player,0,'path,to,jpeg'],"fn_objecttexture",nil,false] spawn BIS_fnc_MP;

Edited by austin_medic

Share this post


Link to post
Share on other sites

Ah, yes - I think those commas are a problem :) Thanks Austin, for your time! Our server has a lost a scripter and I'm trying to pick up the slack - lol, as you can see, I'm a little in the dark. But totally understand what you're saying now.

Edited by Kydoimos

Share this post


Link to post
Share on other sites

Still haven't had any luck I'm afraid. I've tried with and without the single inverted commas - but I can't get the command to go through. :)

Edited by Kydoimos

Share this post


Link to post
Share on other sites

So close ... tried every variation I can think of, just need a little helper on the above :p I promise to give a special mention in any forthcoming credits!

Share this post


Link to post
Share on other sites

Use austin_medic's idea for changing the textures and you can compress your loadout down to this:

removeAllAssignedItems this; 
removeAllWeapons this; 
removeAllContainers this;

this addUniform "U_I_CombatUniform"; 
this addVest "V_TacVest_oli"; 
this addHeadgear "H_HelmetCrew_I"; 
this addGoggles "G_Combat"; 
this addWeapon "Rangefinder"; 

this addMagazines ["SmokeShellBlue", 3]; 
this addMagazines ["SmokeShellGreen", 3]; 
_muzzle = [this, "arifle_MXC_ACO_F", 7, "30Rnd_65x39_caseless_mag_Tracer"] call BIS_fnc_addWeapon;

instead of this:

removeallweapons this;
removeheadgear this;
removevest this;
removebackpack this;
removeUniform this;
this unassignItem "NVGoggles";
this removeItem "NVGoggles";
this unassignItem "ItemMap";
this removeItem "ItemMap";
this unassignItem "ItemGPS";
this removeItem "ItemGPS";
this addUniform "U_I_CombatUniform";
this addVest "V_TacVest_oli";
this addHeadgear "H_HelmetCrew_I";
this addGoggles "G_Combat";
this addWeapon "rangefinder";
this addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
this addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
this addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
this addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
this addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
this addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
this addMagazine ["30Rnd_65x39_caseless_mag_Tracer", 30];
this addMagazine ["SmokeShellBlue", 30];
this addMagazine ["SmokeShellBlue", 30];
this addMagazine ["SmokeShellBlue", 30];
this addMagazine ["SmokeShellGreen", 30];
this addMagazine ["SmokeShellGreen", 30];
this addMagazine ["SmokeShellGreen", 30];
this addWeapon "arifle_MXC_F";
this addPrimaryWeaponItem "optic_ACO_grn";

Edited by kylania

Share this post


Link to post
Share on other sites

add me on steam (austin_medic) and I'll probably be able to help you better there. I'll this myself and see if it works for me...

Share this post


Link to post
Share on other sites

So - had it working perfectly for a week. Single player. Multiplayer. All good. Then, with BI's fixathon, I can't even get it working outside of the editor! Everyone is in their underwear... again.

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  

×