[Solved] Tigger won't trigger its trigger its supposed to trigger

Level 5
Joined
Jun 24, 2024
Messages
59
Hi Dudes,

i got a difficult time with a rather simple trigger (at least it think it should be simple).
Scene: Tower Defense Game - I create an object and below the tower Base(being also an object)
The trigger below should check, if the object in question triggers its sell ability, and therefore gets sold.
With this process the Tower Base should be deleted as well.

The reason behind the Base being separate is, because it will change on other conditions.

Anyone got an idea, why the TowerBaseCommon won't get picked by the trigger?

Code:

  • SellTowerAndBase
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Random Tower
      • (Ability being cast) Equal to Sell Tower
    • Actions
      • Player - Add 5 to (Owner of (Triggering unit)).Current lumber
      • Unit Group - Pick every unit in (Units within 10.00 of (Position of (Triggering unit)).) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to TowerBaseCommon
            • Then - Actions
              • Unit - Remove (Picked unit) from the game
            • Else - Actions
      • Unit - Remove (Triggering unit) from the game
JASS:
SellTowerAndBase
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Unit-type of (Triggering unit)) Equal to Random Tower
        (Ability being cast) Equal to Sell Tower
    Actions
        Player - Add 5 to (Owner of (Triggering unit)).Current lumber
        Unit Group - Pick every unit in (Units within 10.00 of (Position of (Triggering unit)).) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Picked unit)) Equal to TowerBaseCommon
                    Then - Actions
                        Unit - Remove (Picked unit) from the game
                    Else - Actions
        Unit - Remove (Triggering unit) from the game
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Does the TowerBaseCommon have the Locust ability? That will prevent it from being adding to a Unit Group like this (you can still add it manually).

Possible issues:
1) It has the Locust ability.
2) 10.00 is too small of a radius.
3) It's not a TowerBaseCommon (duplicate unit-types?)

If you're familiar with a Unit Indexer, you could easily group these units together using it:
  • Events
    • Unit - A unit Finishes construction
  • Conditions
    • // it's a tower
  • Actions
    • Unit - Create 1 TowerBaseCommon at (Position of (Triggering unit))...
    • Set Variable Tower_Base[(Custom value of (Triggering unit))] = (Last created unit)
  • SellTowerAndBase
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Random Tower
      • (Ability being cast) Equal to Sell Tower
    • Actions
      • Player - Add 5 to (Owner of (Triggering unit)).Current lumber
      • Unit - Remove Tower_Base[(Custom value of (Triggering unit)] from the game
      • Unit - Remove (Triggering unit) from the game
This is assuming that the TowerBase is created in response to you building a tower.
 
Last edited:
Level 5
Joined
Jun 24, 2024
Messages
59
I suspected the radius as well but since both units are stacked on top of each other, even the value 1 works.
It was the the locust ability, without it the remove trigger works now. Can i make the the Tower Base unclickable in a different way?
It will never take damage so that aspect is irrellivant.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I suspected the radius as well but since both units are stacked on top of each other, even the value 1 works.
It was the the locust ability, without it the remove trigger works now. Can i make the the Tower Base unclickable in a different way?
It will never take damage so that aspect is irrellivant.
There may be a different way I'm unaware of, some kind of trick to Locust/Unlocust, but I would just use the Unit Indexing method I suggested. It's a lot cleaner as well since you're guaranteed to Remove the correct one without needing to "look for nearby bases". It's quite the simple system, just copy and paste a single trigger.
 
Level 5
Joined
Jun 24, 2024
Messages
59
Attaching it to each Unit also sounds like a solid idea, i wonder if i can summon/unsummon it with creation/deletion.

Different Question (should i create a new post for it (not the question in question)?):
I found alot of setting possibilities under Advanced->Gameplay constants. Can i somehow influence the max experience gained per level?
For example - Lvl 2 needs 200 (as in base game), 3 = 300, 4 = 400, etc.
I want to create a trigger system where a unit can absorb other units to gain exp (only way to gain it) and level through that.
To be honest i am overwhelmed by the editor right now, i kind of just starting using it and stated to understand how jass works.

If any of you want to Msg me outside posts or over discord for some tech support i'd be very happy and grateful :3

Best regards
 
Level 5
Joined
Jun 24, 2024
Messages
59
Edit:

My plan is to create a auto battler type of TD with Merging/Fusing Towers, absorbing and being absorbed (so Active/Passive) and also Arch types and sub arch types, archtypes being same race only, sub arch types overlapping with other races. I dont know if it is possible but i love feedback and ideas <3
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Edit:

My plan is to create a auto battler type of TD with Merging/Fusing Towers, absorbing and being absorbed (so Active/Passive) and also Arch types and sub arch types, archtypes being same race only, sub arch types overlapping with other races. I dont know if it is possible but i love feedback and ideas <3
Just about anything is possible, assuming you stay within the constraints of the game's engine, and both of those genres you listed are basically children of the RTS genre.

I found alot of setting possibilities under Advanced->Gameplay constants. Can i somehow influence the max experience gained per level?
There's an Exp Table in the Gameplay Constants, near the very bottom. Mess around with the settings or look up a thread on Hive, there's bound to be at least 5 that go into detail.

But you should post a new thread for any other questions.
 
Last edited:
Top