Home   Help Search Login Register  

Author Topic: Why don't this work? (trigger grouped to group of players)  (Read 2592 times)

0 Members and 1 Guest are viewing this topic.

Desdichado

  • Guest
Hi there...

I have created a group of 12 playable units, in a multiplayer game, grouped them with a trigger that is to activate when all units in group is not present in a certain area.

This, for some reason doesn't work as I thought it would. The point was that when the "whole group" ai or player was dead (no longer present) the game should end. What it does do is that when I playtest this mission and get killed, the game ends. Even though the rest of my group is still alive...  ???

Any ideas how I fix this?


Best regards
Jan Fredrik Lund
Norway




Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Why don't this work? (trigger grouped to group of players)
« Reply #1 on: 05 Dec 2002, 20:42:58 »
Does the mission truly end as in you see the end briefing?

If you instead just see the "You are dead" screen, then that's because the mission editor does not allow respawning to work (if your mission even has respawning), and the mission effectively ends for you when you die.  Test the mission in true multiplayer mode and see what happens.

If that's not the problem, then here's a possible fix.  Give your group a name.  E.g.:

Code: [Select]
squad = group this
Put the above code in the initialization field of the group's leader.

Give your trigger an x and y area of 0, and give it a name.  In the trigger's condition field, put the following code:

Code: [Select]
"alive _x" count units squad < 1
This checks if all units in the group named "squad" are dead.  Literally, it's checking if there is less than 1 unit alive, which is the same as checking if all are dead.

I assume that distance from the trigger makes no difference.
« Last Edit: 05 Dec 2002, 20:45:30 by Ranger »
Ranger

Desdichado

  • Guest
Re:Why don't this work? (trigger grouped to group of players)
« Reply #2 on: 05 Dec 2002, 22:19:25 »
Hi and thx for reply...

I playtest the mission after I export it to multiplayer and then exit the game to remove the mission folder. Then I go back in and start a multiplayer game (preferably the missions I want to test :o )

It is in this test that the game ends once I get killed, I still have a lot of my group left.


I will try your solution, but how can I make that show END#2 ? (So I can have my camera rotating with a message that says something to the west team)

I know how to do this with triggers and different end's, but with your code?

EDIT: Oh, and distance do make a difference since this is a multiplayer game and some of those I am gonna play it with hates going down after just one minute. They will therefore respawn on a empty island where they can have a firefight of their own. Should probaly add that both sides will respawn on the same island, way out of the way for the real misison.



Best regards
Jan Fredrik Lund
Norway
« Last Edit: 05 Dec 2002, 22:22:18 by Desdichado »

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Why don't this work? (trigger grouped to group of players)
« Reply #3 on: 05 Dec 2002, 22:56:31 »
No problem.

You remove the mission folder?  As in you delete your source files?  Why would you do that?

Anyway, you need to re-read my reply.  My solution indeed uses triggers, which you said you know how to use.  So I don't see what you don't understand about my answer.

As for distance being a factor, in which way?  Do you want the mission to end if all players are dead and within x meters of the trigger, or would you rather have them be dead and beyond x meters of the trigger?

From your first post, it sounds like you'd want the trigger to activate when they are all dead while being beyond x meters.  If that's so, then use the following code:

Code: [Select]
"not (alive _x) and (_x distance trigger1 > 100)" count units squad == count units squad
Replace trigger1 with the name you assigned to this trigger.

Replace 100 with whatever radius in meters you want.  This is how far away the players must be from the trigger.  This assumes that you were using a circular shape for the trigger's area.  If you weren't, then you'll have to use some geometric calculations to represent other shapes.

This code counts how many units in squad are dead (not alive) and are farther than 100 meters from the named trigger.  If this number equals the number of units in the squad, then the trigger will activate.
« Last Edit: 05 Dec 2002, 22:58:18 by Ranger »
Ranger

Desdichado

  • Guest
Re:Why don't this work? (trigger grouped to group of players)
« Reply #4 on: 06 Dec 2002, 00:06:21 »
Curse me for a fool...   ::)

Weel, as we say it in Norway, the first thing you go blind on is your eyes...

I only move the mission folder to another place so it doesn't interfere with Flashpoint.


But, if you read my EDIT in the second post you can see why your last solution can't work for me, any other ideas?


Thx for helping out   :)


Best regards
Jan Fredrik Lund
Norway

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Why don't this work? (trigger grouped to group of players)
« Reply #5 on: 06 Dec 2002, 00:23:16 »
Curse me for a fool...   ::)

Weel, as we say it in Norway, the first thing you go blind on is your eyes...

 ;D lol

Quote
I only move the mission folder to another place so it doesn't interfere with Flashpoint.

Oh, that makes some sense...although I don't see how the folder interferes with OFP.  I never have that problem--at least, not that I know of.  What is this problem of which you speak?

Are you talking about the mission folder in your OperationFlashpoint/users/username/mission folder?  If so, I don't see how this is a problem.  If you mean as in you DePBO'd the mission in the OperationFlashpoint/mpmission folder, then I know what you mean.

Quote
But, if you read my EDIT in the second post you can see why your last solution can't work for me, any other ideas?

Why not?  Your edit says that distance is a factor.  So, in my second post, I told you how to use my code in the trigger while taking into account distance.  Am I not understanding what you mean?

Just take my code and modify it to suit your needs.  If 100 meters is the wrong distance, then change it.  If you need a different geometric area shape, then plug in an appropriate formula to take into account the proper shape.

Quote
Thx for helping out   :)

No problem at all.  Glad to help.
Ranger

Desdichado

  • Guest
Re:Why don't this work? (trigger grouped to group of players)
« Reply #6 on: 06 Dec 2002, 10:39:35 »
Quote
[quote author=Ranger


Oh, that makes some sense...although I don't see how the folder interferes with OFP.  I never have that problem--at least, not that I know of.  What is this problem of which you speak?

I have created a Team CoOp map, the objective is a small village called Plei Bi Yot, currently controlled by the NVA, the US Marines are ordered to move in and retake the village.

Now, NVA (east) has about 50 men (12 playable) and the US Marines (west) has 2 groups of 12 men each.

US Marine group e.g. Alpha is playable, this is also the group that I want the trigger to active on once the whole group is outside the trigger area.

NVA has 3 groups of 9 people each + some DsHK 30mm nest's, one group of 12 people that is also playable.

Now comes the tricky part, this is a MULTIPLAYER game, those I am going to play this game with hates going down in the first few minutes, therefore I have made them respawn on a island of their own, far away from the action. Both NVA and US Marines will respawn here. (So they can have a little firefight of their own)

What I understand from your last code is that it count units NOT ALIVE and since they will respawn they can't actually be counted as dead, can they? only how far they are from initial area?


Or am I totally lost here?  ???


Quote
Are you talking about the mission folder in your OperationFlashpoint/users/username/mission folder?

Yes Sir, that's the one I am talking about, after I extract my mission to MP mission, I exit the game and move the mission folder to e.g. root of drive D:\

I was told back in the beginning of Flashpoint editing (when Flashpoint was released) that this might be a good idea if you had problems testing mulitplayer maps.

I'm sure it is quite obsolete now, but you know, a bad habit and so on and so fourth...   ;D


Thx again...    :)  (hopefully your growing bored by this)


Best regards
Jan Fredrik Lund
Norway

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Why don't this work? (trigger grouped to group of players)
« Reply #7 on: 06 Dec 2002, 18:55:40 »
I typed up an entire reply, and then somehow accidentally closed my browser, losing it all.  >:(

So, here's a brief version of what I originally wrote.

Now that you've explained exactly what's going on, I understand what you're trying to do.  Below, I've detailed one possible way to accomplish what you want.

1. Create a trigger with an area that covers everywhere that the players can possibly go, but be sure to exclude the respawn area.

2. Group the trigger with one of the playable groups.

3. Set the trigger to detect if the group is not present.

4. Set the trigger to the appropriate ending.

5. Repeat for the other playable groups.

Explanation:

If the players are not present in the trigger's area, that means they have died and have respawned.  Otherwise, the players would be present in the area.  Technically, the triggers can be set to once instead of repeatedly, since the players shouldn't be able to get back to the original mission area I assume.

Good luck!
Ranger

Desdichado

  • Guest
Re:Why don't this work? (trigger grouped to group of players)
« Reply #8 on: 06 Dec 2002, 21:35:30 »
Quote
I typed up an entire reply, and then somehow accidentally closed my browser, losing it all.

 ::) typical...



Yes, now we understand eachother...    ;D

But, I did that, and when I grouped the trigger to west playable group, I had to set the trigger to "Whole Group" (it said "vehicle"). So, when all west playable group is out of the mission area (e.g. at respawn location) the game is going to end#2. Good...

But no, once I get killed (rest of group still alive in mission area), the game end's, as in no respawn, just the cinematics and then the score's.


I have set the trigger to "Once", perhaps I should try "Repeating"?


Best regards
Jan Fredrik Lund
Norway

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Why don't this work? (trigger grouped to group of players)
« Reply #9 on: 06 Dec 2002, 22:21:58 »
Hmm, maybe the trigger is only counting player-controlled units?  That's strange--it should work.

Once versus repeating shouldn't make a difference in this case, but you can try it just for fun.

Maybe someone else can give some ideas on how to get that to work.

Another possible idea is to increment a counter whenever a playable units dies.  You can use eventhandlers for this.  In the initialization field of each playable unit, you can put the following code:

this addEventHandler ["Killed", {dead=dead+1}]

Then, you'd check to see when dead is equal to or greater than the number of playable units.  It's a kludge, but it might work.

Otherwise, you can try using a script to do the same thing that the trigger was supposed to do.

In init.sqs, initialize a global array, then execute another script to do the real work.

Code: [Select]
units = units squad1 + units squad2 + units squad3
units exec "CheckDistance.sqs"

Adjust the units array to suit your needs.  That is, rename my example group names, and put however many you really have.

In CheckDistance.sqs, put the following code:

Code: [Select]
_units = _this

@ "_x distance gamelogic1 > 1000" count _units

EndMission = true

exit

Replace gamelogic1 with the name of a game logic that you put in the mission that will be the center of the area where you want to check if the units are located.  Change 1000 to whatever distance you feel is appropriate.

Next, create a trigger that checks if EndMission is true, and if so, it ends the mission.

This is another way you can try to do this.  Of course, the above area is a circle, although using the proper geometry formula can make it another shape.
Ranger

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Why don't this work? (trigger grouped to group of players)
« Reply #10 on: 07 Dec 2002, 07:01:09 »
OK, try this one:

trigger 1:

size: you know the size of the area to be covered  ;)
activation: west/present/once
name: triggerA
condition: this

trigger 2:

size: 0/0
activation: none
type: end#2
condition: "alive _x" count (list triggerA) == 0

Well, just a bit more now (not important for this problem,
but for other stuff in your multiplayer maps).

a) you can test your maps without exporting them to multiplayer aswell. If you start a multiplayer game, there
will appear the island selection screen. Then you choose the
right island, and instead of a mission, you select the mission
editor by dbl-clicking it. You can run multiplayer maps out
of the editor, without loosing any features from final state.
In your user/username folder, there is a missions folder, and
a mpmissions folder. Just take care, that the mission is in the
mpmissions folder.

b) There's really no need to remove your custom missions
folder to somewhere else on your hard drive. Just keep it
in the folder, where it has been created.

c) If you export a mission to mp, or sp a second time, the
older file won't become overwritten - you need to manually
remove or delete the older mission.pbo file there.

d) grouping triggers with playable units, or use the init field
of the playable leader + multiplayer doesn't really fit together.
reason: those guys can be disabled at the player selection
menu, and no more conditions will be met. You know, that
you need your leader, but 3rd parties might not care about
that, and many players seem to prefer a helmet to a cappy.

e) huh only 10 more minutes here at work, i've got to leave
the party now  ;D

~S~ CD
« Last Edit: 07 Dec 2002, 07:34:24 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Desdichado

  • Guest
Re:Why don't this work? (trigger grouped to group of players)
« Reply #11 on: 07 Dec 2002, 08:54:30 »
Thx to both of you, problem fixed.

(I went for a single trigger, west/once/not present/endgame)


I had to rezise and move some troopers, but all in all, it works great  :)

EDIT: In case you guys wanna try I've put it up on the beta forum, just look for Team CoOp - Nampack 2

Best regards
Jan Fredrik Lund
Norway
« Last Edit: 07 Dec 2002, 08:55:55 by Desdichado »