• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Loops

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
Hi all, greetings from defskull :D
I'm gonna be straight to point
My problem is that I don't know how to calculate for every loop, new degree is formed and my arrow would be at that new formed degree location
Basically, I'm trying to create a Multi Shot-like ability
I'm gonna fire 4 arrows, which is 22.50 degree per arrow, covering in 90 degrees area
How to do it ?
I keep failing in firing those arrows, all end up in the same degree... (sucks hard)
Can someone edit my test map ?
(Don't bother to remove/comment on the 'Wait' action as I used it just for testing the arrows' location/degrees)
 

Attachments

JASS solution:

JASS:
local real start = GetUnitFacing(GetTriggerUnit())
local real angle = 0.0
local real yourAngle
if (start < 45) then
    set start = 360 - start - 45
else
    set start = start - 45
endif
loop
    exitwhen (angle > 90)
    if (start + angle > 360) then
        set start = start - 360
    endif
    set yourAngle = start + angle
    // Do things with your angle
    set angle = angle + 22.5
endloop
 
Last edited:
Status
Not open for further replies.
Back
Top