• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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