OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect 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?
-
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
// 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);
-
I'm getting an error message with this line. I even tried putting it into a stringtable. It says it can't find it.
_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?
-
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):
_x sideChat "Help, we are getting annihilated!";
-
Yeah tried it. Don't work. >:(
-
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.
-
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.
-
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!
-
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?
-
Try this (http://www.ofpec.com/ed_depot/index.php?action=details&id=488&game=ArmA) tutorial.