Home   Help Search Login Register  

Author Topic: someone answer the radio  (Read 1640 times)

0 Members and 1 Guest are viewing this topic.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
someone answer the radio
« on: 18 Oct 2008, 01:42:13 »
How do I get it so that somebody uses the radio in a squad once a load of members have been killed?

Usually I designate a certain guy to use the radio. However, I want an AI squad to go into combat and then to radio once there are <3 guys left. The problem is that the guy I might designate might be one of the ones wasted. You get me?

How do I make it so that one of the live ones makes the call?
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: someone answer the radio
« Reply #1 on: 18 Oct 2008, 02:12:17 »
This solution doesn't guarantee that there will be someone left to make the radio call, such as when everyone is killed in a big explosion, but that is probably a good thing ;P

Code: (radioOnCasualties.sqf) [Select]
// Call this script from the leader of a group's init line with (assuming you
// make radio call when 2 or less are left in that person's group):
//     nul = [group this, 2] execVM "radioOnCasualties.sqf"

private ["_group", "_leftBeforeRadio"];
_group = _this select 0;
_leftBeforeRadio = _this select 1;

// Wait until there are less than _leftBeforeRadio in the group.
while {( { alive _x } count (units _group)) > _leftBeforeRadio } do
{
    sleep 1;
};

// Make the radio call with the first guy who is still alive.
{
    if (alive _x) exitWith
    {
         _x sideRadio "MyRadioMsg";
    };
} forEach (units _group);
« Last Edit: 18 Oct 2008, 02:14:30 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: someone answer the radio
« Reply #2 on: 18 Oct 2008, 03:10:50 »
I'm getting an error message with this line. I even tried putting it into a stringtable. It says it can't find it.

Code: [Select]
        _x sideRadio "MyRadioMsg";
How can I sort it so that I can just put what I want in there, rather than it looking for a message somewhere else?
« Last Edit: 18 Oct 2008, 23:37:12 by The-Architect »
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: someone answer the radio
« Reply #3 on: 19 Oct 2008, 02:02:55 »
You said you wanted to use the radio, but I think you meant chat (it isn't anything to do with looking it up in a stringtable, so don't get lost that way) ;P

What you want is to use the simple chat system, rather than the "radio" (yes, I know the term is ambiguous outside the game):
Code: [Select]
    _x sideChat "Help, we are getting annihilated!";

[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: someone answer the radio
« Reply #4 on: 19 Oct 2008, 02:44:15 »
Yeah tried it. Don't work.  >:(
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: someone answer the radio
« Reply #5 on: 19 Oct 2008, 04:03:02 »
Well, "don't work" is a bit vague. I'll just have to assume you mean that there are no errors, but no message is shown to the players.

Well, the only thing I can think of is that the AI soldiers aren't on the same side as the players (in which case it isn't obvious why they would be radioing the players with a message when they are getting killed off). In this case, you'd just want to use globalChat, not sideChat, so the player would see it.

The other possibility is that you are wanting a solution for an MP mission on a dedicated server, but this question isn't in the MP forum, so it can't be that.
« Last Edit: 19 Oct 2008, 18:40:07 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: someone answer the radio
« Reply #6 on: 21 Oct 2008, 21:43:37 »
Sorry.  ;)

I get an error that says it can't find the chat segment.

I am on the same side as the guys and am not working with MP.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: someone answer the radio
« Reply #7 on: 21 Oct 2008, 23:58:05 »
I am totally non-plussed as to why it should say anything about a chat segment, whatever that is. I've used the script, with sideChat, in a test mission and had no problems at all :dunno:

EDIT: OK, I live in MP, so I kind of missed this :whistle: The chat commands are only shown in MP. Thus, you need to use a hint , titleText or cutText to display a message to the player! Oops and sorry!
« Last Edit: 23 Oct 2008, 22:59:26 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: someone answer the radio
« Reply #8 on: 23 Oct 2008, 22:48:21 »
I see. You've been a great help. I wouldn't have had the first idea.

So what might I need to change to have the desired message appear as a radio message?
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: someone answer the radio
« Reply #9 on: 24 Oct 2008, 00:38:50 »
Try this tutorial.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)