PDA

View Full Version : SayToGroup...


Mike_Sky
12-25-2012, 06:08 PM
I would send some radio messages in flight, online mission.

I've try this code, with triggers 'OnR' & 'OnB',

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using maddox.game;
using maddox.game.world;
using maddox.GP;


public class Mission : AMission
{
//bool flag1 = true;
bool flag1 = false;
bool flag2 = false;


public override void OnTrigger(int missionNumber, string shortName, bool active)
{
if (("OnR".Equals(shortName)) && active)
{
//GamePlay.gpHUDLogCenter("Test trigger OnR");
GamePlay.gpGetTrigger("OnR").Enable = false;
flag1 = true;
}
if (("OnB".Equals(shortName)) && active)
{
//GamePlay.gpHUDLogCenter("Test trigger OnB");
GamePlay.gpGetTrigger("OnB").Enable = false;
flag2 = true;
}
}


public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);
AiAircraft aircraft = actor as AiAircraft;
if (aircraft != null)
switch (aircraft.Army())
{
case 1:
if (flag1 == true)
{
//GamePlay.gpHUDLogCenter("TEST RAF???");
aircraft.SayToGroup(aircraft.AirGroup(), "Hello_guys"); //ex...
}
break;
case 2:
if (flag2 == true)
{
GamePlay.gpHUDLogCenter("TEST LW ");
}
break;
}
}
}


I don't understand why 'flags' don't work. :confused:
Thank's a lot for your help!
And sorry for my very bad english...:rolleyes:


PS: if "bool flag(x) = true", radio messages are listened.

salmo
01-04-2013, 10:18 AM
Some of the pre-recorded mesages are broken & don't play even when the code is correct. Try changing:

aircraft.SayToGroup(aircraft.AirGroup(), "Hello_guys")

to

aircraft.SayToGroup(aircraft.AirGroup(), "Attention")

I know that "Attention" works. That way you'll know if it's your code or a game bug.

Mike_Sky
01-04-2013, 05:05 PM
Thank's a lot sir.

I'll found my way with help from: http://forum.1cpublishing.eu/showpost.php?p=406913&postcount=10

TY again.;)

Mike_Sky
01-06-2013, 05:52 PM
Your code is not complet, may be a mistake?:grin:
It's possible to find this?
TY.

salmo
01-07-2013, 04:31 AM
Your code is not complet, may be a mistake?:grin:
It's possible to find this?
TY.

I'm not sure what you mean? Except that there's a missing semi-colon from the end of the line.

aircraft.SayToGroup(aircraft.AirGroup(), "Attention");

Mike_Sky
01-07-2013, 05:04 PM
I was talking about the beginning of this code: http://forum.1cpublishing.eu/showpost.php?p=406913&postcount=10

If you could show me this/your work, that's will be very fine...
If you could'nt, it's really not a problem, you help me a lot, before, with your samples! :)