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

A basic and easy JASS problem

Status
Not open for further replies.
Level 10
Joined
Aug 19, 2008
Messages
491
Hai fellow members! :grin:

I've been working on a easy project for about 2 hours. I made a spell with GUI called "Armageddon". It's basically a combined Starfall and Earthquake.

The only major difficulty is that I wanted it to be looping (a.k.a destroyed when the caster moves) but the earthquake spell is triggered with a dummy unit. :xxd:
I solved it, but after a while I noticed it wasn't correct. :thumbs_down:
(The earthquake would persist if another unit casted Armageddon).

I've tried for some time now to get the dummy to be set as a unit array (set dummy[Player Number of ( Owner of (TriggeringUnit)))] = Last Created Unit ).
I don't want to go too deep into this swamp of triggering, so I leave it to you exceptionall JASS users:

Is there any way I can make it looping with a Jass Trigger (meaning killing the dummy if caster moves, used in the same code)?






EDIT

I got a JASS code from scorpion182. Unfortunatly something happend when I changed the data for the spell
(cool1 3->90, DataB1 1.50->0.50, DataA1 40->15) and it made the code unusable :sad:

Maybe the effect starts too fast for the JASS code to recognize as a order string? :confused:

Also help with adding a special effect would be appreciated :thumbs_up:
I would like the spell to every 2 seconds fire a Flame Strike at a random point within 1000 of the caster.
It won't do any damage, just special effects.
 
Last edited:
Level 14
Joined
Nov 4, 2006
Messages
1,241
i don't think you need Jass for that,

  • .
  • Events
    • <your caster> is issued an order
    • <your caster> dies
  • Conditions
  • Actions
    • Unit - Kill <your dummy>
    • Trigger - Turn off this Trigger
<your caster> = variable for casting Unit
<your dummy> = variable for dummy

don't know more about your spell, so i don't know if you use variables for those units, but if so, this should work, just put any possible order or event that should trigger the killing of the dummy in Events, turn this trigger on when casting begins and be sure your variables are set correctly every time the ability is cast
 
Level 10
Joined
Aug 19, 2008
Messages
491
i don't think you need Jass for that,

  • .
  • Events
    • <your caster> is issued an order
    • <your caster> dies
  • Conditions
  • Actions
    • Unit - Kill <your dummy>
    • Trigger - Turn off this Trigger
<your caster> = variable for casting Unit
<your dummy> = variable for dummy

don't know more about your spell, so i don't know if you use variables for those units, but if so, this should work, just put any possible order or event that should trigger the killing of the dummy in Events, turn this trigger on when casting begins and be sure your variables are set correctly every time the ability is cast

Haha! I tried that! Problem is what happens if 2 casters trigger the same time? :eekani:
There can be ony 1 <your dummy> and I tried making it Array (<your dummy>[1])... Didn't work
 
Here's mine View attachment (12)Cheezeman'sIceCrown.w3x
JASS:
function Trig_Armageddon_Conditions takes nothing returns boolean
    return(GetSpellAbilityId() == 'A004')
endfunction

function Armageddon_Dummy takes nothing returns nothing
    local timer t= GetExpiredTimer()
    local unit dummy=GetHandleUnit(t, "dummy")
    local unit caster = GetHandleUnit(t, "caster")
    
    if GetUnitCurrentOrder(caster) != String2OrderIdBJ("starfall") then
        call RemoveUnit(dummy)
        call FlushHandleLocals(t)
        call PauseTimer(t)
        call DestroyTimer(t)
    else
        call TimerStart(t,0.2,false,function Armageddon_Dummy)
    endif
    
    
    set t=null
    set dummy=null
    set caster=null
endfunction

function Trig_Armageddon_Actions takes nothing returns nothing
    local timer t=CreateTimer()
    local unit caster = GetTriggerUnit()
    local location loc= GetUnitLoc(caster)
    local unit dummy
    
    set dummy=CreateUnit(GetOwningPlayer(caster),'h001',GetUnitX(caster),GetUnitY(caster),bj_UNIT_FACING)
    call UnitAddAbility(dummy,'A005')
    call IssuePointOrderLoc(dummy,"earthquake",loc)
    call RemoveLocation(loc)
    
    call SetHandleHandle(t, "caster", caster)
    call SetHandleHandle(t, "dummy", dummy)
    call TimerStart(t,0,false,function Armageddon_Dummy)
    
    set t=null
    set caster=null
    set loc=null
    set dummy=null
endfunction

//===========================================================================
function InitTrig_Armageddon takes nothing returns nothing
    set gg_trg_Armageddon = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Armageddon, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Armageddon, Condition( function Trig_Armageddon_Conditions ) )
    call TriggerAddAction( gg_trg_Armageddon, function Trig_Armageddon_Actions )
endfunction
 
Level 10
Joined
Aug 19, 2008
Messages
491
Here's mine View attachment 45252
JASS:
function Trig_Armageddon_Conditions takes nothing returns boolean
    return(GetSpellAbilityId() == 'A004')
endfunction

function Armageddon_Dummy takes nothing returns nothing
    local timer t= GetExpiredTimer()
    local unit dummy=GetHandleUnit(t, "dummy")
    local unit caster = GetHandleUnit(t, "caster")
    
    if GetUnitCurrentOrder(caster) != String2OrderIdBJ("starfall") then
        call RemoveUnit(dummy)
        call FlushHandleLocals(t)
        call PauseTimer(t)
        call DestroyTimer(t)
    else
        call TimerStart(t,0.2,false,function Armageddon_Dummy)
    endif
    
    
    set t=null
    set dummy=null
    set caster=null
endfunction

function Trig_Armageddon_Actions takes nothing returns nothing
    local timer t=CreateTimer()
    local unit caster = GetTriggerUnit()
    local location loc= GetUnitLoc(caster)
    local unit dummy
    
    set dummy=CreateUnit(GetOwningPlayer(caster),'h001',GetUnitX(caster),GetUnitY(caster),bj_UNIT_FACING)
    call UnitAddAbility(dummy,'A005')
    call IssuePointOrderLoc(dummy,"earthquake",loc)
    call RemoveLocation(loc)
    
    call SetHandleHandle(t, "caster", caster)
    call SetHandleHandle(t, "dummy", dummy)
    call TimerStart(t,0,false,function Armageddon_Dummy)
    
    set t=null
    set caster=null
    set loc=null
    set dummy=null
endfunction

//===========================================================================
function InitTrig_Armageddon takes nothing returns nothing
    set gg_trg_Armageddon = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Armageddon, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Armageddon, Condition( function Trig_Armageddon_Conditions ) )
    call TriggerAddAction( gg_trg_Armageddon, function Trig_Armageddon_Actions )
endfunction

Thanks hope it works :thumbs_up: how am I supposed to change to [Solved]?
Maybe you could explain how it works for me? I'm really exited about JASS :thumbs_up:

Edit: Does not work. See original thread for details
 
Last edited:
Status
Not open for further replies.
Top