- Joined
- Oct 25, 2006
- Messages
- 1,175
Hi everyone.
I'm working on a system which allow players to control LOTS of units without selecting them all. I based my system on custom value, each time a unit is created I give it a custom value (which increases each time) and I create X units with it (who are the rest of the regiment). I add this unit to a unit-group with array Custom Value of trained unit.
So the problem is that I added a trigger to change the leader of the group, if he dies. The trigger works but when I give an order to the new leader, war3 crashes.
Here are the triggers:
I dont know how to put them in a little box you can minimize and maximize, sorry
And if some of you can check memory leaks in the same time, I can thanks them
Sorry for french world editor >.<
Bye
I'm working on a system which allow players to control LOTS of units without selecting them all. I based my system on custom value, each time a unit is created I give it a custom value (which increases each time) and I create X units with it (who are the rest of the regiment). I add this unit to a unit-group with array Custom Value of trained unit.
So the problem is that I added a trigger to change the leader of the group, if he dies. The trigger works but when I give an order to the new leader, war3 crashes.
Here are the triggers:
-
Training Ended
-
Evénements
-
Unité - A unit ends training of a unit
-
-
Conditions
-
Actions
-
Unité - Add Leader (ability) to (Trained unit)
-
Unité - Change color of (Trained unit) to Orange
-
Set Temp_Integer = (Temp_Integer + 1)
-
Partie - Display to (All players) the text: (Groupe: + (String(Temp_Integer)))
-
Unité - Set the custom value of (Trained unit) to Temp_Integer
-
Unité - Create (Point-value of (Trained unit)) [here point value of units means number of units in the squad) (Unit-type of (Trained unit)) for (Owner of (Trained unit)) at (Position of (Trained unit)) facing Orientation bâtiment par défaut degrees
-
Groupe unité - Order (Last created unit group) to Attaquer-Avancer vers (Rally-Point of (Triggering unit) as a point)
-
Groupe unité - Add all units of (Last created unit group) to UnitGroup[(Custom value of (Trained unit))]
-
-
-
New Leader
-
Evénements
-
Unité - A unit Dies
-
-
Conditions
-
(Custom value of (Dying unit)) bigger than 0
-
(UnitGroup[(Custom value of (Dying unit))] is empty) Egal Ã* FALSE
-
-
Actions
-
Set NewLeader = (Random unit from UnitGroup[(Custom value of (Dying unit))])
-
Unité - Set the custom value of NewLeader to (Custom value of (Dying unit))
-
Unité - Add Leader to NewLeader
-
Unité - Change color of NewLeader to Orange
-
-
-
Empty Group (To reduce the number of groups)
-
Evénements
-
Unité - A unit Dies
-
-
Conditions
-
(Custom value of (Dying unit)) bigger than 0
-
(UnitGroup[(Custom value of (Dying unit))] is empty) Egal Ã* TRUE
-
-
Actions
-
Unité - Set the custom value of (Random unit from (Units in (Playable map area) matching ((Custom value of (Matching unit)) Egal Ã* Temp_Integer))) to (Custom value of (Dying unit))
-
Set Temp_Integer = (Temp_Integer - 1)
-
Partie - Display to (All players) the text: (Groupe: + (String(Temp_Integer)))
-
-
-
Attack Avancer
-
Evénements
-
Unité - A unit received an order with a point as target
-
-
Conditions
-
(Custom value of (Triggering unit)) bigger than 0
-
(Issued order) Egal Ã* (Order(attack))
-
-
Actions
-
Groupe unité - Order UnitGroup[(Custom value of (Triggering unit))] to Attaquer-Avancer vers (Target point of issued order)
-
-
I dont know how to put them in a little box you can minimize and maximize, sorry
And if some of you can check memory leaks in the same time, I can thanks them
Sorry for french world editor >.<
Bye
Last edited: