Home   Help Search Login Register  

Author Topic: Major Group and Vheicle Issues  (Read 1344 times)

0 Members and 1 Guest are viewing this topic.

Offline Kocrachon

  • Members
  • *
Major Group and Vheicle Issues
« on: 19 Nov 2007, 01:47:26 »
Ok, so I am trying to require a blackhawk to pick up my men after a successful mission. I am doing this on a dedicated server so I need to do most of this with scripting since it seems some waypoint commands don't work right.

Right now the main issue is, I have a trigger that when my men load up into a blackhawk, it tells the blackhawk to take off. So to do this I normally have it saying

(Soldier1 in Bird1) AND (Soldier2 in Bird1) AND etc etc etc.

However this issue with this is that if one of my guys die the vehicle wont leave. So some one else had me do this script.

(Soldier1 in Humvee1) or (!alive Soldier1) AND (Soldier2 in Humvee1) or (!alive Soldier2) AND (Soldier3 in Humvee1) or (!alive Soldier3)

But I run into the issue that even when all of my guys load up, it doesn't leave, period.

The another friend had me try this script.

{alive _X && !(_X in crew VehicleName)} count units GroupName <= 0

However the new issue I run into with THAT, is that I have NOOOO clue how to name my group or any way to know what the name of the group is.

Is there any easy way to make this work?

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: Major Group and Vheicle Issues
« Reply #1 on: 19 Nov 2007, 03:29:41 »
try something on the lines of:

Code: [Select]
_pGroupCount = count group player;

_i = 0;
_flyGo = 0;

while {_flyGo != _pGroupCount} do
{
          if (group player (select _i) in bird1) then
          {
          _i = _i +1;
          _flyGo = _flyGo + 1;
          };
sleep 1;
};

then get the chopper to take off.

im only guessing this, i havent tested it,  but imo theres probably a simpler way than this.

like if (group player in bird1) then
« Last Edit: 19 Nov 2007, 03:33:15 by Surdus Priest »
Campaigns are hard, I'll stick with scripting for now!

Offline Kocrachon

  • Members
  • *
Re: Major Group and Vheicle Issues
« Reply #2 on: 19 Nov 2007, 03:36:28 »
thats actually complicated for me because I have no idea where to put that. I dont know much about editing the actual sqf files. I basically do all my scripting in the actual mission editor. Where would I put this. and this whole group count and all of that makes no sense either...

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Major Group and Vheicle Issues
« Reply #3 on: 19 Nov 2007, 03:50:21 »
Surdus, you don't take into account that people could die during the running of the script, which would prevent take-off. You also assume that the player is one of the group wanting to get into the helo, but I don't know if this is what Kocrachon was asking for. If it is the player group, then Kocrachon could use a trigger condition just as he is now without worrying about the size of the group:
Code: [Select]
({ (not (_x in Humvee1)) and (alive _x) } count (units (group player))) == 0;

Or, if they are all AI,  put "group1 = group this;" in each of their inits and use:
Code: [Select]
({ (not (_x in Humvee1)) and (alive _x) } count (units group1)) == 0;

Kocrachon, although either of the above snippets is less hassle than specifically mention every soldier in the group in the condition, I'll try to explain why the condition you are using now is failing. The order and parenthesis in logical expressions matters a lot. That code you gave will act as though it is:
Code: [Select]
(Soldier1 in Humvee1) or ((!alive Soldier1) AND (Soldier2 in Humvee1)) or ((!alive Soldier2) AND (Soldier3 in Humvee1)) or (!alive Soldier3)

which I hope you can see is quite different to what you actually want to do:
Code: [Select]
((Soldier1 in Humvee1) or (!alive Soldier1)) AND ((Soldier2 in Humvee1) or (!alive Soldier2)) AND ((Soldier3 in Humvee1) or (!alive Soldier3))

(technically, AND binds with a greater priority than OR. This is the same effect as makes "5 + 2 * 2" act like "5 + (2 * 2) = 9", not "(5 + 2) * 2 = 14")

EDIT: Changed the format of the code examples that used "count" to be similar to the example that the OP was confused about. All they actually needed to know was how to name a group :whistle:
« Last Edit: 19 Nov 2007, 04:22:48 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: Major Group and Vheicle Issues
« Reply #4 on: 19 Nov 2007, 03:55:52 »
well, the script i just wrote would have come before the chopper taking off, so all that script does is checks thats everyone is in the chopper, rather than a condition for the choper to take off.  but as i said, there is prob a simpler way.
Campaigns are hard, I'll stick with scripting for now!

Offline Kocrachon

  • Members
  • *
Re: Major Group and Vheicle Issues
« Reply #5 on: 19 Nov 2007, 06:42:03 »
({ (not (_x in Humvee1)) and (alive _x) } count (units (group player))) == 0;

My god that is so amazingly easy.... I didnt realize i just had to do group player..

Does this work with coop missions with other players as well?

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Major Group and Vheicle Issues
« Reply #6 on: 19 Nov 2007, 10:54:55 »
Although this is fine in SP, it won't work in COOP, for possibly two reasons:
- I assume the humvee driver is an AI not in a player group, so he will exist on the dedicated server, but there is no player on the server. Thus, on the machine that is actually commanding the driver (the server), the value of player is not useful (well, in fact it is objNull).
- If the game is in "BIRD" mode (the default, where you become a seagull on death) then that player is no longer in the group with the living members (you stay in the group in any sort of respawn mode though). Well, actually, this isn't actually important, since the first point is the one that stops things working at all before this one becomes relevant!

I didn't consider MP issues originally, since you posted this in the general, not the multiplayer, forum. All you need to overcome this is to put "group1 = group this;" in every init in the group  (you can't just put it in one person's init, since they might not be being played) and use group1 instead of group player, which was the other example I gave.
« Last Edit: 19 Nov 2007, 11:36:44 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)