Unit within range problem

Tholdalf

New Member
Reaction score
2
ok im creating a nova spell and the nova is working all right its built up of orb and theres my prob.. is there a way to detect when a unit comes within x range of a orb? as
Code:
Unit comes within x range of (unit)
only works on units already on the map.:confused:

Thanks in advance.
 

sjakie

Cookie Be Awesome!
Reaction score
127
Do you mean "only works on units already on the map." as in you can only select a unit already on the map as a unit they come close to?

If thats the case, you're using a specific unit event, you have to use a general unit event.
 

sjakie

Cookie Be Awesome!
Reaction score
127
There is no unit within range under the Generic tab :rolleyes: atleast i can´t find one.

Hmmm....now you're saying it, I've never seen one either...:rolleyes:
Coming withing range of any unit doesnt make sense anyway, let me think what alse can be the problem....
 

Tholdalf

New Member
Reaction score
2
Well its the only thing i can come up whit that would work as if i use pick unit within range there might be some bugs like picking a unit twice thus damage/heal him for more then its intended.:p
 

sjakie

Cookie Be Awesome!
Reaction score
127
Yes...I gues you'll have to take the hard way:p (unit withing range is a standalone event....I know that event for so long and I've never noticed it:eek: I'm so stupid)
 

Tholdalf

New Member
Reaction score
2
Sry if this is a double post but it doesn´t work at the damage part.. anyone that has any tips?

The code (there are 2 parts)

Code:
Holy Nova
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Holy Nova 
    Actions
        Set Holy_nova_caster = (Triggering unit)
        Set Facing_Of_Holy_Nova_Caster[(Player number of (Owner of (Triggering unit)))] = (Facing of (Triggering unit))
        Set Holy_Nova_caster_Point[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
        For each (Integer A) from 1 to 20, do (Actions)
            Loop - Actions
                Unit - Create 1 Holy Nova Orb for (Owner of (Triggering unit)) at Holy_Nova_caster_Point[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
                Unit Group - Add (Last created unit) to Holy_Nova_Unit_Gropu[(Player number of (Owner of (Triggering unit)))]
                Set Holy_Nova_Bolts[(Number of units in Holy_Nova_Unit_Gropu[(Player number of (Owner of (Triggering unit)))])] = (Last created unit)
                Trigger - Add to Holy Nova Damage heal <gen> the event (Unit - A unit comes within 100.00 of Holy_Nova_Bolts[(Number of units in Holy_Nova_Unit_Gropu[(Player number of (Owner of (Triggering unit)))])])
                Unit - Add a 2.50 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Move To (Holy_Nova_caster_Point[(Player number of (Triggering player))] offset by 1000.00 towards (Facing_Of_Holy_Nova_Caster[(Player number of (Owner of (Triggering unit)))] + 0.00) degrees)
                Set Facing_Of_Holy_Nova_Caster[(Player number of (Owner of (Triggering unit)))] = (Facing_Of_Holy_Nova_Caster[(Player number of (Owner of (Triggering unit)))] + 18.00)
        Wait 3.00 seconds
        Set Facing_Of_Holy_Nova_Caster[(Player number of (Owner of (Triggering unit)))] = 0.00
        Set Holy_Nova_Bolts[(Number of units in Holy_Nova_Unit_Gropu[(Player number of (Owner of (Triggering unit)))])] = No unit
        Set Holy_nova_caster = No unit

Code:
Holy Nova Damage heal
    Events
    Conditions
        (Triggering unit) Not equal to Holy_nova_caster
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True
            Then - Actions
                Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((50.00 x (Real((Level of Holy Nova  for (Triggering unit))))) + 0.00))
            Else - Actions
                Unit - Cause Holy_Nova_Bolts[(Number of units in Holy_Nova_Unit_Gropu[(Player number of (Owner of Holy_nova_caster))])] to damage (Triggering unit), dealing (50.00 x (Real((Level of Holy Nova  for (Triggering unit))))) damage of attack type Spells and damage type Magic
 
S

Slate.Master

Guest
First i would assume that the triggering unit in the second trigger also has the Nova ability, if not, that would be the problem.
Also, you could have edited your previous post and the first trigger leaks a point, I think.
 

Tholdalf

New Member
Reaction score
2
No as the triggering unit in the secound would be the unit that comes within range.. it is writen quite wierd as i have yet to find some way to make it happen for all the twentie bolts.. if i do 20 triggers one for etch bolt it works but its not weary efficient..:p
 

vypur85

Hibernate
Reaction score
803
For the first trigger:
Code:
                Unit Group - Add (Last created unit) to Holy_Nova_Unit_Gropu[(Player number of (Owner of (Triggering unit)))]
                Set Holy_Nova_Bolts[(Number of units in Holy_Nova_Unit_Gropu[(Player number of (Owner of (Triggering unit)))])] = (Last created unit)

Code:
        Set Holy_Nova_Bolts[(Number of units in Holy_Nova_Unit_Gropu[(Player number of (Owner of (Triggering unit)))])] = No unit


Don't really understand why the above are needed. Don't seem to be necessary.

For the second trigger:
Code:
                ((Triggering unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True

This condition seems a little bit weird. Why would the triggering unit be the ally for triggering unit? This will always return as true I think.

What is the spell supposed to do? Is it to make the dummy missile units to either heal or damage units?

When using 'Unit comes into range' event, you can only detect the units that is 'entering' the said unit. You cannot detect the 'unit being entered to'. (Hope you understand what I'm crabbing).
 

Tholdalf

New Member
Reaction score
2
Yes i know that about the triffering unit but as i said that part of the code is not finished so i left it as it is at default.
 

Flare

Stops copies me!
Reaction score
662
you need to pick every unit who couldve fired the event (well, the unit that you added to the event i.e. your orbs). then, get the orbs location, the triggering units location, and the distance between. if the distance is small enough, you know which unit caused the event to trigger. heres the code used in my Black Arrow spell (hopefully its understandable)

Code:
BA damage
    Events
    Conditions
    Actions
        Unit Group - Pick every unit in BAArrowGroup and do (Actions)
            Loop - Actions
                Set BADummyPt[(Custom value of (Picked unit))] = (Position of BADummy[(Custom value of (Picked unit))])
                Set BATargetLoc[(Custom value of (Picked unit))] = (Position of (Triggering unit))
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between BADummyPt[(Custom value of (Picked unit))] and BATargetLoc[(Custom value of (Picked unit))]) Less than or equal to 101.00
[COLOR="Red"]                        ((Triggering unit) belongs to an enemy of (Owner of BACaster[(Custom value of (Picked unit))])) Equal to False[/COLOR]
                        ((Triggering unit) is alive) Equal to True
                    Then - Actions

I checked the distance between every Black Arrow unit and the triggering unit to find out which particular arrow was causing the event to fire. Also, you should change the red condition so its (Owner of Picked Unit) that you are checking the triggering unit against for enemy status.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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