- Joined
- Mar 12, 2006
- Messages
- 407
Im doing a custom resources system and therefore i need triggers that manage the resource gain
This one is for food.
Food is harvested from sheep, deer or berrys and then returned to a mill or the main building
My question is does it leak ? And is there a better way of doing this ?
Ignore 'equal to' my translation script fucked that up the (==) (>=) etc counts
Ok here it comes, have fun reading
This one is for food.
Food is harvested from sheep, deer or berrys and then returned to a mill or the main building
My question is does it leak ? And is there a better way of doing this ?
Ignore 'equal to' my translation script fucked that up the (==) (>=) etc counts
Ok here it comes, have fun reading
-
gain food
-

Events
-


Unit - A unit owned by neutral enemy is being attacked
-
-

Conditions
-


Multiple ConditionsOr - Any (Conditions) are true
-



Conditions
-




(Unit-type of (Attacked unit)) equal to (==) deer (dead)
-




(Unit-type of (Attacked unit)) equal to (==) sheep (dead)
-




(Unit-type of (Attacked unit)) equal to (==) berrys
-
-
-


Multiple ConditionsOr - Any (Conditions) are true
-



Conditions
-




(Unit-type of (Attacking unit)) equal to (==) villager
-




(Unit-type of (Attacking unit)) equal to (==) villager (alternate)
-
-
-
-

Actions
-


Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



'IF'-Conditions
-




(Charges remaining in (Item carried by (Attacking unit) in slot 1)) equal to (>=) 10
-
-



'THEN'-Actions
-




Set p = (Position of (Triggering unit))
-




Set group = (Units within 1024.00 of p matching ((((Matching unit) is in (Units owned by (Owner of (Attacking unit)))) equal to (==) True) and (((Unit-type of (Matching unit)) equal to (==) mainbuilding) or ((Unit-type of (Matching unit)) equal to (==) mill))))
-




Set mill = (Random unit from group)
-




Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





'IF'-Conditions
-






(Name of mill) equal to (==) <empty string>
-
-





'THEN'-Actions
-






Custom script: call DestroyGroup (udg_group)
-






Set group = (Units within 4096.00 of p matching ((((Matching unit) is in (Units owned by (Owner of (Attacking unit)))) equal to (==) True) and (((Unit-type of (Matching unit)) equal to (==) mainbuilding) or ((Unit-type of (Matching unit)) equal to (==) mill))))
-






Set mill = (Random unit from group)
-
-





'ELSE'-Actions
-
-




Wait 0.01 seconds
-




Unit - Order (Attacking unit) to give (Item carried by (Attacking unit) in slot 1) to mill
-




Custom script: call RemoveLocation (udg_p)
-




Custom script: call DestroyGroup (udg_group)
-




Skip remaining actions
-
-



'ELSE'-Actions
-
-


If ((Item-type of (Item carried by (Attacking unit) in slot 1)) equal to (==) stone) then do (Item - Remove (Item carried by (Attacking unit) in slot 1)) else do (Do nothing)
-


Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



'IF'-Conditions
-




(Unit-type of (Attacked unit)) equal to (==) sheep (dead)
-
-



'THEN'-Actions
-




Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





'IF'-Conditions
-






(Custom value of (Attacked unit)) equal to (>=) 100
-
-





'THEN'-Actions
-






Unit - Remove (Attacked unit) from the game
-
-





'ELSE'-Actions
-






Set nahrungcount = (Charges remaining in (Item carried by (Attacking unit) in slot 1))
-






Item - Remove (Item carried by (Attacking unit) in slot 1)
-






hero - Create Nahrung and give it to (Attacking unit)
-






Item - Set charges remaining in (Item carried by (Attacking unit) in slot 1) to (nahrungcount + 1)
-






Unit - Set the custom value of (Attacked unit) to ((Custom value of (Attacked unit)) + 1)
-






Unit - Set mana of (Attacked unit) to (100.00 - (Real((Custom value of (Attacked unit)))))
-






Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







'IF'-Conditions
-








(Charges remaining in (Item carried by (Attacking unit) in slot 1)) equal to (>=) 10
-
-







'THEN'-Actions
-








Set p = (Position of (Triggering unit))
-








Set group = (Units within 1024.00 of p matching ((((Matching unit) is in (Units owned by (Owner of (Attacking unit)))) equal to (==) True) and (((Unit-type of (Matching unit)) equal to (==) mainbuilding) or ((Unit-type of (Matching unit)) equal to (==) mill))))
-








Set mill = (Random unit from group)
-








Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









'IF'-Conditions
-










(Name of mill) equal to (==) <empty string>
-
-









'THEN'-Actions
-










Custom script: call DestroyGroup (udg_group)
-










Set group = (Units within 4096.00 of p matching ((((Matching unit) is in (Units owned by (Owner of (Attacking unit)))) equal to (==) True) and (((Unit-type of (Matching unit)) equal to (==) mainbuilding) or ((Unit-type of (Matching unit)) equal to (==) mill))))
-










Set mill = (Random unit from group)
-
-









'ELSE'-Actions
-
-








Wait 0.01 seconds
-








Unit - Order (Attacking unit) to give (Item carried by (Attacking unit) in slot 1) to mill
-








Custom script: call RemoveLocation (udg_p)
-








Custom script: call DestroyGroup (udg_group)
-








Skip remaining actions
-
-







'ELSE'-Actions
-
-
-
-
-



'ELSE'-Actions
-
-


Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



'IF'-Conditions
-




(Unit-type of (Attacked unit)) equal to (==) deer (dead)
-
-



'THEN'-Actions
-




Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





'IF'-Conditions
-






(Custom value of (Attacked unit)) equal to (>=) 150
-
-





'THEN'-Actions
-






Unit - Remove (Attacked unit) from the game
-
-





'ELSE'-Actions
-






Set nahrungcount = (Charges remaining in (Item carried by (Attacking unit) in slot 1))
-






Item - Remove (Item carried by (Attacking unit) in slot 1)
-






hero - Create Nahrung and give it to (Attacking unit)
-






Item - Set charges remaining in (Item carried by (Attacking unit) in slot 1) to (nahrungcount + 1)
-






Unit - Set the custom value of (Attacked unit) to ((Custom value of (Attacked unit)) + 1)
-






Unit - Set mana of (Attacked unit) to (150.00 - (Real((Custom value of (Attacked unit)))))
-






Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







'IF'-Conditions
-








(Charges remaining in (Item carried by (Attacking unit) in slot 1)) equal to (>=) 10
-
-







'THEN'-Actions
-








Set p = (Position of (Triggering unit))
-








Set group = (Units within 1024.00 of p matching ((((Matching unit) is in (Units owned by (Owner of (Attacking unit)))) equal to (==) True) and (((Unit-type of (Matching unit)) equal to (==) mainbuilding) or ((Unit-type of (Matching unit)) equal to (==) mill))))
-








Set mill = (Random unit from group)
-








Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









'IF'-Conditions
-










(Name of mill) equal to (==) <empty string>
-
-









'THEN'-Actions
-










Custom script: call DestroyGroup (udg_group)
-










Set group = (Units within 4096.00 of p matching ((((Matching unit) is in (Units owned by (Owner of (Attacking unit)))) equal to (==) True) and (((Unit-type of (Matching unit)) equal to (==) mainbuilding) or ((Unit-type of (Matching unit)) equal to (==) mill))))
-










Set mill = (Random unit from group)
-
-









'ELSE'-Actions
-
-








Wait 0.01 seconds
-








Unit - Order (Attacking unit) to give (Item carried by (Attacking unit) in slot 1) to mill
-








Custom script: call RemoveLocation (udg_p)
-








Custom script: call DestroyGroup (udg_group)
-








Skip remaining actions
-
-







'ELSE'-Actions
-
-
-
-
-



'ELSE'-Actions
-
-


Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



'IF'-Conditions
-




(Unit-type of (Attacked unit)) equal to (==) berrys
-
-



'THEN'-Actions
-




Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-





'IF'-Conditions
-






(Custom value of (Attacked unit)) equal to (>=) 125
-
-





'THEN'-Actions
-






Unit - Remove (Attacked unit) from the game
-
-





'ELSE'-Actions
-






Set nahrungcount = (Charges remaining in (Item carried by (Attacking unit) in slot 1))
-






Item - Remove (Item carried by (Attacking unit) in slot 1)
-






hero - Create Nahrung and give it to (Attacking unit)
-






Item - Set charges remaining in (Item carried by (Attacking unit) in slot 1) to (nahrungcount + 1)
-






Unit - Set the custom value of (Attacked unit) to ((Custom value of (Attacked unit)) + 1)
-






Unit - Set mana of (Attacked unit) to (125.00 - (Real((Custom value of (Attacked unit)))))
-






Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







'IF'-Conditions
-








(Charges remaining in (Item carried by (Attacking unit) in slot 1)) equal to (>=) 10
-
-







'THEN'-Actions
-








Set p = (Position of (Triggering unit))
-








Set group = (Units within 1024.00 of p matching ((((Matching unit) is in (Units owned by (Owner of (Attacking unit)))) equal to (==) True) and (((Unit-type of (Matching unit)) equal to (==) mainbuilding) or ((Unit-type of (Matching unit)) equal to (==) mill))))
-








Set mill = (Random unit from group)
-








Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-









'IF'-Conditions
-










(Name of mill) equal to (==) <empty string>
-
-









'THEN'-Actions
-










Custom script: call DestroyGroup (udg_group)
-










Set group = (Units within 4096.00 of p matching ((((Matching unit) is in (Units owned by (Owner of (Attacking unit)))) equal to (==) True) and (((Unit-type of (Matching unit)) equal to (==) mainbuilding) or ((Unit-type of (Matching unit)) equal to (==) mill))))
-










Set mill = (Random unit from group)
-
-









'ELSE'-Actions
-
-








Wait 0.01 seconds
-








Unit - Order (Attacking unit) to give (Item carried by (Attacking unit) in slot 1) to mill
-








Custom script: call RemoveLocation (udg_p)
-








Custom script: call DestroyGroup (udg_group)
-








Skip remaining actions
-
-







'ELSE'-Actions
-
-
-
-
-



'ELSE'-Actions
-
-
-
Last edited:








