Sirroelivan
Gunnerkrigg Court
- Reaction score
- 95
I'm currently working on a stronghold crusader map. If you've played crusader, you know the concept of walkers. For example, the wheat farmer brings wheat to the stockpile, the miller takes it, grinds it into flour, which he deposits again etc...
Well, the problem is that at the moments the triggers run (they're periodic), the games freezes for a very short while (since there are triggers like this for every type of building), this is very disturbing and i've been looking for a solution.
Currently i'm using trigger's like these
Is there any way of making them more efficient? I thought maybe, instead off adding mana via triggers, adding an ability when necessary that gives mana regeneration to the building and then using the event unit- mana becomes ...
(adding the event for every individual building when it is created) would be more efficient. But is it, i'd like to know before changing all my triggers.
Well, the problem is that at the moments the triggers run (they're periodic), the games freezes for a very short while (since there are triggers like this for every type of building), this is very disturbing and i've been looking for a solution.
Currently i'm using trigger's like these
Code:
Blacksmith 1
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in Blacksmiths and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is alive) Equal to True
(Custom value of (Picked unit)) Equal to 0
Int_Iron[(Player number of (Owner of (Picked unit)))] Greater than or equal to 1
Then - Actions
Unit - Set the custom value of (Picked unit) to 1
Set Int_Iron[(Player number of (Owner of (Picked unit)))] = (Int_Iron[(Player number of (Owner of (Picked unit)))] - 1)
Multiboard - Set the text for Mlt_Resources item in column ((Player number of (Owner of (Picked unit))) + 1), row 4 to (String(Int_Iron[(Player number of (Owner of (Picked unit)))]))
Unit - Create 1 Blacksmith for (Owner of (Picked unit)) at Pnt_Deposit_Goods[(Player number of (Owner of (Picked unit)))] facing Default building facing degrees
Animation - Add the gold animation tag to (Last created unit)
Unit - Order (Last created unit) to Attack (Picked unit)
Else - Actions
Do nothing
Code:
Blacksmith 2
Events
Unit - A unit Is attacked
Conditions
(Unit-type of (Attacking unit)) Equal to Blacksmith
(Unit-type of (Attacked unit)) Equal to Blacksmith
(Owner of (Attacking unit)) Equal to (Owner of (Attacked unit))
Actions
Unit - Remove (Attacking unit) from the game
Unit - Set the custom value of (Attacked unit) to 2
Code:
Blacksmith 3
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in Blacksmiths and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is alive) Equal to True
(Custom value of (Picked unit)) Equal to 2
((Picked unit) has buff Not Working ) Equal to False
Then - Actions
Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + 1.00)
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Mana of (Picked unit)))) Equal to 4
((Picked unit) has buff Not Working ) Equal to False
Then - Actions
Unit - Set mana of (Picked unit) to 0.00
Set Point = (Position of (Picked unit))
Unit - Create 1 Blacksmith for (Owner of (Picked unit)) at Point facing Default building facing degrees
Custom script: call RemoveLocation(udg_Point)
Unit - Set the custom value of (Picked unit) to 0
Unit - Set the custom value of (Last created unit) to 1
Animation - Add the gold animation tag to (Last created unit)
Unit - Order (Last created unit) to Move To Pnt_Deposit_Goods[(Player number of (Owner of (Last created unit)))]
Else - Actions
Do nothing
Is there any way of making them more efficient? I thought maybe, instead off adding mana via triggers, adding an ability when necessary that gives mana regeneration to the building and then using the event unit- mana becomes ...
(adding the event for every individual building when it is created) would be more efficient. But is it, i'd like to know before changing all my triggers.