Creating Gold mine trigger is leaking >.<

TooSlowFcker

New Member
Reaction score
10
Whenever i use this trigger, it fails.
I want it so that you have to have 50 wood 5 gold to make a gold mine, or else the gold mine wont be created, but this trigger isn't working, can you help me?
Code:
Untitled Trigger 020
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to |c0033ccffGold Mine|r 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Triggering unit)) Current gold) Greater than or equal to 5
                ((Owner of (Triggering unit)) Current lumber) Greater than or equal to 50
            Then - Actions
                Player - Add -50 to (Owner of (Triggering unit)) Current lumber
                Player - Add -5 to (Owner of (Triggering unit)) Current gold
            Else - Actions
                Unit - Create 1 Gold Mine for (Triggering player) at (Target point of ability being cast) facing Default building facing degrees
                Neutral Building - Set (Last created unit) to 100 gold
                Unit - Order (Triggering unit) to Stop
                Trigger - Run (This trigger) (checking conditions)
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Well... You put the creation in the else part, why? It seems it will subtract with the right amount but not create, yet create a gold mine and subtract none..
 

TooSlowFcker

New Member
Reaction score
10
i have no clue, does it matter? and thats exactly what happens
k i changed it a little, but i dont know if it'll work
Code:
Untitled Trigger 020
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to |c0033ccffGold Mine|r 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Triggering unit)) Current gold) Greater than or equal to 5
                ((Owner of (Triggering unit)) Current lumber) Greater than or equal to 50
            Then - Actions
                Unit - Create 1 Gold Mine for (Triggering player) at (Target point of ability being cast) facing Default building facing degrees
                Neutral Building - Set (Last created unit) to 100 gold
            Else - Actions
                Player - Add -50 to (Owner of (Triggering unit)) Current lumber
                Player - Add -5 to (Owner of (Triggering unit)) Current gold
                Unit - Order (Triggering unit) to Stop
 

afisakov

You can change this now in User CP.
Reaction score
37
ur then action should include the gold mine construction, whereas ur else should just be a message about not having enough gold/lumber to make mine, as u have it set up now it only makes the mine if u don't have enough resources, whereas it takes away resources if u do
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Why do you want them to have 0 resources if they don't have enough?
 

TooSlowFcker

New Member
Reaction score
10
omg you all know what i want, can you please fix it
if they have the money then make one, if they dont have the money, do nothing
 

afisakov

You can change this now in User CP.
Reaction score
37
then actions are everything that happens if the conditions are true, else are everything that happens if conditions are false, it looks like in ur case u need all of ur actions under the "then" column, then it should make the gold mine and subtract the resources if u have them, and do absolutely nothing if u don't.
p.s. not quiet sure what the "order unit to stop" command is for but it shouldn't interfere with the functionality of the trigger. Under else just put do nothing, or better yet put game-text messege auto timed "You cannot make a gold mine with this ability unless u have at least 50 gold and 5 lumber"
 

TooSlowFcker

New Member
Reaction score
10
ohhh
thanks, everything makes sense now, i never understood loops
thanks for explaining I was hoping someone would
 

afisakov

You can change this now in User CP.
Reaction score
37
If i helped could u please give me some rep, just click on the silver scales,
oh, and of course let me know if u need more help on the trigger.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top