Staredit Network

Staredit Network -> UMS Assistance -> [SOLVED]Trigger Problem
Report, edit, etc...Posted by TheHappyHobo on 2006-07-21 at 18:56:33
In a map I'm working on, I want units to be given to computer players but ONLY when all currently active players (Max of 4) bring 10 units each to different locations.
I know that the trigger I originally worked out won't work, and I even tested it. But, it looks like this:

null
Trigger
Players:
¤ Players 1, 2, 3, 4
Conditions:
¤ Player 1 Brings at least 10 any unit to 'P1 Unit Cage'
¤ Player 2 Brings at least 10 any unit to 'P2 Unit Cage'
¤ Player 3 Brings at least 10 any unit to 'P3 Unit Cage'
¤ Player 4 Brings at least 10 any unit to 'P4 Unit Cage'
Actions:
¤ Give all any unit controlled by player 1 to player 5 (computer)
¤ Give all any unit controlled by player 2 to player 6 (computer)
¤ Give all any unit controlled by player 3 to player 7 (computer)
¤ Give all any unit controlled by player 4 to player 8 (computer)


Does anyone know how I can make it work so that all four players don't have to be active in order for the trigger to activate? Like, say only two people are actually playing, how can I make it so that only those 2 players need to bring 10 units to each location, instead of waiting indefinitely for the other (nonexistent...) players to bring units over? Help is very much appreciated.
Thanks in advance.
Report, edit, etc...Posted by LazyCoder on 2006-07-21 at 19:00:27
You could have 4 seperate triggers for each player and when they bring their 10 units to the location, make it set a switch (1 switch for each player). If they are not playing, it also sets the switch. When all 4 switches are set, uuuhhh, its done.
Report, edit, etc...Posted by TheHappyHobo on 2006-07-21 at 19:54:17
QUOTE(LazyCoder @ Jul 21 2006, 06:00 PM)
You could have 4 seperate triggers for each player and when they bring their 10 units to the location, make it set a switch (1 switch for each player).  If they are not playing, it also sets the switch.  When all 4 switches are set, uuuhhh, its done.
[right][snapback]528393[/snapback][/right]

Just tried it, and maybe I'm just being really stupid right now or I missed something, but that's not working either.
I did it like this:
[Condition]
Current player brings at least 10 any unit to 'P1 Unit Cage' (p2 unit cage for Player 2, etc.)
[Action]
Set Switch 1 (Or switch 2 for player 2, etc.)
Preserve (This incident will occur several times in the game...Could the preserve be the problem?)

And then, for if someone isn't there:
[Conditon]
Current Player Commands exactly 0 any unit (If you're not there you have no units, right?)
[Action]
Set Switch 1 (or 2, for player 2, 3 for player 3, etc.)
Preserve

Can't, for the life of me, figure out what will work..
Report, edit, etc...Posted by StarKraft on 2006-07-21 at 21:10:36
Let a trigger noob try to help blushing.gif

Just with triggers.

You need to set this up for each player I guess.

example


players:

player 1


conditions:

current player brings at least 10 any unit to 'P1 Unit Cage'
player 2 brings at least 10 any unit to 'P2 Unit Cage'
player 3 brings at least 10 any unit to 'P3 Unit Cage'
player 4 brings at least 10 any unit to 'P4 Unit Cage'


actions

give all any unit owned by player 1 at 'P1 Unit Cage' to player 5

players:

player 2


conditions:

player 1 brings at least 10 any unit to 'P1 Unit Cage'
current player brings at least 10 any unit to 'P2 Unit Cage'
player 3 brings at least 10 any unit to 'P3 Unit Cage'
player 4 brings at least 10 any unit to 'P4 Unit Cage'


actions

give all any unit owned by player 2 at 'P2 Unit Cage' to player 6


But this only works with all 4 players sorry.gif
Report, edit, etc...Posted by Mp)7-7 on 2006-07-21 at 21:33:54
I would seperate them, because the way you have it is that all players would have to have the ten units in the cage at the same time to have the trigger operate properly!
Report, edit, etc...Posted by TheHappyHobo on 2006-07-21 at 21:37:09
QUOTE(StarKraft @ Jul 21 2006, 08:10 PM)
But this only works with all 4 players sorry.gif
[right][snapback]528522[/snapback][/right]

That's precisely my problem sad.gif
I know my trigger would work (and yours, too, I believe), but it needs a full house to work properly sad.gif
I'll be trying to work on the rest of the triggers while I wait...But this has got my mind going crazy and I can't really focus well blink.gif
Report, edit, etc...Posted by MoonlighTurtle on 2006-07-21 at 22:01:30
One solution would be to do this, and I'm assuming you mean by active players, you mean the amount of players playing in the game.

In the beginning of the game use a death counter to hold the # of people in the game, such as making a trigger for each player that adds 1 to the death counter.

Then for each player, when they bring at least 10 units to the location subtract 1 from that counter.

After each player has run a trigger doing that the counter that once held the # of people in the game should be 0 if everyone has done it.

That's the basic concept.
Report, edit, etc...Posted by TheHappyHobo on 2006-07-21 at 22:18:03
confused.gif
QUOTE(MoonlighTurtle @ Jul 21 2006, 09:01 PM)
One solution would be to do this, and I'm assuming you mean by active players, you mean the amount of players playing in the game.

In the beginning of the game use a death counter to hold the # of people in the game, such as making a trigger for each player that adds 1 to the death counter.

Then for each player, when they bring at least 10 units to the location subtract 1 from that counter.

After each player has run a trigger doing that the counter that once held the # of people in the game should be 0 if everyone has done it.

That's the basic concept.
[right][snapback]528558[/snapback][/right]

I think I get it, but at the same time I don't. it's like I almost understand, but not quite.
I think maybe a quick description of the map might be needed to clear up the situation. It's an arena map, but instead of spawning units and just fighting in an arena, you use a dark archon to MC the units you want from a preplaced unit pool (every player has a unit pool and every unit pool is exactly the same.) When you MC 10 units, your dark archon goes off to the side and the units are transported to your unit cage. (there's a different cage for each player.) What I want to happen is when everyone currently playing (max players is 4, but I want it to work if only 2 players are playing, too.) has their 10 units in their cage, the units are given to a computer player (player 5 for player 1's units, player 6 for player 2, etc.) and then transported to the arena. You then control these units using beacons and such off to the side (similar to a madness/mass game.) When you win five rounds, you win the game. Therefore, the units will need to be transported to and from their cages several times throughout the course of one game...In order for the game to be fair, all the units need to be transported at the same time (otherwise player 1 can enter the arena and fight with players 2 and 3 when they come in, but player four could just hang out and wait for a bit then come in and mop up, getting the win.)
Hopefully this will help you help me... confused.gif
Report, edit, etc...Posted by MoonlighTurtle on 2006-07-21 at 22:33:38
In this example #players will be the death counter unit.

Conditions:
Currentplayer has suffered exactly 0 deaths of #players

Actions:
Add 1 to #players for computer player
Set to 1 to #players for current player
Preserve Trigger

Conditions:
Currentplayer brings 10 units in the cage
Currentplayer suffered at exactly 1 deaths of #player

Actions:
Subtract 1 from #players for computer player
Set to 0 #players for current player
Preserve Trigger

Conditions:
Computer player has suffered exactly 0 deaths of #player

Actions:
Give p1's units to p5
Give p2's units to p6
etc
Preserve trigger


These triggers can be owned(shared) by all of the human players, but note that they should be kept in the order I have written them. The main thing you need to be aware of is that after the second trigger I wrote runs, the third trigger needs to run next, before the first trigger, or else the third trigger I wrote will never run.

If a player leaves during the game you would need to add a trigger that subtracts 1 from the computer player's death counter to account for the player that left. I would base it on detecting p12 units. What p12 unit you use depends on what units there are in the game, yet to be sure I'll use the follow set up and example.

First you would place lets say a zerg egg for each human player. If one of the human players leaves during the game their unit would be given to p12.

Conditions:
P12 brings at least 1 zerg egg to anywhere (or a specific location)

Actions:
Remove 1 zerg egg for p12
Subtract 1 #players from computer player
Preserve Trigger
Report, edit, etc...Posted by TheHappyHobo on 2006-07-22 at 20:11:58
That makes more sense, (especially more than what I was doing) thanks.
I'll give it a test and get back to you

ADDITION:
Well, it worked, but not..quite. Maybe I did something wrong, but it doesn't wait until all players have their units in their cages before transporting them to the arena. Instead, they get sent to the arena immediately and that player gets marked down for a win.
Otherwise, it did give the units to the corresponding computer and it did send them to the arena, just not at the same time as everyone else.
So...I don't know, I'll check the triggers and see if I can work something out.
Report, edit, etc...Posted by MoonlighTurtle on 2006-07-22 at 20:14:09
It would be easier to solve the problem if you posted the map.

Wait, I see a small problem in the triggers I posted.

In the first trigger:

Conditions:
Currentplayer has suffered exactly 0 deaths of #players

Actions:
Add 1 to #players for computer player
Set to 1 to #players for current player
Preserve Trigger

There should be another condition

Computer player has suffered exactly 0 deaths of #players

Try that.
Report, edit, etc...Posted by TheHappyHobo on 2006-07-22 at 21:11:25
Ok, I'll try that and see if it works. In the meantime, I'll post the map.
It doesn't have a name as of yet, save "MC Arena."
Anyway, I probably made a few mistakes in those triggers.

The comments I used for the triggers were Check Player 1 (2, 3, 4) and Check: Is everyone ready?
Just so you don't have to do any searching.
Report, edit, etc...Posted by MoonlighTurtle on 2006-07-22 at 21:27:02
Where's the third trigger?

Conditions:
Computer player has suffered exactly 0 deaths of #player

Actions:
Give p1's units to p5
Give p2's units to p6
etc
Preserve trigger
Report, edit, etc...Posted by TheHappyHobo on 2006-07-22 at 21:29:01
QUOTE(MoonlighTurtle @ Jul 22 2006, 08:26 PM)
Where's the third trigger?

Conditions:
Computer player has suffered exactly 0 deaths of #player

Actions:
Give p1's units to p5
Give p2's units to p6
etc
Preserve trigger
[right][snapback]529174[/snapback][/right]

Probably in the wrong place...
Under players 5,6,7,8 (computers)
Comment: Begin Round
Report, edit, etc...Posted by MoonlighTurtle on 2006-07-22 at 21:32:33
The problem is that when I said to use "Computer player" in my triggers, I meant only ONE computer player.

All of the players in the game are adding a death counter to the same computer's death counter, not the computer that corresponds to each player.

The whole point of that is so that one computer's death counter represents the total of all the active people in the game.

And then as each of the players are ready, they subtract 1 death counter from that same computer's death counter.

After everyone is ready, the computer's death counter is 0.
Report, edit, etc...Posted by TheHappyHobo on 2006-07-22 at 21:35:01
OH! I get it now! (I hope) I'll fix it, but does it matter which computer player it goes to?
Report, edit, etc...Posted by MoonlighTurtle on 2006-07-22 at 21:51:51
No, as long as the computer is always there.

One more thing, you would want that trigger owned by all the human players, not the computers, and put it after the other two triggers.
Report, edit, etc...Posted by TheHappyHobo on 2006-07-22 at 22:12:05
It worked! Thanks a whole bunch for all your help.
I'll give credit where credit is due, of course! biggrin.gif
Next Page (1)