• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Just got NewGen can someone help me with import?

Status
Not open for further replies.
Level 4
Joined
Jun 1, 2009
Messages
87
Hi so i just got new Gen cause i wana try some JASS spells but i cant seem to get the import right, when i imported the spell and followed directions new gen is telling me there is 15 compiled errors and wont let me test the map.
I have double and tripple checked my ID number and it all matches, i have checked the spell order ID as well and its set to "clusterrockets" like the spell said.

This is just the first part of error

new gen says

Line 17609: undecleared Function GetHandled unit
and its hightlightning this line
"local unit cast= GetHandleUnit(t , "cast")"

Line 17910: Undeclared function GetHandleReal
"local real angle= GetHandleReal(t , "angle")"

and jsut continues down the page. I got the spell off Hive, "wave Spell" and i am pretty sure it works fine since it works before i imported....



JASS:
function Dragon_Roar takes nothing returns nothing
    local timer t= GetExpiredTimer()
    local unit cast= GetHandleUnit(t , "cast")
    local real angle= GetHandleReal(t , "angle")
    local real z= GetHandleReal(t , "z")
    local real x1= GetHandleReal(t , "x1")


Here is what my import looks like

JASS:
//===============================Dragon Roar By BlackShogun==============================//

//=========================================Setup=========================================//
//Note: to edit the spells DAMAGE, change the damage parameter in the DRAGON ROAR DUMMY spell

//change this to the raw code of your trigger spell
constant function DragonRoarCode takes nothing returns integer
    return 'A043'
endfunction

//change this to the raw code of your dummy caster
constant function DragonRoarDummy takes nothing returns integer
    return 'h03W'
endfunction

//change this to the raw code of your dummy spell (the spell that will be repeated to create the wave)
constant function DragonRoarRawCode takes nothing returns integer
    return 'A042'
endfunction

//change this to the order id of your dummy spell (the spell that will be repeated to create the wave)
constant function DragonRoarID takes nothing returns string
    return "clusterrockets"
endfunction

//change this to edit the number of parts to the wave
function DragonRoarRepeats takes real lvl returns real
    return 4+(2*lvl)
endfunction

//change this to edit the distance between each part of the wave
constant function DragonRoarDistance takes nothing returns real
    return 100.0
endfunction

//change this to edit the time between each part of the wave
constant function DragonRoarInterval takes nothing returns real
    return 0.25
endfunction

//change this to edit the caster dummies lifespan (recommended 3.0)
constant function DragonRoarDummySpan takes nothing returns real
    return 3.0
endfunction
    
//======================================End Setup=======================================//
//Note: Changing anything beyond here may stop the trigger from functioning and should be left alone
    
function Trig_Dragon_Roar_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == DragonRoarCode()
endfunction

function Dragon_Roar takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit cast = GetHandleUnit(t, "cast")
    local real angle = GetHandleReal(t, "angle")
    local real z = GetHandleReal(t, "z")
    local real x1 = GetHandleReal(t, "x1")
    local real y1 = GetHandleReal(t, "y1")
    local integer lvl = GetUnitAbilityLevel(cast, DragonRoarCode())
    local player p = GetOwningPlayer(cast)
    local real mx = DragonRoarDistance() * Cos(angle * 0.01745)
    local real my = DragonRoarDistance() * Sin(angle * 0.01745)
    local unit u
    
if z<DragonRoarRepeats(lvl) then
    set z = z+1
    call SetHandleReal(t, "z", z)
    set u = CreateUnit(p, DragonRoarDummy(), x1, y1, angle)
    call SetUnitAbilityLevel(u, DragonRoarRawCode(), lvl)
    call IssuePointOrder(u, DragonRoarID(), (x1 + (mx * z)), (y1 + (my * z)))
    call UnitApplyTimedLife(u, 'BTLF', DragonRoarDummySpan()) 
else
    call FlushHandleLocals(t)
    call PauseTimer(t)
    call DestroyTimer(t)
    set t = null
endif

    set cast = null
    set p = null
    set u = null
endfunction

function Trig_Dragon_Roar_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local unit cast = GetTriggerUnit()
    local location targ = GetSpellTargetLoc()
    local real x1 = GetUnitX(cast)
    local real y1 = GetUnitY(cast)
    local real x2 = GetLocationX(targ)
    local real y2 = GetLocationY(targ)
    local real angle = 57.29583 * Atan2(y2-y1, x2-x1)
    
    call SetHandleHandle(t, "cast", cast)
    call SetHandleReal(t, "angle", angle)
    call SetHandleReal(t, "x1", x1)
    call SetHandleReal(t, "y1", y1)
    call TimerStart(t, DragonRoarInterval(), true, function Dragon_Roar)
    set t = null
    call RemoveLocation(targ)
    set targ = null
    set cast = null
endfunction

//===========================================================================
function InitTrig_Dragon_Roar takes nothing returns nothing
    set gg_trg_Dragon_Roar = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Dragon_Roar, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Dragon_Roar, Condition( function Trig_Dragon_Roar_Conditions ) )
    call TriggerAddAction( gg_trg_Dragon_Roar, function Trig_Dragon_Roar_Actions )
endfunction



Pls help thx + rep if anyone can teach me how to import Jass and or guide me to a tutorial on it.
 
Level 11
Joined
Apr 6, 2008
Messages
760
Yeah u should use structs and TimerUtils

JASS:
//===============================Dragon Roar By BlackShogun==============================//

//=========================================Setup=========================================//
//Note: to edit the spells DAMAGE, change the damage parameter in the DRAGON ROAR DUMMY spell

//change this to the raw code of your trigger spell
constant function DragonRoarCode takes nothing returns integer
    return 'A043'
endfunction

//change this to the raw code of your dummy caster
constant function DragonRoarDummy takes nothing returns integer
    return 'h03W'
endfunction

//change this to the raw code of your dummy spell (the spell that will be repeated to create the wave)
constant function DragonRoarRawCode takes nothing returns integer
    return 'A042'
endfunction

//change this to the order id of your dummy spell (the spell that will be repeated to create the wave)
constant function DragonRoarID takes nothing returns string
    return "clusterrockets"
endfunction

//change this to edit the number of parts to the wave
function DragonRoarRepeats takes real lvl returns real
    return 4+(2*lvl)
endfunction

//change this to edit the distance between each part of the wave
constant function DragonRoarDistance takes nothing returns real
    return 100.0
endfunction

//change this to edit the time between each part of the wave
constant function DragonRoarInterval takes nothing returns real
    return 0.25
endfunction

//change this to edit the caster dummies lifespan (recommended 3.0)
constant function DragonRoarDummySpan takes nothing returns real
    return 3.0
endfunction

//======================================End Setup=======================================//
//Note: Changing anything beyond here may stop the trigger from functioning and should be left alone

function Trig_Dragon_Roar_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == DragonRoarCode()
endfunction

function Dragon_Roar takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit cast = GetHandleUnit(t, "cast")
    local real angle = GetHandleReal(t, "angle")
    local real z = GetHandleReal(t, "z")
    local real x1 = GetHandleReal(t, "x1")
    local real y1 = GetHandleReal(t, "y1")
    local integer lvl = GetUnitAbilityLevel(cast, DragonRoarCode())
    local player p = GetOwningPlayer(cast)
    local real mx = DragonRoarDistance() * Cos(angle * 0.01745)
    local real my = DragonRoarDistance() * Sin(angle * 0.01745)
    local unit u

if z<DragonRoarRepeats(lvl) then
    set z = z+1
    call SetHandleReal(t, "z", z)
    set u = CreateUnit(p, DragonRoarDummy(), x1, y1, angle)
    call SetUnitAbilityLevel(u, DragonRoarRawCode(), lvl)
    call IssuePointOrder(u, DragonRoarID(), (x1 + (mx * z)), (y1 + (my * z)))
    call UnitApplyTimedLife(u, 'BTLF', DragonRoarDummySpan())
else
    call FlushHandleLocals(t)
    call PauseTimer(t)
    call DestroyTimer(t)
    set t = null
endif

    set cast = null
    set p = null
    set u = null
endfunction

function Trig_Dragon_Roar_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local unit cast = GetTriggerUnit()
    local location targ = GetSpellTargetLoc()
    local real x1 = GetUnitX(cast)
    local real y1 = GetUnitY(cast)
    local real x2 = GetLocationX(targ)
    local real y2 = GetLocationY(targ)
    local real angle = 57.29583 * Atan2(y2-y1, x2-x1)

call SetHandleHandle(t, "cast", cast)
    call SetHandleReal(t, "angle", angle)
    call SetHandleReal(t, "x1", x1)
    call SetHandleReal(t, "y1", y1)
    call TimerStart(t, DragonRoarInterval(), true, function Dragon_Roar)
    set t = null
    call RemoveLocation(targ)
    set targ = null
    set cast = null
endfunction

//===========================================================================
function InitTrig_Dragon_Roar takes nothing returns nothing
    set gg_trg_Dragon_Roar = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Dragon_Roar, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Dragon_Roar, Condition( function Trig_Dragon_Roar_Conditions ) )
    call TriggerAddAction( gg_trg_Dragon_Roar, function Trig_Dragon_Roar_Actions )
endfunction

I've updated this little quick, it use TimerUtils other then that is the same as the old

JASS:
scope DragonRoar initializer init
//===============================Dragon Roar By BlackShogun==============================//

//=========================================Setup=========================================//
//Note: to edit the spells DAMAGE, change the damage parameter in the DRAGON ROAR DUMMY spell
globals
    //change this to the raw code of your trigger spell
    private constant integer DragonRoarCode = 'A043'
    
    //change this to the raw code of your dummy caster
    private constant integer DragonRoarDummy = 'h03W'
    
    //change this to the raw code of your dummy spell (the spell that will be repeated to create the wave)
    private constant integer DragonRoarRawCode = 'A042'
    
    //change this to the order id of your dummy spell (the spell that will be repeated to create the wave)
    private constant string DragonRoarID = "clusterrockets"
    
    //change this to edit the distance between each part of the wave
    private constant real DragonRoarDistance = 100
    
    //change this to edit the time between each part of the wave
    private constant real DragonRoarInterval = 0.25
    
    //change this to edit the caster dummies lifespan (recommended 3.0)
    private constant real DragonRoarDummySpan = 3
endglobals
    
    //change this to edit the number of parts to the wave
private function DragonRoarRepeats takes real lvl returns real
    return 4+(2*lvl)
endfunction
//======================================End Setup=======================================//
//Note: Changing anything beyond here may stop the trigger from functioning and should be left alone

private struct Data
    unit cast
    integer lvl
    real angle
    real z
    real x1
    real y1
    player p
    timer Time
    
    method onDestroy takes nothing returns nothing
        set .cast = null
        set .p = null      
    endmethod
endstruct

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == DragonRoarCode
endfunction

private function Dragon_Roar takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local Data Dat = GetTimerData(t)
    local real mx = DragonRoarDistance * Cos(Dat.angle * 0.01745)
    local real my = DragonRoarDistance * Sin(Dat.angle * 0.01745)
    local unit u

    if Dat.z<DragonRoarRepeats(Dat.lvl) then
        set Dat.z = Dat.z+1
        set u = CreateUnit(Dat.p, DragonRoarDummy, Dat.x1, Dat.y1, Dat.angle)
        call SetUnitAbilityLevel(u, DragonRoarRawCode, Dat.lvl)
        call IssuePointOrder(u, DragonRoarID, (Dat.x1 + (mx * Dat.z)), (Dat.y1 + (my * Dat.z)))
        call UnitApplyTimedLife(u, 'BTLF', DragonRoarDummySpan)
    else
        call ReleaseTimer(Dat.Time)
        call Dat.destroy()
    endif

    set u = null
endfunction

private function Actions takes nothing returns nothing
    local Data Dat = Data.create()
    local location targ = GetSpellTargetLoc()
    local real x2 = GetLocationX(targ)
    local real y2 = GetLocationY(targ)
    
    set Dat.cast = GetTriggerUnit()
    set Dat.lvl = GetUnitAbilityLevel(Dat.cast, DragonRoarCode)
    set Dat.p = GetOwningPlayer(Dat.cast)
    set Dat.x1 = GetUnitX(Dat.cast)
    set Dat.y1 = GetUnitY(Dat.cast)
    set Dat.angle = 57.29583 * Atan2(y2-Dat.y1, x2-Dat.x1)
    set Dat.Time = NewTimer()
    
    call SetTimerData(Dat.Time,Dat)
    
    call TimerStart(Dat.Time, DragonRoarInterval, true, function Dragon_Roar)
    call RemoveLocation(targ)
    set targ = null
endfunction

//===========================================================================
private function init takes nothing returns nothing
    local trigger trig = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( trig, Condition( function Conditions ) )
    call TriggerAddAction( trig, function Actions )
endfunction

endscope
 
Last edited:
Status
Not open for further replies.
Top