We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
This trigger doesn't make a lot of sense. It doesn't actually remove any of P1's buildings, and it only executes when P4 (why P4?) brings a unit to P1's building area and P1 doesn't have any units there, and then it just removes P4's unit. What's the point?
I think he has trouble with the "Current Player" concept. So I'll explain.
Current Player (CP) in triggers always refers to the player that currently
runs (slightly different from
owns, which I'll explain shortly) the trigger. If you have your trigger owned by P4 CP can only ever be P4. You use CP if you want a group of Players (e.g. Force 1) to do the the same thing, without having to write the trigger 3 times.
So imagine this trigger:
Force 1
Current Player brings civ to "buy Marine"
Create 1 Marine at "buy Marine" for Current Player
What it will do is create 3 copies of the trigger, 1 for each player. And then during a trigger loop, CP is replaced with the Player who is currently running the trigger. The engine then sees this:
Player 1 runs through their trigger list
P1
P1 brings civ to "buy Marine"
Create 1 Marine at "buy Marine" for P1
Player 1 is done with their triggers, now it's P2's turn
P2
P2 brings civ to "buy Marine"
Create 1 Marine at "buy Marine" for P2
P3
P3 brings civ to "buy Marine"
Create 1 Marine at "buy Marine" for P3
(In reality there's a few checks and stuff involved when working with Forces and Current Player, so it will NOT always be the same as making the trigger with fixed Players 1,2 and 3. But to explain the concept this shall suffice at that point.)
I want you to notice that the
orange trigger owner is always the same that
yellow CP is converted to when the trigger is run.
So... if all you wanna do is remove the leftover buildings and units from Players that have left, you really only need your "Neutral Kill" trigger. Yeah, it's that simple.
If you wanna do stuff based on which (or just any) player is missing, then you need another trigger, owned by All Players, a force or computer player. Simple example if you want to distribute the units the missing player had on the field to the other players:
Give Neutral units to alive players
Human Force
P12 brings at least 1 [men] to "Playing field"
Give 1 [men] of P12 at "Playing field" to Current Player
Preserve
Lets imagine P3 left, and had 5 units on the field. P1, P2 are still playing. This is what happens:
P1 checks their trigger, notices 1 men for P12, runs the trigger, gets the leftmost unit. 4 Neutral units left.
P2 checks their trigger, notices 1 men for P12, runs the trigger, gets the leftmost unit. 3 Neutral units left.
--- next trigger loop ---
P1 checks their trigger, notices 1 men for P12, runs the trigger, gets the leftmost unit. (2 Total) 2 Neutral units left.
P2 checks their trigger, notices 1 men for P12, runs the trigger, gets the leftmost unit. (2 Total) 1 Neutral units left.
--- next trigger loop ---
P1 checks their trigger, notices 1 men for P12, runs the trigger, gets the leftmost unit. (3 Total) 0 Neutral units left.
P2 checks their trigger, doesn't find any P12 units, skips the trigger.
P1 gets 3 units, P2 gets 2.
The Kill Neutral trigger will take care of the buildings.
Post has been edited 1 time(s), last time on Mar 19 2018, 10:29 pm by NudeRaider.