HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell Moving a dummy help

09-27-2007, 07:47 AM#1
sinners_la_b
Hey all i am making this trigger where it creates dummy units and moves them at certain angles however i cant get it to work. I added some debug messages and it says that the if statement is running however the dummy is not being moved

Collapse JASS:

function DynamicHealFirstMovement takes nothing returns nothing
    
    local timer t = GetExpiredTimer()
    local unit caster = GetHandleUnit(t, "caster")
    local unit dummy1 = GetHandleUnit(t, "dummy1")
    local location dummyloc1 = GetUnitLoc(dummy1)
    local real FirstDistance =  DynamicHealInitialRange()
    local real DistanceCounter = GetHandleReal(t, "DistanceCounter")
    local location moveto
    
        if DistanceCounter <= DynamicHealInitialRange() then
            
                 set DistanceCounter = DistanceCounter + DynamicHealProjectileSpeed()
            call SetHandleReal(t, "DistanceCounter", DistanceCounter)
            set moveto = PolarProjectionBJ(dummyloc1, DynamicHealProjectileSpeed(), 60.00)
            call SetUnitPositionLoc(dummy1, moveto)
        
    
    
    call RemoveLocation(moveto)
    call RemoveLocation(dummyloc1)
    set dummy1 = null
       endif
            
            
endfunction    
    
    
                        
                        
function DynamicHealMain takes nothing returns nothing

    local timer t = CreateTimer()
    local unit caster = GetTriggerUnit()
    local unit dummy1 = CreateUnit(GetOwningPlayer(caster), DynamicHealDummyRaw(),  GetUnitX(caster), GetUnitY(caster), 0.00)
    
                 call SetHandleHandle(t, "caster", caster)
         call SetHandleHandle(t, "dummy1", dummy1)
         
         
         call TimerStart(t, 0.03, true, function DynamicHealFirstMovement)   
                            
endfunction    

09-27-2007, 12:18 PM#2
Anitarf
Make sure your dummy unit has a movement speed greater than 0.
09-27-2007, 01:11 PM#3
sinners_la_b
it does
09-27-2007, 01:48 PM#4
Vexorian
I think I need to see the rest of the functions, like Speed() initialRange(), and those other parameters
09-28-2007, 12:33 AM#5
sinners_la_b
heres the entire code :)

Collapse JASS:

function DynamicHealRaw takes nothing returns integer
    return 'A000'     // Raw code of Dynamic Heal
endfunction


function DynamicHealDummyRaw takes nothing returns integer
    return 'n000'
endfunction       // Raw code of the dummy projectile


function DynamicHealInitialRange takes nothing returns real
    return 700.00 // The first triangle
endfunction    


function DynamicHealProjectileSpeed takes nothing returns real
    return 10.00    // Projectile speed
endfunction


function DynamicHealDivisionNumber takes nothing returns real
    return 2.00   // The number at which you want you initial 
endfunction       // range to be divided by


function DynamicHealBaseHeal takes nothing returns real
    return 150.00
endfunction


function DynamicHealBaseUpgrade takes nothing returns real
    return 50.00    // How much you want to be upgraded per level
endfunction


                        //---------------------------\\
                        //    CONDITION FUNCTIONS    \\
                        //---------------------------\\
                        
                        
function DynamicHealCondition takes nothing returns boolean
    return GetSpellAbilityId() == DynamicHealRaw()
endfunction



                            
                            
                        //---------------------------\\
                        //   MAIN ACTION FUNCTIONS   \\
                        //---------------------------\\
    
function DynamicHealFirstMovement takes nothing returns nothing
    
    local timer t = GetExpiredTimer()
    local unit caster = GetHandleUnit(t, "caster")
    local unit dummy1 = GetHandleUnit(t, "dummy1")
    local location dummyloc1 = GetUnitLoc(dummy1)
    local real FirstDistance =  DynamicHealInitialRange()
    local real DistanceCounter = GetHandleReal(t, "DistanceCounter")
    local location moveto
    
        if DistanceCounter <= DynamicHealInitialRange() then
            set DistanceCounter = DistanceCounter + DynamicHealProjectileSpeed()
            call SetHandleReal(t, "DistanceCounter", DistanceCounter)
            set moveto = PolarProjectionBJ(dummyloc1, DynamicHealProjectileSpeed(), 60.00)
            call SetUnitPositionLoc(dummy1, moveto)
        
    
    
    call RemoveLocation(moveto)
    call RemoveLocation(dummyloc1)
    set dummy1 = null
       endif
            
            
endfunction    
    
    
                        
                        
function DynamicHealMain takes nothing returns nothing

    local timer t = CreateTimer()
    local unit caster = GetTriggerUnit()
    local unit dummy1 = CreateUnit(GetOwningPlayer(caster), DynamicHealDummyRaw(),  GetUnitX(caster), GetUnitY(caster), 0.00)
    
         call SetHandleHandle(t, "caster", caster)
         call SetHandleHandle(t, "dummy1", dummy1)
         
         
         call TimerStart(t, 0.03, true, function DynamicHealFirstMovement)   
                            
endfunction    


Thanks
09-28-2007, 03:03 AM#6
Vexorian
are you ever registering a trigger to use DynamicHealMain when that spell is casted?
09-28-2007, 03:18 AM#7
sinners_la_b
yeah. like i stated before i believe it is the DynamicHealFirstMovement function because the dummy is created and the if statement is running (added a debug message) so i belive it is something to do with the movement methods?

Thanks
09-28-2007, 03:31 AM#8
sinners_la_b
Never mind it was nothing to do with the trigger it was something to do with my dummy units movement. i changed the projectile to a peon and it worked. Sorry

Thanks to all who helped