HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Shoot System not working...

07-06-2007, 02:06 AM#1
Tiku
Mmkay im making this trigger so whenever this mine explodes it will shoot a dart in all directions... (well right now i just want it to shoot up...)

here is the trigger:
Collapse JASS:
function Mineshootid takes nothing returns integer
    return 'h000'
endfunction

constant function sfxblood takes nothing returns string
    return "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
endfunction

function MineGroundCheck takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) and GetWidgetLife(GetFilterUnit()) > 0.405 and GetUnitAbilityLevel(GetFilterUnit(), 'Avul') <= 0
endfunction

function Trig_Mine_Conditions takes nothing returns boolean
    return ( GetUnitTypeId(GetTriggerUnit()) == 'n000' )
endfunction

function Trig_Mine_Mover takes unit missle returns nothing
    local unit u = GetTriggerUnit()
    local real ux = GetUnitX(u)
    local real uy = GetUnitY(u)
    local player up = GetOwningPlayer(u)
    local unit missle1 = RestoreUnit( udg_gc, "shoot", "missle", up, ux, uy, 90.0) 
    local group gt
    local boolexpr grnd = Condition(function MineGroundCheck)
    local real face1 = GetUnitFacing(missle1)
    local real x1 = GetUnitX(missle1) + 40*Cos(face1*0.01745)
    local real y1 = GetUnitX(missle1) + 40*Sin(face1*0.01745)
    local boolean yup = false
    local unit s
    local integer dist
    
    call SetUnitX(missle1, x1)
    call SetUnitY(missle1, y1)
    set dist = dist+60
    call GroupEnumUnitsInRange( gt, x1, y1, 60, grnd )
    loop 
    set s = FirstOfGroup(gt)
    exitwhen yup == true or s == null
     if IsUnitEnemy(s, up) then
      set yup = true
      call DestroyEffect(AddSpecialEffect(sfxblood(), GetUnitX(s), GetUnitY(s)))
      call KillUnit(s)
     endif
     if yup or dist >= 800 then
      call KillUnit(missle1)
     endif
     endloop
     call GroupClear(gt)
     
     set u = null
     set up = null
     set missle1 = null  
     set s = null
endfunction

function Trig_Mine_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real ux = GetUnitX(u)
    local real uy = GetUnitY(u) 
    local player up = GetOwningPlayer(u)
    local unit missle = CreateUnit( up, Mineshootid(), ux, uy, 90.0)
    local timer time
    call StoreUnit(udg_gc, "shoot", "missle", missle)
    call TimerStart( time, 0.02, true, function Trig_Mine_Mover)
    
    set u = null
    set missle = null
    set up = null  
endfunction

//===========================================================================
function InitTrig_Mine takes nothing returns nothing
    set gg_trg_Mine = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Mine, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Mine, Condition( function Trig_Mine_Conditions ) )
    call TriggerAddAction( gg_trg_Mine, function Trig_Mine_Actions )
endfunction

So here is the problem... it will create the dart, but not move it... and if an enemy comes within range of the dart it wont die, along with the unit...
07-07-2007, 06:53 PM#2
PitzerMike
In Trig_Mine_Actions you forgot to create the timer:

Collapse JASS:
local timer time = CreateTimer() // or was it TimerCreate() ? 
07-07-2007, 08:03 PM#3
Pyrogasm
Quote:
Originally Posted by PitzerMike
// or was it TimerCreate() ?
It's CreateTimer().
07-07-2007, 10:03 PM#4
Tiku
lol omg... you guys dont even know how much i love you right now :D