Deleted member 231919
D
Deleted member 231919
Owning 1 unit = 1 Food Used (from your third resource next to your lumber). Maximum limit is 100.
Item called "Food" has charges and the maximum charges it can have is 1000.
You lose charges of your item "Food" by the Food Used amount every 60 seconds. (So if you have 30 Food Used, you lose 30 charges of your item called "Food" every 60 seconds).
What I want this trigger to do, is reduce the Food charges amount by the Food Used and add/remove the Starvation ability according to how much Food charges you have to feed your units.
So if you have 20 Food Charges and have 30 Food Used, then 10 random units of yours should get the starvation ability. If you have 10 units who already have the ability and this trigger occurs again, then those 10 units should still have the ability as well as 20 more randomly selected units of yours to gain the ability since you have 0 Food Charges now. (Which means all your units have the starvation ability now, 30 Food Used = you have 30 units).
However
If you have 40 Food Charges and have 30 Food Used with 5 of your units already having the Starvation ability, then you will be down to 10 Food Charges with those 5 units not having the ability anymore.
If you have 28 Food Charges and have 30 Food Used with 5 of your units having Starvation already, then 3 out of the 5 units with Starvation will be randomly selected to have their Starvation ability removed.
I am really struggling trying to achieve ^ the above. This is pretty difficult I feel. I spent a few hours trying to make this work.
Item called "Food" has charges and the maximum charges it can have is 1000.
You lose charges of your item "Food" by the Food Used amount every 60 seconds. (So if you have 30 Food Used, you lose 30 charges of your item called "Food" every 60 seconds).
What I want this trigger to do, is reduce the Food charges amount by the Food Used and add/remove the Starvation ability according to how much Food charges you have to feed your units.
So if you have 20 Food Charges and have 30 Food Used, then 10 random units of yours should get the starvation ability. If you have 10 units who already have the ability and this trigger occurs again, then those 10 units should still have the ability as well as 20 more randomly selected units of yours to gain the ability since you have 0 Food Charges now. (Which means all your units have the starvation ability now, 30 Food Used = you have 30 units).
However
If you have 40 Food Charges and have 30 Food Used with 5 of your units already having the Starvation ability, then you will be down to 10 Food Charges with those 5 units not having the ability anymore.
If you have 28 Food Charges and have 30 Food Used with 5 of your units having Starvation already, then 3 out of the 5 units with Starvation will be randomly selected to have their Starvation ability removed.
I am really struggling trying to achieve ^ the above. This is pretty difficult I feel. I spent a few hours trying to make this work.
-
Every 60 seconds
-
Events
-
Time - Every 60.00 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in (Units of type Resource Supply Center) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Owner of (Picked unit)) Food used) Less than or equal to (Charges remaining in (Item carried by Resource_Center[(Player number of (Owner of (Picked unit)))] of type Food))
-
-
Then - Actions
-
Unit Group - Pick every unit in (Random Starved_Unit[(Player number of (Owner of (Picked unit)))] units from (Units owned by (Owner of (Picked unit)) matching ((((Matching unit) is A structure) Equal to False) and (((Unit-type of (Matching unit)) Not equal to King) and ((Level of Starvation and do (Actions)
-
Loop - Actions
-
Unit - Remove Starvation from (Picked unit)
-
Set Starved_Unit[(Player number of (Owner of (Picked unit)))] = (Starved_Unit[(Player number of (Owner of (Picked unit)))] - 1)
-
Game - Display to (All players) the text: Starvation Removed.
-
-
-
Game - Display to (All players) the text: Reduce charges.
-
Item - Set charges remaining in (Item carried by Resource_Center[(Player number of (Owner of (Picked unit)))] of type Food) to ((Charges remaining in (Item carried by Resource_Center[(Player number of (Owner of (Picked unit)))] of type Food)) - ((Owner of (Picked unit)) Food used))
-
-
Else - Actions
-
Unit Group - Pick every unit in (Random ((Charges remaining in (Item carried by Resource_Center[(Player number of (Owner of (Picked unit)))] of type Food)) - ((Owner of (Picked unit)) Food used)) units from (Units owned by (Owner of (Picked unit)) matching (((Unit-type of (Matching unit)) N and do (Actions)
-
Loop - Actions
-
Set Starved_Unit[(Player number of (Owner of (Picked unit)))] = (Starved_Unit[(Player number of (Owner of (Picked unit)))] + 1)
-
Unit - Add Starvation to (Picked unit)
-
Game - Display to (All players) the text: Starvation Added
-
-
-
Game - Display to (All players) the text: Charges reduced to ...
-
Item - Set charges remaining in (Item carried by Resource_Center[(Player number of (Owner of (Picked unit)))] of type Food) to 0
-
-
-
-
-
-
Last edited by a moderator: