Problem with attacks draining gold

ROTS19

TH.net Regular
Reaction score
12
i made a trigger that when a unit attacks then a certain ammount of gold is drained from the player. that part works just fine. But i also tried to make it so that when the player researches a certain upgrade, that it drains less gold on each attack. This is the part that doesn't work.
Trigger:
  • Events
    • Unit - A unit Finishes an upgrade
    • Conditions
      • (Researched tech-type) Equal to Capacity
    • Actions
      • Set CapResearched[(Player number of (Owner of (Researching unit)))] = True


Trigger:
  • S
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Peon
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Attacking unit)) Current gold) Less than 4
        • Then - Actions
          • Unit - Order (Attacking unit) to Stop
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CapResearched[(Player number of (Owner of (Attacking unit)))] Equal to True
        • Then - Actions
          • Player - Add -2 to (Owner of (Attacking unit)) Current gold
        • Else - Actions
          • Player - Add -4 to (Owner of (Attacking unit)) Current gold


The problem is that even when the upgrade is researched, 4 gold is drained anyway. What's wrong with the triggers?
 

Faust

You can change this now in User CP.
Reaction score
123
That takes gold from the enemy, not the attacker. :)


Hmm, maybe try setting it to Triggering Unit in the first trigger
 

jig7c

Stop reading me...-statement
Reaction score
123
enjoying life!

try removing the skip remaining action part! that should fix it
 

ROTS19

TH.net Regular
Reaction score
12
But that's only their to keep it from draining gold if the player doesn't have enough to attack. If i took out, it would still drain gold even if the player didn't have enough.
 

gameman

It's been a long, long time.
Reaction score
95
Create a second trigger for this. The first trigger for the beginning and the second one for the upgrade.

Well this might not be practical... How many times does it upgrade?
 

ROTS19

TH.net Regular
Reaction score
12
It only has 1 level of upgrade

well, that didn't seem to work either

Trigger:
  • Events
    • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Peon
    • Actions
      • Trigger - Turn on func2 <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Attacking unit)) Current gold) Less than 4
        • Then - Actions
          • Unit - Order (Attacking unit) to Stop
          • Trigger - Turn off func2 <gen>
        • Else - Actions


Trigger:
  • func2
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Peon
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CapResearched[(Player number of (Owner of (Attacking unit)))] Equal to True
        • Then - Actions
          • Player - Add -2 to (Owner of (Attacking unit)) Current gold
        • Else - Actions
          • Player - Add -4 to (Owner of (Attacking unit)) Current gold


is this what you meant? i don't really understand why splitting them would have helped at all.
 

Ellimistrox

New Member
Reaction score
10
Trigger:
  • Events
    • Unit - A unit Finishes an upgrade
    • Conditions
      • (Researched tech-type) Equal to Capacity
    • Actions
      • Set CapResearched[(Player number of (Owner of (Researching unit)))] = True

Problem Found! Event should be
Unit - A unit Finishes research
Because you use conditions of Researched tech-type, nothing to do with upgrading :thup:.
 

ROTS19

TH.net Regular
Reaction score
12
Problem Found! Event should be
Unit - A unit Finishes research
Because you use conditions of Researched tech-type, nothing to do with upgrading :thup:.

thanks! i didn't see that. Why did nobody else think of that ? lol +rep
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top