first JASS trigger was a failure

soulmaka

New Member
Reaction score
2
hey guys.. :D
I just made my 1st 2 triggers using JASS, I converted some GUI codes into JASS.. and this was the result
I was trying to make 3 fireballs which then ordered to go to the target point of Ability being casts
then
turns on the seconds JASS trigger which kills any unit that the fireball passes by..

BUT...............

SOLVED!!OK!! i just forgot to put integer in the 2nd trigger.. :D

anyways i was wondering if I can create multiple events in one JASS trigger? cause I'm definitely confused on this one.. O_O

here's the code by the way..

JASS:

function Trig_Firaga_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A02B' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Firaga_Actions takes nothing returns nothing
local location FireabllTPOABC = GetSpellTargetLoc()
set udg_FireballTU = GetTriggerUnit()
    set udg_FireballInteger = 1
    loop
        exitwhen udg_FireballInteger > 3
        call CreateNUnitsAtLoc( 1, 'h00C', GetOwningPlayer(GetTriggerUnit()), PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 150.00, ( GetUnitFacing(GetTriggerUnit()) + ( I2R(udg_FireballInteger) * 120.00 ) )), bj_UNIT_FACING )
        set udg_Fireball[udg_FireballInteger] = GetLastCreatedUnit()
        call IssuePointOrderLocBJ( udg_Fireball[udg_FireballInteger], "move", GetSpellTargetLoc() )
        set udg_FireballInteger = udg_FireballInteger + 1
    endloop
    call TriggerSleepAction( 1 )
    call EnableTrigger( gg_trg_Firaga_Activation )
endfunction

//===========================================================================
function InitTrig_Firaga takes nothing returns nothing
    set gg_trg_Firaga = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Firaga, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Firaga, Condition( function Trig_Firaga_Conditions ) )
    call TriggerAddAction( gg_trg_Firaga, function Trig_Firaga_Actions )
endfunction


JASS:

// trigger 2
// this trigger is for the periodic event, which kills units that the fireball passes through.. 
// but It doesn't work!!! O_O
function Trig_Firaga_Activation_Func001002003 takes nothing returns boolean
    if ( not ( IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(udg_FireballTU)) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Firaga_Activation_Func002A takes nothing returns nothing
if (Trig_Firaga_Activation_Func001002003() ) then
    call KillUnit( GetEnumUnit() )
    else
    endif
endfunction

function Trig_Firaga_Activation_Actions takes nothing returns nothing
local location FireballUGLOC= GetUnitLoc(udg_Fireball[udg_FireballInteger])
    set udg_FireballUG = GetUnitsInRangeOfLocAll(200.00, GetUnitLoc(udg_Fireball[udg_FireballInteger]))
    call ForGroupBJ( udg_FireballUG, function Trig_Firaga_Activation_Func002A )
endfunction

//===========================================================================
function InitTrig_Firaga_Activation takes nothing returns nothing
    set gg_trg_Firaga_Activation = CreateTrigger(  )
    call DisableTrigger( gg_trg_Firaga_Activation )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Firaga_Activation, 0.03 )
    call TriggerAddAction( gg_trg_Firaga_Activation, function Trig_Firaga_Activation_Actions )
endfunction
 

WolfieeifloW

WEHZ Helper
Reaction score
372
For JASS, please post here.
Also, see all that red?
Generally, those are bad.
Red text are functions that call upon another function to do the job.

Something like [ljass]ForGroupBJ()[/ljass] calls [ljass]ForGroup()[/ljass].
The purple text functions are called Natives.
That's what you want to see in your scripts, not red.

I'm bad at metaphors, but calling a BJ is like if you want to call your aunt.
Instead, you call your mom to call your aunt <-- This is the BJ.
Why not just call your aunt yourself? You save yourself a call. <-- The native.

But again, I'm horrible with metaphors :nuts:
 

tooltiperror

Super Moderator
Reaction score
231
You don't need a metaphor ...

[LJASS]ForGroupBJ[/LJASS] is defined as such:
JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction

It's a big bloated code when all you need to do is call [LJASS]ForGroup[/LJASS].

Not that you should really use [LJASS]ForGroup[/LJASS] at all.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
To someone who doesn't know JASS, showing them JASS code isn't going to help.
Using a, even though crappy, metaphor will help, as it relates to something that everyone knows.
 

soulmaka

New Member
Reaction score
2
To someone who doesn't know JASS, showing them JASS code isn't going to help.
Using a, even though crappy, metaphor will help, as it relates to something that everyone knows.

You don't need a metaphor ...

[LJASS]ForGroupBJ[/LJASS] is defined as such:
JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction

It's a big bloated code when all you need to do is call [LJASS]ForGroup[/LJASS].

Not that you should really use [LJASS]ForGroup[/LJASS] at all.

thanks to the both of you.. :D I was kinda LAZY to read the JASS Tutorials, cause I'm going to learn JAVA programming now,. and I think JAVA and JASS are quite the same..? :D anyways.. thanks +rep WolfieeifloW & tooltiperror

@WolfieeifloW
while reading at your metaphor,.. I was having a dirty imagination in my head, because you we're using the term BJ, aunt, mom, call your aunt.. etc. :D .. HAHAHA..
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top