Jump to content
-TFP- Bridge.J

Help needed with init eventHandler and textures

Recommended Posts

EDIT: Ok so I figured it out, had to change

class eventHandlers 
{
     init = "nul = [_this] execVM ""\JTFS_Uniforms\scripts\scr_changeuniforms.sqf""";
};

to this in the config:

class eventHandlers
{
     init = "nul = [(_this select 0)] execVM ""\JTFS_Uniforms\scripts\scr_changeuniforms.sqf""";
};

So apparently this makes a big difference .. oh well I'm just glad it's all working :)

 

Hi all, so I'm working on a script/change to our addon to allow our mission makers to define our camouflage pattern, so our units read a variable and then change the texture accordingly.

 

Here's a snippet from my unit config so you guys can see where it fits in:

scope = 2;
displayName = "Sabre 1-0 Squad Leader - Bridge";
faction = "JTFS";
vehicleClass = "JTFS_I_SABRE_D";
		
icon = "iconManLeader";
		
class eventHandlers 
{
     init = "nul = [_this] execVM ""\JTFS_Uniforms\scripts\scr_changeuniforms.sqf""";
};
		
weapons[] = {"JTFS_M4A1_M320", "Laserdesignator", "Put", "Throw"};
respawnWeapons[] = {"JTFS_M4A1_M320", "Laserdesignator", "Put", "Throw"};

And "scr_changeuniforms" is the following:

_unit = _this select 0;

sleep 2; 

if (JTFS_CAMO == "WOODLAND") then {

	_unit setObjectTextureGlobal [0, "\JTFS_Uniforms\data\jtfs_uniform_m81_1.paa"];

};

So JTFS_CAMO is the variable defined in the init.sqf of the mission... that part works fine.

 

However the texture does not change when placing the unit, however I can run the exact code from "scr_changeuniforms" (changing _unit to _this of course) in the debug monitor and it works perfectly.

 

So I'm guessing it's something to do with the init eventhandler but I don't know for sure. Tearing my hair out over this one so would be great if someone could offer some insight.

 

Cheers,

 

Bridge

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

×