How to get units in front of the caster

FarAwaY

TH.net Regular
Reaction score
9
Well actually I have 2 questions.

1) Im making a triggered spell in which I want to damage units that are in front of the caster (with a suitable range, of course) so how do I do it?

2) I want a potion that heals a percentage of the unit's max hp/mana instead of a fixed value but I cant seem to find an item ability that does that. Does such an ability exist or do I have to trigger it?

Speaking of which, I tried triggering it but it turned out a little wrong. I tried doing Set Life to Life of triggering unit + [30/100 X Max Life of Unit]...but it didnt work.
 

kaboo

New Member
Reaction score
45
2. life regeneration aura can be set to heal % of HP but i dont know if it can be used for healing potion. if not - show ur trigger
 

FarAwaY

TH.net Regular
Reaction score
9
My trigger is very simple. I have already said it in my previous post.

A Unit Uses an Item

Item Being Manipulated = Life Potion

Set Life to Life of triggering unit + [30/100 X Max Life of Unit].

For the 1) Answer, I assume you're familiar with triggered spells? Spells that use dummy units....scaled up for better looking effects and stuff? I am making a triggered spell so I cant use shockwave skill.
 

Slapshot136

Divide et impera
Reaction score
471
you would pick all units within range of the caster matching that their angle between points of the caster and the picked unit is within X degrees of the facing angle of the caster, and then do damage or whatever
 

kaboo

New Member
Reaction score
45
for heal use this
Trigger:
  • Unit - Set life of (Hero manipulating item) to ((Percentage life of (Hero manipulating item)) + xxx{=%value of health u want to be healed})%
 

Yizzy

New Member
Reaction score
20
i made a similar trigger in this thread..

JASS:
function StormBoltConditions takes nothing returns boolean
    return GetSpellAbilityId() == 'ACbf'  //Still using Breath of Frost..
endfunction

function TargetConditions takes nothing returns boolean
    if ( IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) == true ) then
        return false
    endif
    if ( GetTriggerUnit() == GetFilterUnit() ) then
        return false
    endif
    return true
endfunction

function FindTarget takes unit u, real r returns unit
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real xx
    local real yy
    local real angle
    local real face = GetUnitFacing(u)
    local real absmod
    local group g = CreateGroup()
    local unit t = null
    local real dis = r*r+1

    call GroupEnumUnitsInRange(g, x, y, r, Condition(function TargetConditions))
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call GroupRemoveUnit(g, u)
        set xx = GetUnitX(u)
        set yy = GetUnitY(u)
        set angle = Atan2(y-yy,x-xx) * bj_RADTODEG
        set absmod = ModuloReal(RAbsBJ(angle-face), 360)
            if absmod > 135 and absmod < 225 then
                if dis > (xx-x)*(xx-x)+(yy-y)*(yy-y) then
                set dis = (xx-x)*(xx-x)+(yy-y)*(yy-y)
                set t = u
                endif
            endif
     endloop
     call DestroyGroup(g)
     set g = null

     return t
endfunction

function StormBoltActions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real r = 6000
    local unit t = FindTarget (u,r)
    if t != null then
        call SetUnitExploded(t, true)
        call KillUnit(t)
    endif
endfunction

//===========================================================================
function InitTrig_StormBolt takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function StormBoltConditions ) )
    call TriggerAddAction( t, function StormBoltActions )
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top