Jump to content
Sign in to follow this  
Richtoffen

Cricket sound

Recommended Posts

Hey!!! i've gotta mission i've been working on for awhile now, but now i've stumbled upon a tricky problem.

what i'm trying to achieve:

by Using the radio trigger, the player can check if there are any friendlies nearby. It is simulated with a "cricket" sound (used by the paras in ww2). So when the player activates the trigger. the trigger plays the cricket sound and checks if there are any friendlies inside the trigger area. if there are friendlies in the area, the trigger plays the cricket sound twice.

What i have managed to achieve:

  • Trigger1: A radio trigger that makes the player play the cricket sound using the Say3D command.
  • Trigger2: A trigger that is attached to the player (i plan to use this as the method of checking if friendlies are present inside the trigger area)

The problem is that i need a simple way of checking if blufor is present inside trigger2 without the trigger activating from player presence.

Then i'll need a way to check what unit is inside trigger2 and then use say3D command to force that specific unit to play the "Cricket" sound.

Last i'd want trigger2 to activate only when trigger1 is activated.

Sorry, for the complicated explanation, but even thinking of this problem makes my head ache! i've tried many diffrent ways to do this with no luck. Maybe some of you can find a simple way to do this...

I would greatly appreciate any help you can give! thanks in advance!

Share this post


Link to post
Share on other sites

Group the trigger with the unit that opens up the Vehicle activation type, which is that unit only.

Share this post


Link to post
Share on other sites

Thanks for your reply kylania! i've used your website multiple times to solve my problems! this time i'm facing something a bit more complicated!

but yeah i'm aware of that solution and it does not help me in this situation. Using that approach means i only have one person who activates the trigger, which is not what i'm looking for. I'll need a way to exclude player from the list of units that activate trigger2. 'cause otherwise the player will activate the trigger immidiately since trigger2 is attached to the player. Then i need a way to identify the blufor soldier that activates the trigger, so that i can make that specific soldier say the cricket sound. complicated i know.

Share this post


Link to post
Share on other sites

A simple distance check would be fine for this really. So basically you want the PLAYER to be able to set off the cricket sound and if any AI are close by only ONE of them responds?

Share this post


Link to post
Share on other sites

Well basicly yes. It would be great if i had even one respond. Possibly if there is multiple units inside that predefined area of activation the nearest unit would be chosen. maybe by using nearestObject? or something

Share this post


Link to post
Share on other sites

I was using this the other day to find out if there was a friendly unit in the area excluding myself and my group which seemed to work ok for what I wanted.

condition

{alive _x and _x in thislist} count units group player  <  {alive _x}  count thislist

Share this post


Link to post
Share on other sites

Yeah i tested that and it does the job! now the trigger excludes the player. Thanks a bunch!

Now i'd need a way to identify who activates the trigger and make him play the cricket sound. I'd also need a way to figure out how to activate trigger2 only when trigger1 is activated...so that Trigger2 wont activate without me activating trigger1.

a good example for what i'm trying to achieve is, a man is in the woods looking for his friends, but the friends don't not know they're being looked for. So the man shouts "where are you?" and if one of the friends can hear it he'll answer "i'm here!". but if the man doesnt shout at all. why would any of the friends shout "i'm here!". catch my drift?

Share this post


Link to post
Share on other sites

condition as above

and then on act

p_grp=[];{p_grp = p_grp+[_x]} foreach units group player;arraymen = nearestObjects [player,["man"],50] - p_grp ;
{if (side _x  != west) then { arrayMen=arraymen -[_x]}} foreach arraymen;(arraymen select 0) setdamage 1;

I'm using setdamage at the end to show you who's the nearest man not in your group but on the same side. just use

(arraymen select 0) to address him

example

(arraymen select 0) say3D ["cricket",2]

to check when the first trigger has triggered just name that trigger Trig_cricket then use this in the condition

triggerActivated Trig_cricket

and then in the on act place the sound you want.

----------------------------------------------------------------------------------------------------

Or much simpler would be to do away with all the triggers and just call a small script.

in the players init box

player addaction ["Clicker","click.sqf"]

that will give you an action in the menu on the left instead of using radio calls.

The script will do the rest.

save as click.sqf

_grp = _this select 0;

_p_units=[];

{_p_units = _p_units+[_x]} foreach units group _grp;

_arraymen = nearestObjects [player,["man"],50] - _p_units ;

{if (side _x  != west) then { _arraymen=_arraymen -[_x]}} foreach _arraymen;  

Hint   "clicker"  ;// replace with sound command

sleep 2 + random 3;//  reply with random delay 

hint str (_arraymen select 0);// replace with sound command
sleep 0.5;
hint str (_arraymen select 0);// replace with sound command

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Once again i must raise my hat for this awesome community!!! :)

Your addaction did the trick more than perfectly! a million thanks to you!

I couldn't make it work fluently with the triggers. Although i got it set up pretty well (i think), i noticed it works only about 20% of the time. I couldn't find out what caused the problem so i decided to try your "plan B".

at first i thought of addaction aswell but i ditched the idea 'cause i only know very basic scripting and scripting this thing proved to be too hard for me...but today i've learned a dozen of things i can use in the future!

Thanks alot! This is why i love this community!

Share this post


Link to post
Share on other sites

Trigger are only checked about twice a second so it is possible that they miss stuff.

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  

×