Need help with making perpendicular dummy arrangement

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
i tried to create bunch of dummies in so it would be creating them all in a big line starting from the target point going to both sides and i want this line of dummies to be vertical to the caster.

now i tried something which works sometimes but sometimes it doesn't and just creates a line which is not vertical to my caster from the target point.
code:
JASS:
function Fire_Wall_Conditions takes nothing returns boolean
    return (GetSpellAbilityId() == 'ANcl')
endfunction


function CreateFireWall takes nothing returns boolean
    local Data vars = ABCT_GetData()
    local integer i = 0
    local group g = CreateGroup()
    local unit first
    local boolean b
    set vars.r = vars.r+50
    set vars.moveX = vars.targetX+(vars.r)*Cos(vars.angle+90 * bj_DEGTORAD)
    set vars.moveY = vars.targetY+(vars.r)*Sin(vars.angle+90 * bj_DEGTORAD)
   // set b = IsPositionPathable(vars.moveX,vars.moveY)
   // if(b) then
    set vars.dummy[vars.i] = CreateUnit(GetOwningPlayer(vars.u),'n001',vars.moveX,vars.moveY, 25.00)
    call UnitApplyTimedLife(vars.dummy[vars.i],'BTLF',5)
    set vars.i = vars.i+1
  //  endif
    set vars.moveX = vars.targetX+(vars.r)*Cos(vars.angle-90 * bj_DEGTORAD)
    set vars.moveY = vars.targetY+(vars.r)*Sin(vars.angle-90 * bj_DEGTORAD)
   // set b = IsPositionPathable(vars.moveX,vars.moveY)
    //if(b) then
    set vars.dummy[vars.i] = CreateUnit(GetOwningPlayer(vars.u),'n001',vars.moveX,vars.moveY, 25.00)
    call UnitApplyTimedLife(vars.dummy[vars.i],'BTLF',4)
    set vars.i = vars.i+1
    //endif
      loop
        exitwhen(i>vars.i)
        call GroupEnumUnitsInRange(g,GetUnitX(vars.dummy<i>),GetUnitY(vars.dummy<i>),50,null)
          loop
            set first = FirstOfGroup(g)
            exitwhen(first == null)
            if(IsUnitEnemy(first,GetOwningPlayer(vars.u)) and GetUnitState(first, UNIT_STATE_LIFE) &gt; 0.405 and ModuloInteger(vars.counter, 15) == 0 ) then
               call UnitDamageTarget(vars.u,first,50,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
               call DestroyEffect(AddSpecialEffectTarget(&quot;Abilities\\Spells\\Items\\AIfb\\AIfbSpecialArt.mdl&quot;,first,&quot;chest&quot;))
            endif
            call GroupRemoveUnit(g,first)
          endloop
        set i = i+1
      endloop
    call DestroyGroup(g)
    set vars.counter = vars.counter+1
    return vars.i &gt; 60
endfunction


function Fire_Wall_Actions takes nothing returns nothing
    local Data vars = Data.create()
    local location loc = GetSpellTargetLoc()
    set vars.counter = 0
    set vars.u = GetTriggerUnit()
    set vars.x = GetUnitX(vars.u)
    set vars.y = GetUnitY(vars.u)
    set vars.targetX = GetLocationX(loc)
    set vars.targetY = GetLocationY(loc)
    set vars.r = 0
    set vars.angle = GetUnitFacing(vars.u)
    set vars.dummy[0] = CreateUnit(GetOwningPlayer(vars.u),&#039;n001&#039;,vars.targetX,vars.targetY, 25.00)
    call UnitApplyTimedLife(vars.dummy[0],&#039;BTLF&#039;,4)
    set vars.i = 1
    call ABCT_Start(function CreateFireWall,vars,0.075)
    call Data.destroy(vars)
    call RemoveLocation(loc)
    set loc = null
endfunction

//===========================================================================
function InitTrig_Fire_Wall_U takes nothing returns nothing
    set gg_trg_Fire_Wall_U = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Wall_U, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Inferno_U, Condition( function Fire_Wall_Conditions ) )
    call TriggerAddAction( gg_trg_Fire_Wall_U, function Fire_Wall_Actions )
endfunction

</i></i>

(btw ignore the comment parts - still under check for those)
anyway can anybody help me solving this half problem and find out why it's not going vertical all the time?
thanks in advance :)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
As a random guess, in the hope I might not have to read it all:
replace
set vars.angle = GetUnitFacing(vars.u)
with
set vars.angle = GetUnitFacing(vars.u) * bj_DEGTORAD
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
Genius!
it worked! :D

could you explain what difference did it actually made when i did what you said?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Sin and Cos expect the argument in radians.
GetUnitFacing returns degrees.
Given you plugged it in as is... that's not the angle you think it is.
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
well when i used the AngleBeetwenPoints it didn't work so the facing went much better only with this slight error i fixed now.
anyway thanks again :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top