• 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.

Nova-Type Spell Angle Problems

Status
Not open for further replies.
Level 3
Joined
Jul 14, 2007
Messages
34
Let's see here. . . I was looking at Vexorian's and other's nova templates and systems, but I'm probably only going to have one nova type spell in my map so I started trying to make a little bit simpler way (I'm new to JASS) and kinda cheat my way through instead of using one of their systems/templates. The problem is instead of coming up in a complete circle around the caster, it doubles up on the top half of the circle and shoots only one (at what looks like 270 degrees) down. Here's the trigger:
JASS:
function Trig_GammaRayBurst_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00E'
endfunction

function Trig_GammaRayBurst_Actions takes nothing returns nothing
    local unit u=GetTriggerUnit()
    local integer l=GetUnitAbilityLevel(u,'A00E')
    local integer n=1
    local real x=GetUnitX(u)
    local real y=GetUnitY(u)
    local player p=GetOwningPlayer(u)
    local unit d
    loop
        exitwhen n > 10
        set d= CreateUnit(p,'e005',x,y,bj_UNIT_FACING)
        call SetUnitAbilityLevelSwapped('A00K',d,l)
        //call IssuePointOrder(d,"breathoffrost",(x+(Cos(Deg2Rad(36*n))*100.00)), (y+Sin(Deg2Rad(36*n))*100.00))
        //call IssuePointOrderLoc(d,"breathoffrost",PolarProjectionBJ(GetUnitLoc(u), 100.00 , ( 36.00 * n )) )
        call UnitApplyTimedLife(d,'BTLF',1.00)
        set n= n + 1
    endloop
    set u=null
    set p=null
    set d=null
    
    
endfunction

//===========================================================================
function InitTrig_GammaRayBurst takes nothing returns nothing
    set gg_trg_GammaRayBurst = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_GammaRayBurst, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_GammaRayBurst, Condition( function Trig_GammaRayBurst_Conditions ) )
    call TriggerAddAction( gg_trg_GammaRayBurst, function Trig_GammaRayBurst_Actions )
endfunction

The two methods I tried I turned into comments so I could alternate and see the difference, between these two there isn't any; dunno why I thought there would be.

General cleanup of my code would also be appreciated.
 
Level 3
Joined
Jul 14, 2007
Messages
34
Yea, it all makes mathmatical sense to me, which is why I had to ask in the first place :cry: I can post the map so you can look at it if you just tell me how and actually want to.
 
Level 3
Joined
Jul 14, 2007
Messages
34
Use radians with bj_DEGTORAD, not Deg2Rad lololololololoolololololol.
Use angles and you get pwnt.

You would usually want to check the number of loops, do 360/number, and then cast towards the "final_result * bj_DEGTORAD".

JASS:
call IssuePointOrderLoc(d,"breathoffrost",PolarProjectionBJ(GetUnitLoc(u), 100.00 , ((360/n)*bj_DEGTORAD)) )
That's what I got from what you said and that just made every single one shoot out directly infront of the caster.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
I meant something like this:
JASS:
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local integer counter = 1
loop
     exitwhen counter == 36
     set d = CreateUnit(p, 'e005', x, y, 0) // by the way, its GetUnitFacing(some unit)
     call UnitApplyTimedLife(d, 'BTLF', 1.00)
     call IssuePointOrder(d, "breathoffrost", x + 10 * Cos(10*counter*bj_DEGTORAD), y + 10 * Sin(10*counter*bj_DEGTORAD))
     set counter = counter + 1
     set d = null
endloop
set u = null

This is an example for a 36 units loop.
And use JassCraft or JNGP (suggested), so you'll get a function list.
 
Status
Not open for further replies.
Top