How to check..

Carnerox

The one and only.
Reaction score
84
I've been trying multiple ways to check which Hero within range of the triggering unit has the greatest mana but it has been unsuccessful..

Any one know what code is used to check?

+rep.
 

NeuroToxin

New Member
Reaction score
46
Do an integer comparison, one second, ill edit this in a moment
Just set the two heroes to a variable (Unit) then compare them
Trigger:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Triggering unit)) Greater than (>) (Mana of (Triggering unit))
        • Then - Actions
        • Else - Actions
 

Carnerox

The one and only.
Reaction score
84
I know about that, I'm meaning that when the "triggering unit" cast the spell it chooses 1 enemy Hero in range that has the highest mana out of them and move to the picked units position, but I can't figure out how to check all their mana.
 

NeuroToxin

New Member
Reaction score
46
Edit: Whats the range?
ReEdit: all you do, is pick every unit within X unit, then do a comparison between them all, one sec
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
you have to do something like this:
BEWARE! HANDWRITTEN!
Trigger:
  • Actions
    • set Temp_Group = Units in RANGE range matching (Matching unit is alive equal to True and Matching unit belongs to an enemy of (Owner of (Triggering Unit)) Equal to true and Matching unit is a hero equal to True)
    • set Temp_Unit = Random Unit from Temp_Group
    • Unit Group - Pick all units in Temp_Group
      • loop - do
        • if
          • current mana of (Picked Unit) > Temp_Unit
        • then
          • set Temp_Unit = (Picked Unit)
        • else
          • do nothing
    • custom script: call DestroyGroup (udg_Temp_Group)


something like this. Temp_Unit will be the hero with the most mana within RANGE after the iteration. of course you can change the conditions for the unit group as you like.
 

Carnerox

The one and only.
Reaction score
84
The code sorta works but if they all have maximum mana, or the same amount it wont move the Hero.

Never mind I fixed it.
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top