Jump to content
Sign in to follow this  
=101AD=Richard

Setflagtexture local

Recommended Posts

I am designing a script to add a flag to a pole and raise it, Everything works fine in my editor but when you put it in a dedicated server you cannot add the flag properly because it is being executed locality, I have tried a few things that I thought would work but no luck as of yet. The flag will only show to the person who uses the addaction, would I be better off making the command a global command with event handlers or another way. I tried to use setobjecttexture but this did not seem to work the code I am trying is below. any help would be appreciated.

_chair = (fp);
_unit = _this select 1; 
_id = _this select 2;
dfp removeAction _id;
dfp removeAction lflag;
fp removeAction lflag;
dfp removeAction aflag;

_chair setFlagTexture "\ca\ca_e\data\flag_us_co.paa";
rflag = dfp addaction ["Raise Flag","raiseflag.sqf",[fp,true]];
dflag = dfp addaction ["Detach Flag","detachflag.sqf",[dfp,true]];

Edited by =101AD=Richard

Share this post


Link to post
Share on other sites

Hi,

the easy way is:

_chair = (fp);
_unit = _this select 1; 
_id = _this select 2;
dfp removeAction _id;
dfp removeAction lflag;
fp removeAction lflag;
dfp removeAction aflag;

[b][color="SeaGreen"]_chair setVehicleInit "this setFlagTexture '\ca\ca_e\data\flag_us_co.paa'";
processInitCommands;[/color][/b]

rflag = dfp addaction ["Raise Flag","raiseflag.sqf",[fp,true]];
dflag = dfp addaction ["Detach Flag","detachflag.sqf",[dfp,true]];

Performance friendly variant would be (For BIG missions with lots of traffic):

Init.sqf

"changeFlagTexture" addPublicVariableEventHandler {
_data = (_this select 1);
_flag = (_this select 1) select 0;
_texture = (_this select 1) select 1;
_flag setFlagTexture _texture;
};

// For JIPs
if (!isNil "changeFlagTexture") then { (changeFlagTexture select 0) setFlagTexture (changeFlagTexture select 1); };

_chair = (fp);
_unit = _this select 1; 
_id = _this select 2;
dfp removeAction _id;
dfp removeAction lflag;
fp removeAction lflag;
dfp removeAction aflag;

_chair setFlagTexture "\ca\ca_e\data\flag_us_co.paa";
[color="SeaGreen"][b]changeFlagTexture = [_chair, "\ca\ca_e\data\flag_us_co.paa"]; publicVariable "changeFlagTexture";[/b][/color]

rflag = dfp addaction ["Raise Flag","raiseflag.sqf",[fp,true]];
dflag = dfp addaction ["Detach Flag","detachflag.sqf",[dfp,true]];

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  

×