Results 1 to 3 of 3

Thread: Setflagtexture local

  1. #1

    Setflagtexture local (Fixed)

    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.

    Code:
    _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]];
    Last edited by =101AD=Richard; Jan 26 2012 at 13:01.

  2. #2
    Master Sergeant sxp2high's Avatar
    Join Date
    Jul 16 2009
    Location
    nearestLocation [(getPos player), "nameCity"];
    Posts
    605
    Hi,

    the easy way is:

    Code:
    _chair = (fp);
    _unit = _this select 1; 
    _id = _this select 2;
    dfp removeAction _id;
    dfp removeAction lflag;
    fp removeAction lflag;
    dfp removeAction aflag;
    
    _chair setVehicleInit "this setFlagTexture '\ca\ca_e\data\flag_us_co.paa'";
    processInitCommands;
    
    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
    Code:
    "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); };
    Code:
    _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";
    changeFlagTexture = [_chair, "\ca\ca_e\data\flag_us_co.paa"]; publicVariable "changeFlagTexture";
    
    rflag = dfp addaction ["Raise Flag","raiseflag.sqf",[fp,true]];
    dflag = dfp addaction ["Detach Flag","detachflag.sqf",[dfp,true]];

  3. #3
    Thank you I will try this

    Thank you this worked perfectly
    Last edited by =101AD=Richard; Jan 26 2012 at 13:01.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •