Home   Help Search Login Register  

Author Topic: Triggers, Conditions and Radio Messages  (Read 1223 times)

0 Members and 1 Guest are viewing this topic.

Offline snafu

  • Members
  • *
Triggers, Conditions and Radio Messages
« on: 22 Dec 2008, 12:51:02 »
Hey folks, while since I posted here (love the new site btw).

I am making this Battle of Britain style mission where some planes are spotted and you jump in your aircraft, fly off, destroy them and then land back at base in time for tea and medals. I have three enemy aircraft off of Dolores but since the AI in aircraft aren't that good they are often, but not always, easy to destroy and that just makes the mission no fun.

Once these 3 SU-34s are gone* I want a trigger to fire where another 2 SU-34s come along BUT only if you have 50% health or more and if you have 50% ammo.

Almost forgot. In a mission I have a RACS pilot jump in his aircraft which blows up because it has been sabotaged. In the same trigger that fires this I have my character say over globalChat 'Oh ****' and HQ saying, 'Goddamn it! Continue with the mission Alpha 1 and give the SLA a good beating'. Problem is that both of the messages come at the same time. I want my characters to come first and then the HQ message coming about 10 seconds later. How do I do this?

*I would like to do this by script instead of trigger with the usual OPFOR not present thing, But I am not sure how. At the start of the mission the 3 SU-34s are already in the air and named e1, e2 and e3. The issue with this is that during my play tests the enemy AI have flew to Rahmadi and ejected leaving them safe and sound. Thus not firing the trigger. Any ideas on how this could be solved?

Any help appreciated.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Triggers, Conditions and Radio Messages
« Reply #1 on: 22 Dec 2008, 19:01:27 »
Here is how I solved staggering the playing of sounds from a trigger: 

I created a simple delaySay script that you pass in three arguments:  Object that will say the sound, Name of Sound to be played, and # of seconds to wait before saying it.  So you put a line like this in the trigger code execution place:

Code: [Select]
dummy= [pilot1, 3, "OhShite"] execVM "delaySay.sqf"; dummy= [hq, 10, "slaGoodBeating"] execVM "delaySay.sqf";
The first call waits 3 seconds before your pilot says his line.  The second call waits 10 seconds before the HQ says their line.

Here is the sqf script called:

Code: [Select]
// "delaySay.sqf";
// by johnnyboy
// dummy= [man, 3, "sound"] execVM "delaySay.sqf"
// "Man will say sound after delay (in seconds)";

private ["_man", "_delay","_sound"];

_man =   _this select 0;
_delay = _this select 1;
_sound = _this select 2;

_str_sound = "STR_" + _sound;

if (side _man == side player) then
{
//  player sidechat "side = goodguys";
  _man = [_man, gGoodguys] call getLiveLeader;
//  _man = player;
  sleep _delay;
  _man say _sound;
  _man sidechat localize _str_sound ;
} else {
  sleep _delay;
  _man say _sound;
  _man globalchat localize _str_sound ;
};
_delay

Maybe I should post this to the scripting resources site since other people seem to have a similar need...

Quote
Once these 3 SU-34s are gone* I want a trigger to fire where another 2 SU-34s come along BUT only if you have 50% health or more and if you have 50% ammo.

Trigger condition for this could be:

Code: [Select]
(!(alive plane1) && !(alive plane2) && !(alive plane3) && ((damage vehicle player) <=.5) && (((vehicle player) ammo "weaponName") >= 100)
Note that you need to modify the last bit with the correct weaponName for the player's plane weapon, and the correct ammo count for that weapon (i.e. replace 100 with some other number).

Good luck.
« Last Edit: 22 Dec 2008, 19:11:52 by johnnyboy »
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...