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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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