• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Custom spell help

Status
Not open for further replies.
Level 2
Joined
Oct 22, 2010
Messages
19
I want to make a spell that increases my heroes move and attack speed , when there are enemy heroes in 2000 range of him. Here is what i came up with but it doesn't work, any ideas?
  • Hunters Instinct
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
      • ((Triggering unit) has buff Hunters Instinct1 ) Equal to True
    • Actions
      • Unit Group - Pick every unit in (Units within 2000.00 of (Position of (Triggering unit))) and do (Actions)
        • Loop - Actions
          • Wait until ((((Picked unit) is A Hero) Equal to True) and (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)), checking every 0.10 seconds
          • Unit - Add Hunters Instinct AS1 to (Triggering unit)
          • Unit - Add Hunters Instinct MS1 to (Triggering unit)
          • Wait until ((((Picked unit) is A Hero) Equal to False) or (((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to False)), checking every 0.10 seconds
          • Unit - Remove Hunters Instinct AS1 from (Triggering unit)
          • Unit - Remove Hunters Instinct MS1 from (Triggering unit)
I actually think the problem is that i don't have a triggering unit to begin with, but i couldn't find a way to do it so i tried like this . PLS HELP i want this spell to work soooooooo bad :D
 
Level 2
Joined
Oct 22, 2010
Messages
19
thx man for the support but i still don't get how to make a triggering unit, out of the unit that has the spell , BTW the spell is passive and i don't know if you got it already but i want the unit to lose the bonuses when the heroes aren't around. Thx in advance
 
Level 2
Joined
Oct 22, 2010
Messages
19
Either you or me don't get it here :p. This is a lvling map like dota, so units aren't gonna be going of the map, second the spell can be learned after lvl 6 , and i want to constantly check if there are any heroes near that hero, if there are then he gains those bonuses if they are not he loses them.
And i can't use the unit within range because it requires a already set unit on the map.
 
Level 2
Joined
Oct 22, 2010
Messages
19
Also could i possibly make a variable that represent the Unit-type of that same unit , and then use set variable to set it to triggering unit?
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
If you can use vJass you could make an aura spell using a single timer with a callback that loops through an array of units and performs the specific actions you desire. You could also attach the trigger with the In Range event to the unit as the unit learns the specified spell, but the former solution works best (basing on the number of people using the said solution).

This isn't impossible on GUI but It would be more tedious to implement.
 
I have no idea about dota i have never played it neither has a lot of the people on here.
When a unit leaves the map it means that unit dies / is removed / few other things.
When a unit enters the map it means that unit is created.

You need to index / de-index the units because there is no way to detect a passive spell.
It has to be done manually like i said above.
 
Level 2
Joined
Oct 22, 2010
Messages
19
No there will not be more then one unit, and man you still didn't understand the spell.
It will get activated when enemy heroes are in 2000 range of the unit having the spell, but when thery are in more than 2000 or dead it will not work. Get it?
 
Level 10
Joined
Apr 18, 2009
Messages
601
Here is one way to start it:

First, declare your variables:
HuntersInstinct_Caster (Unit): A variable of unit type to hold the caster. Make sure to write a trigger that makes this variable hold the caster.
HuntersInstinct_HeroesInRange (Unit Group): A variable of Unit Group type to hold the units within range of the caster affected by the spell.
HuntersInstinct_MoveSpeedBonus (Real): A variable of Real type that could be used (just one of many ways of working with the adding and subtracting of movement).

Secondly, make a trigger that runs with an interval (like the one you've shown).

Set the HuntersInstinct_HeroesInRange variable to hold every hero within 2000 of the caster (HuntersInstinct_Caster) that should be affected by the spell (see the first action in my example).

Set the second variable to equal to the desired bonus to speed based on the number of units in HuntersInstinct_HeroesInRange (second action in my example).

  • Hunters Instinct
    • Events
      • Time - Every 0.5 seconds of game time
    • Conditions
      • (HuntersInstinct_Caster is Alive) Equal to True
    • Actions
      • Set HuntersInstinct_HeroesInRange = (Units within 2000.00 of (Position of HuntersInstinct_Caster) matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of HuntersInstinct_Caster))
      • Set HuntersInstinct_MoveSpeedBonus = ((Real((Number of units in HuntersInstinct_HeroesInRange))) x 60.00)
Please note that I have not considered memory leaks at all when writing this example, which is of course very bad for a trigger like this that runs every 0.5 seconds. However I want you to be able to get the general idea and thought process here and I think it's clearer when not bothering with extra code for cleaning memory leaks. Just keep in mind that this will need to be re-written to remove memory leaks when implemented in a real map.

So, do you understand this or is this way of looking at the problem not resonating with you? If so, what is it that you don't understand and what do you want me to explain or expand on? If my example is crystal clear to you then you should begin to see a path through solving this.
 
Making it MUI would require DIMF's solution.
Either you or me don't get it here :p. This is a lvling map like dota, so units aren't gonna be going of the map

Heroes are created once they are picked, hence entering the map.

Anyways, you should index it upon learning.
See DIMF's tutorial.

If you say I don't understand, this is just a replica of Bloodseeker's third skill, just without that hit point percentage requirement.
 
Status
Not open for further replies.
Top