- Joined
- Sep 25, 2013
- Messages
- 604
Hello, is there a way I can make a trigger with the same function as the one below that doesn't take away 15-20 fps? I don't know too much about triggers and really nothing about jass. Should i change it so the floating text moves to a point instead of a unit and make TempPoint variable which I can later remove with a custom script? Thank you for your time
EDIT: OK! so I did away with the tempUnitGroup and instead added the units when they were trained to a preestablished unit group. So now it looks like this and it performs a lot better. Guess checking every units in the playable map area is something that should be avoided lol. If anyone knows any ways I can optimize further, please let me know!
-
Tradesman Text Loop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
- Set VariableSet tempUnitGroup = (Units in (Playable map area))
-
Unit Group - Pick every unit in tempUnitGroup and do (Actions)
-
Loop - Actions
- Set VariableSet PickedUnit = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Unit-type of PickedUnit) Equal to Tradesman
- (Unit-type of PickedUnit) Equal to Native Tradesman
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Floating Text - Change the position of (Load TradesmanFloatingTextNumber of (Key (Picked unit).) in TradesmanHashtable) to PickedUnit with Z offset 0.00.
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup (udg_tempUnitGroup)
-
Events
EDIT: OK! so I did away with the tempUnitGroup and instead added the units when they were trained to a preestablished unit group. So now it looks like this and it performs a lot better. Guess checking every units in the playable map area is something that should be avoided lol. If anyone knows any ways I can optimize further, please let me know!
-
Tradesman Text Loop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
Unit Group - Pick every unit in TradesmanUnitGroup and do (Actions)
-
Loop - Actions
- Set VariableSet PickedUnit = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Unit-type of PickedUnit) Equal to European Tradesman
- (Unit-type of PickedUnit) Equal to Native Tradesman
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Floating Text - Change the position of (Load TradesmanFloatingTextNumber of (Key (Picked unit).) in TradesmanHashtable) to PickedUnit with Z offset 0.00.
- Else - Actions
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in TradesmanUnitGroup and do (Actions)
-
Events
Last edited: