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

[JASS] Spell not working, no syntax errors

Status
Not open for further replies.
JASS:
function Trig_Glass_Func002Func002Func005003 takes nothing returns nothing
    call KillDestructable( GetEnumDestructable() )
endfunction

function Glass takes location loc returns nothing
        local location point = loc
        call AddSpecialEffectLocBJ( point, "war3mapImported\\Lasercannon.mdx" )
        call TriggerSleepAction(2.00)
        call TerrainDeformationCraterBJ( 2.00, true, point, 512, 50.00 )
        call SetTerrainTypeBJ( point, 'Nice', -1, 3, 0 )
        call EnumDestructablesInCircleBJ( 256, point, function Trig_Glass_Func002Func002Func005003 )
        call RemoveLocation(point)
endfunction

function Trig_Glass_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A00E' ) then
        return true
    endif
    return false
endfunction

function Trig_Glass_Func002C takes nothing returns boolean
    if ( GetSpellTargetUnit() == gg_unit_e000_0005 ) then
        return true
    endif
    return false
endfunction

function Trig_Glass_Actions takes nothing returns nothing
    local location point
    local integer t=GetTerrainTypeBJ(point)
    if ( Trig_Glass_Func002C() ) then
        set udg_LOOP = 1
        if (not(t == 'nice')) then
        loop
            call Glass(GetRandomLocInRect(gg_rct_Planet_1))
            call RemoveLocation(point)
            call TriggerSleepAction( GetRandomReal(0.00, 0.50) )
            set udg_LOOP = udg_LOOP + 1
        endloop
        endif
    endif
endfunction

//===========================================================================
function InitTrig_Glass takes nothing returns nothing
    set gg_trg_Glass = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Glass, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Glass, Condition( function Trig_Glass_Conditions ) )
    call TriggerAddAction( gg_trg_Glass, function Trig_Glass_Actions )
endfunction

This is my glassing trigger, you basically cast it on a planet, and it creates a whole bunch of explosions and stuff in a rect, but when you cast the ability nothing happens.. help?

PS: i'm medeocre at jass, but i still use jasscraft.

+rep will be given to any good answers..
 
It's because you never set point to anything, yet you use it so it crashes the thread.

Also your loop is infinite. I made a modified version of your script with a lot of improvements.

I've removed all of your locations and replaced them with coordinates (except I had to add a location for one of the BJ's).

Removed all but 1 unneeded BJ (I was lazy).

Fixed your infinite loop and removed the global integer dependency.

And I've also inlined some functions.

Though more can still be done to improve it.

JASS:
function Trig_Glass_Func002Func002Func005003 takes nothing returns nothing
    call KillDestructable( GetEnumDestructable() )
endfunction

function Glass takes real x, real y returns nothing
    local location l = Location(x,y)
    call AddSpecialEffect("war3mapImported\\Lasercannon.mdx", x, y)
    call TriggerSleepAction(2.00)
    call TerrainDeformCrater(x, y, radius, 512, 2000, true)
    call SetTerrainType(x, y, 'Nice',  -1, 3, 0)
    call EnumDestructablesInCircleBJ( 256, l, function Trig_Glass_Func002Func002Func005003 )
    call RemoveLocation(l)
    set l = null
endfunction

function Trig_Glass_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00E'
endfunction

function Trig_Glass_Actions takes nothing returns nothing
    local real x = GetSpellTargetX()
    local real y = GetSpellTargetY()
    local integer t = GetTerrainType(x, y)
    local integer i = 1
    if GetSpellTargetUnit() == gg_unit_e000_0005 then
        if (not(t == 'nice')) then
            loop
                exitwhen i == 10
                call Glass(GetRandomReal(GetRectMinX(gg_rct_Planet_1), GetRectMaxX(gg_rct_Planet_1)), GetRandomReal(GetRectMinY(gg_rct_Planet_1), GetRectMaxY(gg_rct_Planet_1)))
                call RemoveLocation(point)
                call TriggerSleepAction( GetRandomReal(0.00, 0.50) )
                set i = i + 1
            endloop
        endif
    endif
endfunction

//===========================================================================
function InitTrig_Glass takes nothing returns nothing
    set gg_trg_Glass = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Glass, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Glass, Condition( function Trig_Glass_Conditions ) )
    call TriggerAddAction( gg_trg_Glass, function Trig_Glass_Actions )
endfunction
 
Level 12
Joined
Dec 10, 2008
Messages
850
The conditon wants a certain unit, and your loops exitwhen is also screwed. How does it now when is 'nice'. You also have alot of BJs that should be inlined.

Edit: I need to type faster and stop taking my time
 
i usually get it to work, then open up jasshelper to inline it.

But thanks triggerhappy for inlining it, and fixing it =D

One problem though. like i said.. this spell targets a unit, and then when you finish casting it its supposed to make lots of explosions on the planet. but.. i dont want it "Glassing" parts of the planet that have already been glassed... thats why the 'nice' comes in.

Is there a way to make this um.. "Spell" channeled? because i want to make it that if you stop channeling it stops glassing.
 
Last edited:
i usually get it to work, then open up jasshelper to inline it.

But thanks triggerhappy for inlining it, and fixing it =D

One problem though. like i said.. this spell targets a unit, and then when you finish casting it its supposed to make lots of explosions on the planet. but.. i dont want it "Glassing" parts of the planet that have already been glassed... thats why the 'nice' comes in.

Is there a way to make this um.. "Spell" channeled? because i want to make it that if you stop channeling it stops glassing.

make a boolean variable, for example IsChanneling
make another trigger that checks if the units stops/finishes channeling the ability which will then change the variable value
lastly make the loop check whether the variable IsChanneling equal to true or not...... Remember to set IsChanneling == true at the start of the trigger...
 
Status
Not open for further replies.
Top