- Joined
- Jul 17, 2013
- Messages
- 544
Hello, some weks ago i showed you on this forum my trigger and asked how to fix memory leak in it, you showed my way how to fix i fixed it. but the problem is that every time those triggers are wroking game lags hard and is unplayable time of this trigger must not be greater than 2 seconds.
Trigger named navy is supossed to work like this
Unit merchant goes to trade port of another player and gives 500 gold to owner of trade port. and will work only if owner of merchant and owner of trade port are allies
Trigger named land is supossed to work like this
Unit convoy with money goes to trade center of another player and gives 500 gold to owner of trade port. and will work only if owner of merchant and owner of trade port are allies
Please help do you know way to fix it without memory leak and lags? if u know other way to do this than this trigger u can post it
-
navy
-
Events
- Time - Every 0.99 seconds of game time
- Conditions
-
Actions
- Set TempGroup = (Units in (Playable map area))
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Set TempUnit = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of TempUnit) Equal to TradePort
-
Then - Actions
- Set TempPoint = (Position of TempUnit)
- Set TempGroup2 = (Units within 360.00 of TempPoint)
-
Unit Group - Pick every unit in TempGroup2 and do (Actions)
-
Loop - Actions
- Set TempUnit2 = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Owner of TempUnit) Not equal to (Owner of TempUnit2)
- (TempUnit belongs to an ally of (Owner of TempUnit2)) Equal to True
- (Unit-type of TempUnit2) Equal to MerchantShip
-
Then - Actions
- Player - Add 600 to (Owner of TempUnit) Current gold
- Unit - Remove TempUnit from the game
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call RemoveLocation(udg_TempPoint)
- Custom script: call DestroyGroup(udg_TempGroup2)
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup(udg_TempGroup)
-
Events
-
land
-
Events
- Time - Every 0.99 seconds of game time
- Conditions
-
Actions
- Set TempGroup = (Units in (Playable map area))
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Set TempUnit = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of TempUnit) Equal to TradeCenter
-
Then - Actions
- Set TempPoint = (Position of TempUnit)
- Set TempGroup2 = (Units within 360.00 of TempPoint)
-
Unit Group - Pick every unit in TempGroup2 and do (Actions)
-
Loop - Actions
- Set TempUnit2 = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Owner of TempUnit) Not equal to (Owner of TempUnit2)
- (TempUnit belongs to an ally of (Owner of TempUnit2)) Equal to True
- (Unit-type of TempUnit2) Equal to Convoy with money
-
Then - Actions
- Player - Add 500 to (Owner of TempUnit) Current gold
- Unit - Remove TempUnit from the game
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call RemoveLocation(udg_TempPoint)
- Custom script: call DestroyGroup(udg_TempGroup2)
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call DestroyGroup(udg_TempGroup)
-
Events
Trigger named navy is supossed to work like this
Unit merchant goes to trade port of another player and gives 500 gold to owner of trade port. and will work only if owner of merchant and owner of trade port are allies
Trigger named land is supossed to work like this
Unit convoy with money goes to trade center of another player and gives 500 gold to owner of trade port. and will work only if owner of merchant and owner of trade port are allies
Please help do you know way to fix it without memory leak and lags? if u know other way to do this than this trigger u can post it