Jump to content
denzo

Creating Trigger via Script help

Recommended Posts

Hello,

 

I'm currently trying to write a script that creates a trigger via the radio Alpha channel and that can be activated by the player.

The trigger statemesnts should set another unit (hunter1) into a combatmode Red and also have a line of sideChat from the player.


Here is what I have so far

_trig1 = createTrigger ["EmptyDetector", [0,0,0]]; 
_trig1 setTriggerArea [0, 0, 0, false];
_trig1 setTriggerActivation ["ALPHA", "present", false];
_trig1 setTriggerText "Sniper Cover - Geronimo";
_trig1 setTriggerStatements
[
		"this", 
		"hunter1 setcombatmode "RED"", 
		"player sidechat "OPEN UP!"
	];
};

I keep getting an error message saying I'm missing a "]" but I cant for the life of me figure it out.

 

Any help would be greatly appreciated.

 

Thanks in advance,

Denzo

Share this post


Link to post
Share on other sites

remove the: };   it's unnecessary

  • Like 2

Share this post


Link to post
Share on other sites

_trig1 = createTrigger ["EmptyDetector", [0,0,0]];

_trig1 setTriggerActivation ["ALPHA", "present", false];

_trig1 setTriggerText "Sniper Cover - Geronimo";

_trig1 setTriggerStatements [ "this", "hunter1 setcombatmode 'RED' ; player sidechat 'OPEN UP!' ","" ];

  • Like 1

Share this post


Link to post
Share on other sites

@pierremgi and @gc8 thank you both for your response. I dont get the error anymore but unfortunately the radio command doesn't show (0-0-1) to the player and nothing happens.

 

Any input would be greatly appreciated.

 

Regards,

Denzo

Share this post


Link to post
Share on other sites

My code works. As you can compare, i corrected your mistakes. Tested. So, verify where you run it. 😉

  • Like 1

Share this post


Link to post
Share on other sites

This is my code from the script called chat1.sqf

 

hunter1 doWatch player;
hunter1 GetDir player;
hunter1 setBehaviour "Careless";
hunter1 DisableAI "MOVE";


[ 
  ["Local Hunter","Hey! Hey you! You're not one of them are you?",0], 
  ["Gastovski","I'm no-one. I'm not here...",5], 
  ["Local Hunter","Haha! Likewise my friend. Maybe we can help each other? My brother and Uncle were killed by those monsters. I can cover you with my rifle.",15], 
  ["Gastovski","Okay, I'll signal you when to open fire. Got it?",10]   
] spawn BIS_fnc_EXP_camp_playSubtitles; //Displays 4 subtitles, with 5 seconds in between them

sleep 10;

[ 
["Local Hunter","Oh, don't worry about me my friend...Old 'Angelina' here has never let me down. I'll move into postion now. You just radio me when you need cover. Good luck.",20]   
] spawn BIS_fnc_EXP_camp_playSubtitles; //Displays 4 subtitles, with 5 seconds in between them

 
sleep 25;

cutText ["","BLACK OUT",3];

sleep 5;

hunter1 setcaptive False;
hunter1 SetPos [10938.7,1963.45,0.0211945];
hunter1 setunitpos "DOWN";
hunter1 setDir 230.847;

cutText ["","BLACK IN",3];

 "dynamicBlur" ppEffectEnable true;
 "FilmGrain" ppEffectEnable true;
 "dynamicBlur" ppEffectAdjust [10];   
 "dynamicBlur" ppEffectCommit 0;     
 "dynamicBlur" ppEffectAdjust [0.0];  
 "dynamicBlur" ppEffectCommit 2; 
 
[hunter1, player] call BIS_fnc_spotter;

"mat1" setMarkerAlpha 1;
_trig1 = createTrigger ["EmptyDetector", [0,0,0]];
_trig1 setTriggerActivation ["ALPHA", "present", false];
_trig1 setTriggerText "Sniper Cover - Geronimo";
_trig1 setTriggerStatements [ "this", "hunter1 setcombatmode 'RED' ; player sidechat 'OPEN UP!' ","" ];

Thanks again for your help!

Share this post


Link to post
Share on other sites

Your code don't work because you're running:

[hunter1, player] call BIS_fnc_spotter;

 

The Bis_fnc_spotter is not supposed to be called because it runs:

while {alive _sniper && alive _spotter} do {...};  without any chance to stop the report easily until player or spotter die.

You must have to spawn the function:

 

[hunter1, player] spawn BIS_fnc_spotter;

NB: not sure you'll succeed in transmitting a spotting report anyway with this function.

  • Like 1

Share this post


Link to post
Share on other sites

@pierremgi thank you very much mate, removing that line of code has worked and now the trigger shows on the radio option.

To give my sniper a little better target acquisition and range, do you have any suggestions? I've heard and tried to use the Reveal command but not having much luck so far.

Thanks again and kind regards,

Denzo

Share this post


Link to post
Share on other sites

The problem is: what do you want to reveal? the target is not clear in your code.

Share this post


Link to post
Share on other sites

Essentially I'd like the Sniper unit to acquire targets in a certain area and cover the player whilst they complete objectives.

 

Ive tried KnowsAbout and Reveal but the sniper only engages the QRF helicopter that appears after the player has been discovered. 

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

×