• 🏆 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!

[JASS] Trigger doesn't work... help needed!

Status
Not open for further replies.
Level 2
Joined
Jul 20, 2010
Messages
19
Hi! Would be nice if you could take a minute or two to look at my trigger. It is meant to start a spell which spawns two frostballs at the target, moving around it and everything in line of cold gets hit by a frostnova: have fun! ^^

JASS:
function cond takes nothing returns boolean
    if (GetSpellAbilityId() == 'A002') then
        return true
    else
        return false
    endif
endfunction

function act takes nothing returns nothing

//  -- variables --

    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit t
    local unit dummy
    local unit iceball1
    local unit iceball2
    local group g
    local player p = GetOwningPlayer(caster)
    local real aim1 = (GetUnitFacing(caster) - 90)
    local real aim2 = (GetUnitFacing(caster) + 90)
    local real distance = 100.00
    local location targetLoc = GetUnitLoc(target)
    local location tempLoc1 = PolarProjectionBJ(targetLoc,distance,aim1)
    local location tempLoc2 = PolarProjectionBJ(targetLoc,distance,aim2)
    local integer i = 30
    
//  -- spawning effects -- 
   
    set iceball1 = CreateUnitAtLoc(p,'h002',tempLoc1,bj_UNIT_FACING)
    set iceball2 = CreateUnitAtLoc(p,'h002',tempLoc2,bj_UNIT_FACING)
    
//  -- action! --
    
    loop
    
    exitwhen (i == -1)
    
    set targetLoc = GetUnitLoc(target)
    set aim1 = (aim1 + 40)
    set aim2 = (aim2 + 40)
    set tempLoc1 = PolarProjectionBJ(targetLoc,distance,aim1)
    set tempLoc2 = PolarProjectionBJ(targetLoc,distance,aim2)
    call SetUnitPositionLoc(iceball1,tempLoc1)
    call SetUnitPositionLoc(iceball2,tempLoc2)
    call GroupEnumUnitsInRangeOfLoc(g,tempLoc1,60.00,null)
    call GroupEnumUnitsInRangeOfLoc(g,tempLoc2,60.00,null)

        loop
        
        exitwhen (t == null)
        
        set t = FirstOfGroup(g)
        set dummy = CreateUnitAtLoc(p,'h000',GetUnitLoc(t),0.00)
        call UnitAddAbility(dummy,'A003')
        call IssueTargetOrder(dummy,"frostnova",t)
        call UnitApplyTimedLife(dummy,'BTLF',1.00)
        call GroupRemoveUnit(g,t)
        
        endloop
    
    set i = (i - 1)
    
    endloop
    
//  -- removing memory leaks --

    set caster = null
    set target = null
    call KillUnit(iceball1)
    call RemoveUnit(iceball1)
    set iceball1 = null
    call KillUnit(iceball2)
    call RemoveUnit(iceball2)
    set iceball2 = null
    set dummy = null
    call DestroyGroup(g)    
    set g = null
    set p = null
    call RemoveLocation(targetLoc)
    set targetLoc = null
    call RemoveLocation(tempLoc1)
    set tempLoc1 = null
    call RemoveLocation(tempLoc2)
    
endfunction

//========================================================

function InitTrig_Icera_Jass takes nothing returns nothing
    local trigger Trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(Trig, Condition(function cond))
    call TriggerAddAction(Trig, function act )
    set Trig = null
endfunction
 
Last edited by a moderator:
Level 18
Joined
Jan 21, 2006
Messages
2,552
Feel free to use the
JASS:
 tags for your JASS code:

[hidden=Spell Code][code=jass]function cond takes nothing returns boolean
    if (GetSpellAbilityId() == 'A002') then
        return true
    else
        return false
    endif
endfunction

function act takes nothing returns nothing

    // -- variables --

    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit t
    local unit dummy
    local unit iceball1
    local unit iceball2
    local group g
    local player p = GetOwningPlayer(caster)
    local real aim1 = (GetUnitFacing(caster) - 90)
    local real aim2 = (GetUnitFacing(caster) + 90)
    local real distance = 100.00
    local location targetLoc = GetUnitLoc(target)
    local location tempLoc1 = PolarProjectionBJ(targetLoc,distance,aim1)
    local location tempLoc2 = PolarProjectionBJ(targetLoc,distance,aim2)
    local integer i = 30

    // -- spawning effects --

    set iceball1 = CreateUnitAtLoc(p,'h002',tempLoc1,bj_UNIT_FACING)
    set iceball2 = CreateUnitAtLoc(p,'h002',tempLoc2,bj_UNIT_FACING)

    // -- action! --

    loop

        exitwhen (i == -1)

        set targetLoc = GetUnitLoc(target)
        set aim1 = (aim1 + 40)
        set aim2 = (aim2 + 40)
        set tempLoc1 = PolarProjectionBJ(targetLoc,distance,aim1)
        set tempLoc2 = PolarProjectionBJ(targetLoc,distance,aim2)
        call SetUnitPositionLoc(iceball1,tempLoc1)
        call SetUnitPositionLoc(iceball2,tempLoc2)
        call GroupEnumUnitsInRangeOfLoc(g,tempLoc1,60.00,null)
        call GroupEnumUnitsInRangeOfLoc(g,tempLoc2,60.00,null)

        loop

            exitwhen (t == null)

            set t = FirstOfGroup(g)
            set dummy = CreateUnitAtLoc(p,'h000',GetUnitLoc(t),0.00)
            call UnitAddAbility(dummy,'A003')
            call IssueTargetOrder(dummy,"frostnova",t)
            call UnitApplyTimedLife(dummy,'BTLF',1.00)
            call GroupRemoveUnit(g,t)

        endloop

        set i = (i - 1)

    endloop

    // -- removing memory leaks --

    set caster = null
    set target = null
    call KillUnit(iceball1)
    call RemoveUnit(iceball1)
    set iceball1 = null
    call KillUnit(iceball2)
    call RemoveUnit(iceball2)
    set iceball2 = null
    set dummy = null
    call DestroyGroup(g)
    set g = null
    set p = null
    call RemoveLocation(targetLoc)
    set targetLoc = null
    call RemoveLocation(tempLoc1)
    set tempLoc1 = null
    call RemoveLocation(tempLoc2)

endfunction

//========================================================

function InitTrig_Icera_Jass takes nothing returns nothing
    local trigger Trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(Trig, Condition(function cond))
    call TriggerAddAction(Trig, function act )
    set Trig = null
endfunction
[/hidden]

You haven't told us what the problem you're experiencing is. Please be more specific.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Well it will still work, he decrements i by 1 each iteration so after 31 iterations it should stop the loop (i starts at 30). I'm thinking he only wants the loop to iterate 30 times, though, in which case he should use 0 not -1 as a sentinel.
 
Level 2
Joined
Jul 20, 2010
Messages
19
first: sorry i didn't told you my problem yet. :D So here it is:
The spell spawns the frost bolts but they don't move they don't do anything and i have no clue why... my first idea was that i've implemented this bug in one the loops but there i can't guess why too.

One simple question which is out of topic from a very new member of hive: what are
JASS:
 tags and where do i find them?

anyway thx for answering
 
Level 2
Joined
Jul 20, 2010
Messages
19
now i've inserted some control statements so i can see ingame which part doesn't work.

JASS:
function cond takes nothing returns boolean
    if (GetSpellAbilityId() == 'A002') then
        call BJDebugMsg("condition true")
        return true
    else
    call BJDebugMsg("condition false")
        return false
    endif
endfunction

function act takes nothing returns nothing

//  -- variables --

    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit t
    local unit dummy
    local unit iceball1
    local unit iceball2
    local group g
    local player p = GetOwningPlayer(caster)
    local real aim1 = (GetUnitFacing(caster) - 90)
    local real aim2 = (GetUnitFacing(caster) + 90)
    local real distance = 100.00
    local location targetLoc = GetUnitLoc(target)
    local location tempLoc1 = PolarProjectionBJ(targetLoc,distance,aim1)
    local location tempLoc2 = PolarProjectionBJ(targetLoc,distance,aim2)
    local integer i = 30
    
    call BJDebugMsg("variables declared succesfully")
    
//  -- spawning effects -- 
   
    set iceball1 = CreateUnitAtLoc(p,'h002',tempLoc1,bj_UNIT_FACING)
    set iceball2 = CreateUnitAtLoc(p,'h002',tempLoc2,bj_UNIT_FACING)
    call BJDebugMsg("iceballs spawned succesfully")
    
//  -- action! --
    
    loop
    
    call BJDebugMsg("preparing moving of iceballs")
    
    set targetLoc = GetUnitLoc(target)
    set aim1 = (aim1 + 40)
    set aim2 = (aim2 + 40)
    set tempLoc1 = PolarProjectionBJ(targetLoc,distance,aim1)
    set tempLoc2 = PolarProjectionBJ(targetLoc,distance,aim2)
    call SetUnitPositionLoc(iceball1,tempLoc1)
    call SetUnitPositionLoc(iceball2,tempLoc2)
    call GroupEnumUnitsInRangeOfLoc(g,tempLoc1,60.00,null)
    call GroupEnumUnitsInRangeOfLoc(g,tempLoc2,60.00,null)
    
    call BJDebugMsg("iceballs moved succesfully")

        loop
        
        call BJDebugMsg("preparing frostnova")
        
        set t = FirstOfGroup(g)
        
        exitwhen (t == null)

        set dummy = CreateUnitAtLoc(p,'h000',GetUnitLoc(t),0.00)
        call UnitAddAbility(dummy,'A003')
        call IssueTargetOrder(dummy,"frostnova",t)
        call UnitApplyTimedLife(dummy,'BTLF',1.00)
        call GroupRemoveUnit(g,t)
        
        call BJDebugMsg("frostnova striked out succesfully")
        
        endloop
    
        exitwhen (i == 0)
    
    set i = (i - 1)
    
    endloop
    
//  -- removing memory leaks --

    call BJDebugMsg("preparing to remove leaks")

    set caster = null
    set target = null
    call KillUnit(iceball1)
    call RemoveUnit(iceball1)
    set iceball1 = null
    call KillUnit(iceball2)
    call RemoveUnit(iceball2)
    set iceball2 = null
    set dummy = null
    call DestroyGroup(g)    
    set g = null
    set p = null
    call RemoveLocation(targetLoc)
    set targetLoc = null
    call RemoveLocation(tempLoc1)
    set tempLoc1 = null
    call RemoveLocation(tempLoc2)
    
    call BJDebugMsg("leaks removed succesfully")
    
endfunction

//===========================================================================
function InitTrig_Icera_Jass takes nothing returns nothing
    local trigger Trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(Trig, Condition(function cond))
    call TriggerAddAction(Trig, function act )
    set Trig = null
endfunction

i've attached a video of how it's meant to work and a screenshot of the result of my "control statements". The spell in the video is called icera and was made with GUI. It is nor MUI neither MPI.
 
1. KillUnit then RemoveUnit? Do SetUnitExploded($unit) instead, and remove the blood-art from the object editor.
2. Don't null players.
3. Don't null spell triggers.
4.
JASS:
    call GroupEnumUnitsInRangeOfLoc(g,tempLoc1,60.00,null)
    // ok...
    call GroupEnumUnitsInRangeOfLoc(g,tempLoc2,60.00,null)
    // not ok.  GroupEnum actually clears the group before it adds the new units to it, so you're only getting units from tempLoc1 added.
5. Use X,Y coordinates, instead of locations. Oh, you want PolarProjectionBJ? Just use the math directly, it's good for you.

JASS:
PolarProjectionBJ
set x = startX + distance * Cos(ang * bj_DEGTORAD)
set y = startY + distance * Sin(ang * bj_DEGTORAD)
// You don't have to use bj_DEGTORAD if you're putting in a radian, this is just for show.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
It would probably be more useful for you to have posted the image since some people (like me) are too lazy to download a 5 MB file. Or you could have just written the results of the debug message.

Anyway, there are a lot of things that could be fixed in your code (Hopefully I won't repeat what was already said):
  • You should have a better name for you cond and act function since you're not using vJass. (It helps to prevent naming conflicts with other functions in other areas of your Jass code.)
  • cond function could be shortened to return GetSpellAbilityId() == 'A002'
  • Avoid using locations when you're not using GetLocationZ All of the functions you used that have locations can be easily substituted for coordinates like GetUnitX and GetUnitY for GetUnitLoc.
    The upside to using coordinates is that you don't need to worry about them leaking as they're just reals.
  • You need to set g to CreateGroup otherwise you can't do anything with it. You can do it on the same line you declare g.
  • You don't need to create more than one dummy unit for this spell. Just remove the 'Amov' ability from one dummy unit and use it to cast the dummy spell on all of the units.
  • Use GetTriggerUnit() instead of GetSpellAbilityUnit()
 
Level 2
Joined
Jul 20, 2010
Messages
19
Thanks alot, guys! But your answers throw up alot of new questions, so please be patient, I don't have that experience in Jassing and I'm a newbie at same.
5. Use X,Y coordinates, instead of locations. Oh, you want PolarProjectionBJ? Just use the math directly, it's good for you.
what do you mean with "using math directly?" sorry if I'm annoying.
Just remove the 'Amov' ability from one dummy unit and use it to cast the dummy spell on all of the units.
what the hell is the 'Amov' ability?
-when you use "GroupEnum...", it empties the group before adds units (it's stupid, I know ), so only 1 ice ball will actually trigger a frost nova.
thanks i'll fix it immediatly. Anyway thanks for your advice.
 
PolarProjectionBJ is not magic; it is a command you issue a game to perform the following math:

JASS:
function PolarProjectionBJ takes location source, real dist, real angle returns location
    local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
    local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
    return Location(x, y)
endfunction

What I told you, is, instead of using locations, just input the x,y variables directly into your map:

JASS:
set x = startX + distance * Cos(ang * bj_DEGTORAD)
set y = startY + distance * Sin(ang * bj_DEGTORAD)
 
Level 2
Joined
Jul 20, 2010
Messages
19
k thx.

so i've worked on my code again, but i'm even more confused :S

JASS:
function cond takes nothing returns boolean
    if (GetSpellAbilityId() == 'A002') then
        call BJDebugMsg("condition true")
        return true
    else
    call BJDebugMsg("condition false")
        return false
    endif
endfunction

function act takes nothing returns nothing

//  -- variables --

    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit t1
    local unit t2
    local unit dummy1
    local unit dummy2
    local unit iceball1
    local unit iceball2
    local group g1 = CreateGroup()
    local group g2 = CreateGroup()
    local player p = GetOwningPlayer(caster)
    local real aim1 = (GetUnitFacing(caster) - 90)
    local real aim2 = (GetUnitFacing(caster) + 90)
    local real distance = 100.00
    local real xtarget = GetUnitX(target)
    local real ytarget = GetUnitY(target)
    local real xtemp1
    local real ytemp1
    local real xtemp2
    local real ytemp2
    local integer i = 30
    
    call BJDebugMsg("variables declared succesfully")
    
//  -- spawning effects -- 
   
    set iceball1 = CreateUnit(p,'h002',xtemp1,ytemp1,bj_UNIT_FACING)
    set iceball2 = CreateUnit(p,'h002',xtemp2,ytemp2,bj_UNIT_FACING)

    call BJDebugMsg("iceballs spawned succesfully")
    
//  -- action! --
    
    loop
    
    call BJDebugMsg("preparing moving of iceballs")
    
    set xtarget = GetUnitX(target)
    set ytarget = GetUnitY(target)
    set aim1 = (aim1 + 40)
    set aim2 = (aim2 + 40)
    set xtemp1 = (xtarget + distance * Cos(aim1 * bj_DEGTORAD))
    set ytemp1 = (ytarget + distance * Sin(aim1 * bj_DEGTORAD))
    set xtemp2 = (xtarget + distance * Cos(aim2 * bj_DEGTORAD))
    set ytemp2 = (ytarget + distance * Sin(aim2 * bj_DEGTORAD))
    
    call BJDebugMsg("moving icealls")
    
    call SetUnitPosition(iceball1,xtemp1,ytemp1)
    call SetUnitPosition(iceball2,xtemp2,ytemp2)
    call GroupEnumUnitsInRange(g1,xtemp1,ytemp1,50.00,null)
    call GroupEnumUnitsInRange(g2,xtemp2,ytemp2,50.00,null)
    
    call BJDebugMsg("iceballs moved succesfully")


    set dummy1 = CreateUnit(p,'h000',xtarget,ytarget,0.00)
    set dummy2 = CreateUnit(p,'h000',xtarget,ytarget,0.00)
    call UnitAddAbility(dummy1,'A003')
    call UnitAddAbility(dummy2,'A003')
       
        loop
        
        call BJDebugMsg("preparing frostnova")
        
        set t1 = FirstOfGroup(g1)
        set t2 = FirstOfGroup(g2)
        call IssueTargetOrder(dummy1,"frostnova",t1)
        call IssueTargetOrder(dummy2,"frostnova",t2)
        call GroupRemoveUnit(g1,t1)
        call GroupRemoveUnit(g2,t2)
        
        call BJDebugMsg("frostnova striked out succesfully")

        exitwhen (t1 == null and t2 == null)
                
        endloop
    
    call PolledWait(0.02)
    
    exitwhen (i == 0)
    
    set i = (i - 1)
    
    endloop
    
    call RemoveUnit(dummy1)
    call RemoveUnit(dummy2)
    
//  -- removing memory leaks --

    call BJDebugMsg("preparing to remove leaks")

    set caster = null
    set target = null
    set t1 = null
    set t2 = null
    call SetUnitExploded(iceball1,true)
    set iceball1 = null
    call SetUnitExploded(iceball2,true)
    set iceball2 = null
    set dummy1 = null
    set dummy2 = null
    call DestroyGroup(g1)    
    set g1 = null
    call DestroyGroup(g2)
    set g2 = null
    
    call BJDebugMsg("leaks removed succesfully")
    
endfunction

//===========================================================================
function InitTrig_Icera_Jass takes nothing returns nothing
    local trigger Trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(Trig, Condition(function cond))
    call TriggerAddAction(Trig, function act )

endfunction

this trigger now does only declare the variables! (debug messages)
 
Level 2
Joined
Jul 20, 2010
Messages
19
AARGH!!!
what's wrong with this fucked up code??

here it is:
JASS:
function cond takes nothing returns boolean
    if (GetSpellAbilityId() == 'A002') then
        call BJDebugMsg("condition true")
        return true
    else
    call BJDebugMsg("condition false")
        return false
    endif
endfunction

function act takes nothing returns nothing

//  -- variables --

    call BJDebugMsg("declaring variables")

    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    local unit t1
    local unit t2
    local unit dummy1
    local unit dummy2
    local unit iceball1
    local unit iceball2
    local group g1 = CreateGroup()
    local group g2 = CreateGroup()
    local player p = GetOwningPlayer(caster)
    local real aim1 = (GetUnitFacing(caster) - 90)
    local real aim2 = (GetUnitFacing(caster) + 90)
    local real distance = 100.00
    local real xtarget = GetUnitX(target)
    local real ytarget = GetUnitY(target)
    local real xtemp1 = (xtarget + distance * Cos(aim1 * bj_DEGTORAD)) 
    local real ytemp1 = (ytarget + distance * Sin(aim1 * bj_DEGTORAD))
    local real xtemp2 = (xtarget + distance * Cos(aim2 * bj_DEGTORAD))
    local real ytemp2 = (ytarget + distance * Sin(aim2 * bj_DEGTORAD))
    local integer i = 30
    
    call BJDebugMsg("variables declared succesfully")
    
//  -- spawning effects -- 
   
    set iceball1 = CreateUnit(p,'h002',xtemp1,ytemp1,bj_UNIT_FACING)
    set iceball2 = CreateUnit(p,'h002',xtemp2,ytemp2,bj_UNIT_FACING)

    call BJDebugMsg("iceballs spawned succesfully")
    
//  -- action! --
    
    loop
    
    call BJDebugMsg("preparing moving of iceballs")
    
    set xtarget = GetUnitX(target)
    set ytarget = GetUnitY(target)
    set aim1 = (aim1 + 40)
    set aim2 = (aim2 + 40)
    set xtemp1 = (xtarget + distance * Cos(aim1 * bj_DEGTORAD))
    set ytemp1 = (ytarget + distance * Sin(aim1 * bj_DEGTORAD))
    set xtemp2 = (xtarget + distance * Cos(aim2 * bj_DEGTORAD))
    set ytemp2 = (ytarget + distance * Sin(aim2 * bj_DEGTORAD))
    
    call BJDebugMsg("moving icealls")
    
    call SetUnitPosition(iceball1,xtemp1,ytemp1)
    call SetUnitPosition(iceball2,xtemp2,ytemp2)
    call GroupEnumUnitsInRange(g1,xtemp1,ytemp1,50.00,null)
    call GroupEnumUnitsInRange(g2,xtemp2,ytemp2,50.00,null)
    
    call BJDebugMsg("iceballs moved succesfully")


    set dummy1 = CreateUnit(p,'h000',xtarget,ytarget,0.00)
    set dummy2 = CreateUnit(p,'h000',xtarget,ytarget,0.00)
    call UnitAddAbility(dummy1,'A003')
    call UnitAddAbility(dummy2,'A003')
       
        loop
        
        call BJDebugMsg("preparing frostnova")
        
        set t1 = FirstOfGroup(g1)
        set t2 = FirstOfGroup(g2)
        call IssueTargetOrder(dummy1,"frostnova",t1)
        call IssueTargetOrder(dummy2,"frostnova",t2)
        call GroupRemoveUnit(g1,t1)
        call GroupRemoveUnit(g2,t2)
        
        call BJDebugMsg("frostnova striked out succesfully")

        exitwhen (t1 == null and t2 == null)
                
        endloop
    
    call PolledWait(0.02)
    
    exitwhen (i == 0)
    
    set i = (i - 1)
    
    endloop
    
    call RemoveUnit(dummy1)
    call RemoveUnit(dummy2)
    
//  -- removing memory leaks --

    call BJDebugMsg("preparing to remove leaks")

    set caster = null
    set target = null
    set t1 = null
    set t2 = null
    call SetUnitExploded(iceball1,true)
    set iceball1 = null
    call SetUnitExploded(iceball2,true)
    set iceball2 = null
    set dummy1 = null
    set dummy2 = null
    call DestroyGroup(g1)    
    set g1 = null
    call DestroyGroup(g2)
    set g2 = null
    
    call BJDebugMsg("leaks removed succesfully")
    
endfunction

//===========================================================================
function InitTrig_Icera_Jass takes nothing returns nothing
    local trigger Trig = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(Trig, Condition(function cond))
    call TriggerAddAction(Trig, function act )
    set Trig = null
endfunction

now, JassCraft's syntax checker worked properly since i posted my last post.
Now it seems, that my first variable
JASS:
     local unit caster = GetTriggerUnit()
is a SYNTAX ERROR
and all other lines are errors, too.
i only changed this:
JASS:
    local real xtemp1 = (xtarget + distance * Cos(aim1 * bj_DEGTORAD)) 
    local real ytemp1 = (ytarget + distance * Sin(aim1 * bj_DEGTORAD))
    local real xtemp2 = (xtarget + distance * Cos(aim2 * bj_DEGTORAD))
    local real ytemp2 = (ytarget + distance * Sin(aim2 * bj_DEGTORAD))
and now everything's wrong, too Dx :angry::cry::cry:
 
Level 2
Joined
Jul 20, 2010
Messages
19
Finally!
The spell works fine now. I'll attach a test map with this spell.
But now i have a question: are there any ways to make the moving of the iceballs more liquidly? they move around the target and they stay at the target even if it moves. And there it does not look really good anymore. Anyway the spell is ready. have fun :grin:
 

Attachments

  • Icera public.w3x
    26.6 KB · Views: 64
Level 14
Joined
Nov 18, 2007
Messages
1,084
Your cond function is still inefficient. Maybe you didn't understand what I meant?
Do this:
JASS:
function Icera_condition takes nothing returns boolean
    return GetSpellAbilityId() == 'A002'
endfunction

You forgot about Bribe's advice about SetUnitExploded

To your problem: I don't really understand what you mean, but you could try using SetUnitX/SetUnitY instead of SetUnitPosition for the Icera dummy unit.
 
Level 2
Joined
Jul 20, 2010
Messages
19
ok I forgot about that condition.
And I tried SetUnitExploded, but it didn't work somehow.
I used coordinates instead of locations already.
What i meant is, that i wanted that the iceballs 'move' more smoothly.
 
Level 2
Joined
Jul 20, 2010
Messages
19
I already know the reason why it looks so ugly but i can't fix it. I used PolledWait(0.01),
but it lasts much much much longer than 0.01. The solution is: Timer. I've read a bunch of tutorials about using timers, but it's about linking and all that crazy shit. Somehow these functions used for linking don't exist in my WE and in the Newgen WE and JassCraft neither.
So i think 'bout posting this spell into mapping help section (or whatever it's called).
 
Level 2
Joined
Jul 20, 2010
Messages
19
yeah i do mean that. These functions used for linking do oviously NOT EXIST in my editor.
And TimerUtils is scripted in vJass, which makes my map crash everytime i script smth in NEWGEN WE in vJass.
 
Status
Not open for further replies.
Top