Misreferencing a unit

Genkora

Frog blast the vent core!
Reaction score
92
This trigger of mine causes a tower to cast a spell when its mana reaches 100. It is passive, and for the most part it works rather well. However, it sometimes does not work, because the unit stored in my unit variable either does not exist or is out of range (Out of range of the 800 in the unit group "Random", the spell itself has a very very long range), but this is a rare occurrence. I know that is sometimes is referencing an incorrect unit because I have it set up to state the name of whatever unit is Runit.

Trigger:
  • Activate spells
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set Sgroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Charge Tower))
      • Unit Group - Pick every unit in Sgroup and do (Actions)
        • Loop - Actions
          • Set Cpoint = (Position of (Picked unit))
          • Set Random = (Units within 800.00 of Cpoint matching (((Unit-type of (Matching unit)) Not equal to Dummy) and (((Unit-type of (Matching unit)) Not equal to Missile Guy) and (((Unit-type of (Matching unit)) Not equal to Charge Tower) and (((Unit-type of (Matching unit)) No
          • Set Runit = (Random unit from Random)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of (Picked unit)) Greater than or equal to 100.00
              • (Level of Frenzy Fire (passive) for (Picked unit)) Greater than 0
              • (Number of units in Random) Greater than 0
            • Then - Actions
              • Unit - Create 1 Dummy for Neutral Passive at Cpoint facing Default building facing degrees
              • Unit - Add a 6.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Undead Banshee - Curse Runit
              • If ((Level of Frenzy Fire (real) for (Picked unit)) Equal to 1) then do (Unit Group - Add Runit to FFire1) else do (Do nothing)
              • If ((Level of Frenzy Fire (real) for (Picked unit)) Equal to 2) then do (Unit Group - Add Runit to FFire2) else do (Do nothing)
              • If ((Level of Frenzy Fire (real) for (Picked unit)) Equal to 3) then do (Unit Group - Add Runit to FFire3) else do (Do nothing)
              • Game - Display to (All players) the text: (Name of Runit)
              • If ((Level of Frenzy Fire (real) for (Picked unit)) Equal to 3) then do (Do nothing) else do (Unit - Increase level of Frenzy Fire (real) for (Picked unit))
              • Unit - Increase level of Frenzy Fire (passive) for (Picked unit)
              • Unit - Set mana of (Picked unit) to 0.00
              • Unit - Create 1 Missile Guy for Neutral Passive at Cpoint facing Default building facing degrees
              • Unit - Add a 6.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb Runit
              • Custom script: call DestroyGroup (udg_Random)
              • Game - Display to (All players) the text: (String((Number of units in Random)))
            • Else - Actions
          • Custom script: call RemoveLocation (udg_Cpoint)
      • Custom script: call DestroyGroup (udg_Sgroup)
 
What do you mean by "incorrect unit"? Your set random = units matching.... line gets cut off, so I can't see what else you have there. If this is a TD, I think it would be more appropriate to use a charge tower attacks event, rather that your periodic. Then that way you could just make RUnit the attacked unit.
 
try alternative method? give the tower ability first, and use the event an unit is attacked or GDD. If all condition are matched, order unit to do action (acid bomb)?
 
Ok, I changed it to a unit is attacked, and used a random unit from group in case the tower happened to be attacking a magic immune (so it'll cast it on something else besides the immune thing it is attacking). Works great, thanks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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