Jump to content
Theassassinzz

Trigger Creation Troubles

Recommended Posts

So I am trying spawn a trigger through a script that then runs other scripts.

 

I can get the trigger to spawn WITHOUT my scripts in the Act/DeAct fields, so I am just stumped on how to get this to work.

Here is the script 

Spoiler

private ["_term","_cas","_rules","_info","_teleport","_mhq"];

_term         =     _this select 0;
_cas         =    _this select 1;
_rules         =    _this select 2;
_info        =    _this select 3;
_teleport    =    _this select 4;
_mhq        =    _this select 5;

_termPos     =     getPos _term;

tz_itemPos     = { 
    _posZ = getPos _term select 2;
    _posZElevated = _posZ + 1.5;
    [
    getPos _term select 0,
    getPos _term select 1,
    _posZElevated
    ]
};
tz_itemPos2 = { 
    _posZ = getPos _term select 2;
    _posZElevated = _posZ + 1;
    [
    getPos _term select 0,
    getPos _term select 1,
    _posZElevated
    ]
};

tz_vehicleTrig = {
    //_trg setTriggerStatements ["this", "hint 'Civilian near player'", "hint 'no civilian near'"];
    _trg = createTrigger ["EmptyDetector", _term];
    _trg setTriggerArea [15,15, 0, false];
    _trg setTriggerActivation ["WEST", "PRESENT", true];
    _trg = setTriggerStatements ["this", "[_term,3] call BIS_fnc_dataTerminalAnimate;thisList execVM ""assassin\Player_portal.sqf"";", "[_term,0] call BIS_fnc_dataTerminalAnimate;[thisTrigger,player] execVM ""assassin\remove_actions.sqf"";"];
};

if(_cas)         then {
["<t size='1' shadow='0' color='#ff9900'>CAS Rules Are As Follows<br /><br /></t><img size='8' image='assassin\pics\CASRulesTransparent.paa'/>",_term call tz_itemPos, 2, 1] spawn BIS_fnc_3Dcredits;
};

if(_rules)         then {
["<img shadow='0' size='6' image='assassin\pics\ProhibitedTransparent2.paa'/>", _term call tz_itemPos, 2.5, 1] spawn BIS_fnc_3Dcredits;
};

if(_info)         then {
["<img shadow='0' size='6' image='assassin\pics\JoinUsTransparent.paa'/><t size='1' shadow='0' color='#ff9900'><br /><br />Make Sure to stop by to stay up to date with events</t>", _term call tz_itemPos, 2.5, 1] spawn BIS_fnc_3Dcredits;
};

if(_teleport)    then {
["<img shadow='0' size='6' image='assassin\pics\VehicleTeleporterTransparent2.paa'/><t size='1' shadow='0' color='#ff9900'><br /><br />Where Would You like to go?</t>", _term call tz_itemPos2, 7.5, 1] spawn BIS_fnc_3Dcredits; call tz_vehicleTrig;
};

if(_mhq)        then {
["<img shadow='0' size='6' image='assassin\pics\MobileHQTransparent.paa'/><t size='1' shadow='0' color='#ff9900'><br /><br />MHQ Teleportaion</t>", _term call tz_itemPos, 2.5, 1] spawn BIS_fnc_3Dcredits;
};

 

And here is the line I am using to run it

 

Spoiler

null = [ this, false, false, false, true, false] execVM "assassin\3d_text.sqf";

Thank you for any help!!

Share this post


Link to post
Share on other sites

As a triggers statements are code as STRING deferred to run when the trigger activates/deactivates, _term will be undefined when the triggers statements are executed.

You would need to format _term into the statement but as object references cannot be formatted you would need to use something that can like the objects netID (which is a STRING representing the object) and then turn it back into an object inside the statement.

tz_vehicleTrig = {
    //_trg setTriggerStatements ["this", "hint 'Civilian near player'", "hint 'no civilian near'"];
    _trg = createTrigger ["EmptyDetector", _term];
    _trg setTriggerArea [15,15, 0, false];
    _trg setTriggerActivation ["WEST", "PRESENT", true];
    _trg = setTriggerStatements [
    	"this",
    	format[ "
    		[ '%1' call BIS_fnc_objectFromNetId, 3 ] call BIS_fnc_dataTerminalAnimate;
    		thisList execVM 'assassin\Player_portal.sqf';
    	", _term call BIS_fnc_netId ],
    	format[ "
    		[ '%1' call BIS_fnc_objectFromNetId, 0 ] call BIS_fnc_dataTerminalAnimate;
    		[thisTrigger,player] execVM 'assassin\remove_actions.sqf';
    	",  _term call BIS_fnc_netId ]
    ];
};

Although I'm not quite sure why you spawn a trigger to pass all west near _term to the player_portal script.

Would it not be easier to just collect all nearby west units near _term using nearEntities and call the function directly? Suppose it all depends on what player_portal actually does.

Share this post


Link to post
Share on other sites

              Basically what happens is, a player walks near the data terminal. It gets animated and opens up and a 3D text/picture pops up above it. Then they get a set of actions added to them that allows them to teleport to one of the FOB's placed on the map.

I am trying to make it so that instead of addAction's it will open up their map and if they click near a proper FOB then they will teleport there.

             So, using your method nothing happens BUT I also don't get any errors about it. I am trying to have it all work from scripts so that I can also implement this easily on our Exile server later on with other things. Do you suggest any better way to do this? There will also be multiple of these on the map too. 

             Thank You for your time!!

Share this post


Link to post
Share on other sites

@Larrow Would it be simpler to spawn the Data Terminal in the script also? That way it has the variable in there? 

And then say have an array of positions and spawn one at each?

 

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

×