• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Making a line with units problem

Status
Not open for further replies.
Hi guys, I am working on a spell that should create a wall of units. This units would be in a line perpendicular to the caster. However I have problems and I don't get the damn formula.
Can some one fix this for me please?
Btw, this uses vJASS, but all you need is here... can some one tell me what I am doing wrong please ?

JASS:
//setting variables
            set data.caster = caster
            set data.level = level
            set data.catcher = NewTimer()
            set data.spellX = spellX
            set data.spellY = spellY
            set data.walls = CreateGroup()
            
            set angle = (180.0 / bj_PI) * Atan2(data.spellY - GetUnitY(data.caster), data.spellX - GetUnitX(data.caster))
            set owner = GetOwningPlayer(data.caster)
            
            
            //Create the wall, I can't find a formula to complete the wall, I can 
            //only create 1 unit, If I create more, they will mess up everything.
            //Can some one help me find a formula ?
            set i = 0
            loop
                exitwhen(i == WallNumber(data.level))
                set wall = CreateUnit(owner, WallId(data.level), data.spellX - (i * WallSize(data.level)) * Cos(angle * (bj_PI / 180.0)), data.spellY * Sin(angle * (bj_PI / 180.0)), angle)
                call GroupAddUnit(data.walls, wall)
                set i = i + 1
            endloop
 
Status
Not open for further replies.
Top