Jump to content
Sign in to follow this  
namreg

Triggering Alarms after shooting loud

Recommended Posts

Hello,

I'm making this night mission and I wanted the SLA soldiers to trigger the alarms whenever they hear a loud machinegun shot.

I want to do this because at first I created a trigger and whenever the RACS soldiers were spotted by SLA soldiers it will set the alarms on. But it was a night mission and my soldiers were equipped with silent weapons, so even if I shooted SLA soldiers from the back....so they didn't see me.... the trigger, triggered.... so I thought of creating this trigger by loud sounds, so whenever SLA soldiers respond to my fire, the loud sounds of their weapons will alert their comrades and then trigger the alarms on.

If this possible??? Or is there any better way to do this???

THX gusys

Share this post


Link to post
Share on other sites

is possible.

eventhandler killed to units that get shot and then check if it is the mg or not is one possibility. you could also add a eventhandler fired to the soldiers shooting the mg, and check wich weapon they use.

if they should start alarm with every shot, even those that doesnt hit the target, addeventhandler to mg. if the alarm should activate only after a loud kill, addeventhandler to the enemsy units. thats how i would do it, but im sure there are plenty of other possibilities to check it. (and if the silent weapons finally get ignored by ai, it should work without further actions, at least with some enemy near the fired shots, maybe nvg needed)

Share this post


Link to post
Share on other sites

Scars suggestions will work. In Last Tango In Bagango mission, I put Fired Eventhandlers on the player's squad that were near the farm house in the beginning. The fired event handlers called this script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; *****************************************************

; ** chk_loud.sqs

; ** Sets gFarmTooLoud to true if Opfor fires any non-silenced

; ** weapon (ak, grenade, rpg, etc).

; **

; ** Fired EH passes this array: [unit, weapon, muzzle, mode, ammo]

; ** Put this in unit's initialization:

; ** this addeventHandler ["fired", {_this exec "chk_loud.sqs"} ];

; *****************************************************

_unit = _this select 0;

_ammo = _this select 4;

?(_ammo == 'B_545x39_SD') OR (_ammo == 'B_9x18_SD'): goto "Silenced"

#Loud_weapon_fired

;player sidechat "Loud weapon fired";

gFarmTooLoud = True

; Remove all Fired eventhandlers from team.

{_x removeEventHandler ["fired", 0]} foreach units group _unit;

exit;

#Silenced

;player sidechat "Silenced weapon fired";

exit;

I knew the exact silenced weapons the player's squad had, so I tested for silenced ammunition, and would exit the script if silenced ammo was fired. Otherwise, non-silenced ammo must have been fired, so I set the a global variable gFarmTooLoad to True.

gFarmTooLoud is a global variable that was initialized to False in the init.sqs.

A trigger was defined with gFarmTooLoud as its condition. So if gFarmTooLoud was ever set to True, then this trigger would start the alarm actions.

Hope this helps.

Share this post


Link to post
Share on other sites

ok, now I get it. sorry guys if I didn't answer you earlier but I've been kind of busy.

Let me show you what I did:

·I created a trigger, In the trigger's effect options I chose the alarm sound and in the condition field I wrote alarm

·Then I created a file called alarm.sqs and I wrote this code in it

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">alarm = true

·I took an SLA rifleman and wrote this in his init field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["fired", {this exec "alarm.sqs"}]

That's all.... I put some RACS around him shooting and when the SLA guy shot.... the alarms went on. Nice but..... do I have to write that code...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["fired", {this exec "alarm.sqs"}]

... in every SLA soldiers' init fields???

THX guys.... notworthy.gif

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  

×