Warcraft III resources & community, 2003–2006 · archived

how can i do this trigger in jass?

9 posts
#1

how can i do this trigger in jass?

how can i do this trigger in jass?
gds
    Events
        Player - Player 2 (Blue) types a chat message containing -level as An exact match
        Player - Player 1 (Red) types a chat message containing -level as An exact match
        Player - Player 3 (Teal) types a chat message containing -level as An exact match
        Player - Player 4 (Purple) types a chat message containing -level as An exact match
        Player - Player 5 (Yellow) types a chat message containing -level as An exact match
        Player - Player 6 (Orange) types a chat message containing -level as An exact match
        Player - Player 7 (Green) types a chat message containing -level as An exact match
        Player - Player 8 (Pink) types a chat message containing -level as An exact match
    Conditions
    Actions
        Hero - Set (Triggering unit) Hero-level to 75, Hide level-up graphics
#2
in trigger editor go to 'edit' and then 'convert to custom text'
#3
except that that sucks.

or, you could just code it in JASS in the first place

function Level_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    call GroupEnumUnitsOfPlayer( g, GetTriggerPlayer(), null )
    loop
        set u = FirstOfGroup( g )
        exitwhen u == null
        call SetHeroLevel( u, 75 )
        call GroupRemoveUnit( g, u )
    endloop
    call DestroyGroup( g )
    set g = null
endfunction

function InitTrig_Level takes nothing returns nothing
    local integer index = 0
    set gg_trg_Level = CreateTrigger()
    loop
        exitwhen index > 7
        call TriggerRegisterEnterChatString( gg_trg_Level, Player(index), "-level" )//please note that this line may be wrong, as i rarely use this function ( the name might even be wrong ), and i am on vacation, therefore having no access to a JASS editor
        set index = index + 1
    endloop
    call TriggerAddAction( gg_trg_Level, function Level_Actions )
endfunction
#4
except that that sucks.
why? isnt converting to JASS and writing in JASS the same?
#5
GUI uses BJs and stuff, and is less efficiently coded as well. Technically, its JASS, but its the kind of JASS a noob would write ( in most cases )
#6
so if u convert and remove the BJ's (what ever that may be :P) and optimize a bit its good?
#7
yes, but you usually have to know JASS to optimize it, while u can ez do the BJs with a JASS Program ( look up n fix :P )

in fact, i often code my simple triggers in GUI then convert to JASS and fix them up, as it is much faster in many cases
#8
that trigger doesnt even work as the event isnt triggered by a unit
#9
mine does, tho

*edited* removed a caps at the wrong place