- Joined
- Apr 5, 2013
- Messages
- 154
I'm trying to make a car in the World Editor for my city map that has 10 players. It has 1 problem, it only works for 1 player, as in trigger 2, if 2 players are inside a car in the same time, the PlayerNumber integer gets overwritten by the latter player entering a car. How do I fix this?
[Trigger 1]
Car Add Movement
Events
Unit - A unit Is loaded into a transport
Conditions
(Unit-type of (Transporting unit)) Equal to Car
Actions
Unit - Set (Transporting unit) movement speed to 300.00
Unit Group - Add (Triggering unit) to InsideCar[(Player number of (Owner of (Triggering unit)))]
Set PlayerNumber = (Player number of (Owner of (Triggering unit)))
Trigger - Turn off Car is inside <gen>
[Trigger 2]
Car is inside
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in InsideCar[PlayerNumber] and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is being transported) Equal to False
Then - Actions
Unit Group - Remove (Picked unit) from InsideCar[PlayerNumber]
Else - Actions
[Trigger 1]
Car Add Movement
Events
Unit - A unit Is loaded into a transport
Conditions
(Unit-type of (Transporting unit)) Equal to Car
Actions
Unit - Set (Transporting unit) movement speed to 300.00
Unit Group - Add (Triggering unit) to InsideCar[(Player number of (Owner of (Triggering unit)))]
Set PlayerNumber = (Player number of (Owner of (Triggering unit)))
Trigger - Turn off Car is inside <gen>
[Trigger 2]
Car is inside
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in InsideCar[PlayerNumber] and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is being transported) Equal to False
Then - Actions
Unit Group - Remove (Picked unit) from InsideCar[PlayerNumber]
Else - Actions