How to find the enemy with in range of my hero?

micolord

You can change this now in User CP.
Reaction score
0
For example I'm making a skill that is within the range of my hero 1 random enemy units gets a damage. Please help me! I tried Unit Group thingy and I just can't do it! :(
 

Necrach

You can change this now in User CP.
Reaction score
62
Find the unit using a unit group and then picking a random unit from that group

Trigger:
  • spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set temp_point = (Position of (Triggering unit))
      • Set temp_group = (Units within 300.00 of temp_point matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
      • Custom script: call RemoveLocation (udg_temp_point)
      • Custom script: call DestroyGroup (udg_temp_group)
      • Set random_enemy = (Random unit from temp_group)


You might want to add conditions for the picked unit, like not magic immune, is a ground unit, non-hero, or whatever. And then just use that "random_enemy" variable for the rest of the trigger, something like this;

Trigger:
  • [...]
    • Unit - Cause (Triggering unit) to damage random_enemy, dealing 300.00 damage of attack type Spells and damage type Normal
    • Set temp_point = (Position of random_enemy)
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Orc\SpiritLink\SpiritLinkZapTarget.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation (udg_temp_point)
 

micolord

You can change this now in User CP.
Reaction score
0
Necrach,

Awesome, but this is really what I'm doing, I'm making a hero with a cold power, its last skill is to get the enemy with in the range of the hero and then pick a 1 enemy random unit and then creates a dummy and then the dummy cast a spell on the picked enemy unit (Which is my custom skill.), can you please help me with that! Please!!
 

johnnymra

New Member
Reaction score
14
I don't see the point of your comment... you just explain him the whole spell... but he answered exactly your topic question. You want now to make the rest of the trigger for you? if i recall... there is a rule against asking for people to do everything for you. And also i see unnecessary posting.

Yet... in order to be nice... just use the exact trigger he gave you, then as a second trigger make something like...
Create dummy unit at position of caster.
Order dummy unit to cast spell on random_enemy.
Remove dummy unit.
 

micolord

You can change this now in User CP.
Reaction score
0
I don't see the point of your comment... you just explain him the whole spell... but he answered exactly your topic question. You want now to make the rest of the trigger for you? if i recall... there is a rule against asking for people to do everything for you. And also i see unnecessary posting.

Yet... in order to be nice... just use the exact trigger he gave you, then as a second trigger make something like...
Create dummy unit at position of caster.
Order dummy unit to cast spell on random_enemy.
Remove dummy unit.

That was a bit mean, sorry, I didn't saw the random_enemy variable thingy in the last part.
 

tommerbob

Minecraft. :D
Reaction score
110
Necrach your trigger won't work. You destroy the group before you reference the random unit.

Just do this:

Trigger:
  • Set Temp_Point = Position of (Triggering unit)
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (random 1 unit within X range of Temp_Point) and Do Actions:
      • Loop - Actions
        • ...
        • Do actions to (Picked unit)
        • ...
    • Custom script: call RemoveLocation (udg_Temp_Point)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Blackveiled Blackveiled:
    I wouldn't know, I'm in Joliet, Illinois right now working. I left Houston area about 2 weeks ago lol
  • Blackveiled Blackveiled:
    Not permanently of course, just a temporary job.
    +1
  • jonas jonas:
    Glad you're ok @tom_mai78101
  • jonas jonas:
    @Blackveiled you know another word for permanent? temporary
    +1
  • Varine Varine:
    Briefly, he'll only be there for the interim. Like a stopgap of sorts, he'll be back home in short time
  • O Old Mountain Shadow:
    Hurray! Tom has reappeared!
  • The Helper The Helper:
    Happy Thursday!
  • Blackveiled Blackveiled:
    Yep. Just another fun night at work.
  • Varine Varine:
    Broke the nozzle on my 3d printer and I don't have another heater block. So... I guess I'm fucked on that this weekend
  • The Helper The Helper:
    that sucks i bet they are expensive
  • Varine Varine:
    Not really
  • Varine Varine:
    The entire hot end is like 20 dollars, I just can't get anymore until next week
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site

      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