Merging Buildings

santicpp

New Member
I'm creating a td where you can merge a tower when you have at least two of the same kind.

I have this trigger:
Trigger:
  • UpgradeWhiteT1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set VariableSet TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Equal to [Tier 1] White Tower).)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than or equal to 2
        • Then - Actions
          • Unit Group - Remove (Triggering unit) from TempGroup.
          • Unit - Remove (Random unit from TempGroup) from the game
          • Unit - Replace (Triggering unit) with a [Tier 1] White Tower using The old unit's relative life and mana
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)


The trigger is working almost perfect, but: when i have more than 1 tower in my selection it doesnt work properly.
For example:
If i have 7 towers in my selection, the trigger replaces 4 of them instead of 3.
I tried to add a for each selected unit but its not working.
 

Squeekems

TH.net Regular
Immediate issue:
There is no Triggering player associated with the event you are using.
There is a Triggering Unit and you can refer to the Owner of Triggering Unit.

As for you problem:
Maybe you can find a way to label 2 towers as a pair. Do something when a Tower is finished being constructed to label it. Maybe set a custom value to all but 1 tower when there is an uneven number.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Blackveiled Blackveiled:
    count on it then cause you don't live that far from me hah
  • The Helper The Helper:
    really that is cool!
  • The Helper The Helper:
    Hey Tom I added a new Weird tag to the News Prefixes
  • The Helper The Helper:
    What is up Blackveiled?
  • Blackveiled Blackveiled:
    Chillin', lurkin'. :D
  • The Helper The Helper:
    I am working on a bunch of site projects right now doing a bunch of behind the scenes stuff and trying to clean up some stuff that I let slide when I got lazy with the site for a few years...
  • The Helper The Helper:
    Are you in Houston Blackveiled or just in Texas?
  • Blackveiled Blackveiled:
    Houston
  • Blackveiled Blackveiled:
    I've been living here since 2014.
  • The Helper The Helper:
    OK banlord we need to get together soon! The only other member of the site I know in Houston is XXX Conan
  • The Helper The Helper:
    and he does not want none lol
  • The Helper The Helper:
    he put up a picture of his mom one time and she was HOT!
  • The Helper The Helper:
    I wish we still had that
  • Blackveiled Blackveiled:
    Lmao you scared him off I see.
  • The Helper The Helper:
    he will be back
  • The Helper The Helper:
    Conan was like 12 when he started here
  • The Helper The Helper:
    I literally think I was his male role model
  • Blackveiled Blackveiled:
    Yeah I was 12 when I started here as well.
  • The Helper The Helper:
    you guys were just kids
  • The Helper The Helper:
    I was in my 30s when i got the Blizzard MVP
  • The Helper The Helper:
    I am 53
  • Wizard Wizard:
    Happy Birthday!
  • The Helper The Helper:
    not my birthday
  • The Helper The Helper:
    but thanks lol
  • Blackveiled Blackveiled:
    and I'll be 30 in January lmao

    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