• 🏆 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!

[GUI or JASS] Trigger Help...

Status
Not open for further replies.
Level 6
Joined
Oct 10, 2009
Messages
1,425
SOLVED by Pharoh_

Well, I have this trigger that should be fairly simple but it hates me and won't work as I want it.

It will only spawn the warrior. not the second unit,
no matter which spell I use.

I have the GUI of the code, and Jass code(It's just converted because I did this in GUI (I have a reason)). I'll accept it in either form. :)


84875652.png




JASS:
function SelectHero_RemoveAbility takes nothing returns boolean
    call UnitRemoveAbility( GetEnumUnit(),bj_groupEnumTypeId )
    return false
endfunction

function Trig_Select_Hero_Actions takes nothing returns nothing
 local unit dummy
 local unit u = GetTriggerUnit()
 local player p = GetTriggerPlayer()
 local integer check = 0
 local string s = ""
    
    set bj_groupEnumTypeId = GetSpellAbilityId()
    
    if bj_groupEnumTypeId == 'A00E' then
        set check = 3
        set s = "Warrior"
        set dummy = CreateUnit( p, 'Otch', GetWidgetX(u),GetWidgetY(u), 90.00 )
        
    elseif bj_groupEnumTypeId == 'A00G' then
        set check = 2
        set s = "Rogue"
        set dummy = CreateUnit( p, 'Edem', GetWidgetX(u),GetWidgetY(u), 90.00 )
        
    elseif bj_groupEnumTypeId == 'A00F' then
        set check = 1
        set s = "Shaman"
        set dummy = CreateUnit( p, 'O000', GetWidgetX(u),GetWidgetY(u), 90.00 )
    endif
    
    if check > 0 then
        set udg_Shaman_Rogue_Tauren[GetPlayerId(p)+1] = check
        call DisplayTextToPlayer( GetLocalPlayer(), ( "|c00ff0000" + ( GetPlayerName(p) + " has selected the "+s+" class." ) ) )
        call UnitAddItemById( dummy,'pghe' )
        call UnitAddItemById( dummy,'pgma' )
        call UnitAddItemById( dummy,'ankh' )
        call GroupEnumUnitsInRect(bj_lastCreatedGroup,gg_rct_Starting_Region, Filter(function SelectHero_RemoveAbility ))
        call TriggerSleepAction( 0.00 )
        call SelectUnitForPlayerSingle( dummy, p )
        set dummy = null
    endif
    
    set u = null
endfunction

function Trig_Select_Hero_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'ncop'
endfunction

//===========================================================================
function InitTrig_Select_Hero takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_Select_Hero_Conditions ) )
    call TriggerAddAction(t,function Trig_Select_Hero_Actions)
endfunction


[rainbow]+rep, and thanks will be given[/rainbow]
 
Last edited:
It doesn't seem to have anything wrong (the GUI version, because the Jass one is a pain for my eyes). Change the events to Unit - A unit starts the effect of an ability and remove the Wait. Make sure the abilities' Order Id's are not the same. Finally, make sure your Rogue model is different from the Warrior one and you didn't realize it.
If all fails, send me the map.
 
Level 6
Joined
Oct 10, 2009
Messages
1,425
Yeah, I know the warrior trigger runs, as it displays the text. Something is wrong with the condition, But I'm positive that I cast the correct ability... :/
I'll try what you said though. I'll edit this in a sec.

EDIT: Neither of those worked Independently or together. but the order Id's are
A00E:ANwk
A00F:ANwk

The ANwk are the same, Is that the problem?
 
Dunno the problem, but I've prettied it up in Jass:

JASS:
function SelectHero_RemoveAbility takes nothing returns boolean
    call UnitRemoveAbility( GetEnumUnit(),bj_groupEnumTypeId )
    return false
endfunction

function Trig_Select_Hero_Actions takes nothing returns nothing
 local unit dummy
 local unit u = GetTriggerUnit()
 local player p = GetTriggerPlayer()
 local integer check = 0
 local string s = ""
    
    set bj_groupEnumTypeId = GetSpellAbilityId()
    
    if bj_groupEnumTypeId == 'A00E' then
        set check = 3
        set s = "Warrior"
        set dummy = CreateUnit( p, 'Otch', GetWidgetX(u),GetWidgetY(u), 90.00 )
        
    elseif bj_groupEnumTypeId == 'A00G' then
        set check = 2
        set s = "Rogue"
        set dummy = CreateUnit( p, 'Edem', GetWidgetX(u),GetWidgetY(u), 90.00 )
        
    elseif bj_groupEnumTypeId == 'A00F' then
        set check = 1
        set s = "Shaman"
        set dummy = CreateUnit( p, 'O000', GetWidgetX(u),GetWidgetY(u), 90.00 )
    endif
    
    if check > 0 then
        set udg_Shaman_Rogue_Tauren[GetPlayerId(p)+1] = check
        call DisplayTextToPlayer( GetLocalPlayer(), ( "|c00ff0000" + ( GetPlayerName(p) + " has selected the "+s+" class." ) ) )
        call UnitAddItemById( dummy,'pghe' )
        call UnitAddItemById( dummy,'pgma' )
        call UnitAddItemById( dummy,'ankh' )
        call GroupEnumUnitsInRect(bj_lastCreatedGroup,gg_rct_Starting_Region, Filter(function SelectHero_RemoveAbility ))
        call TriggerSleepAction( 0.00 )
        call SelectUnitForPlayerSingle( dummy, p )
        set dummy = null
    endif
    
    set u = null
endfunction

function Trig_Select_Hero_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'ncop'
endfunction

//===========================================================================
function InitTrig_Select_Hero takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_Select_Hero_Conditions ) )
    call TriggerAddAction(t,function Trig_Select_Hero_Actions)
endfunction
 
EDIT: Neither of those worked Independently or together. but the order Id's are
A00E:ANwk
A00F:ANwk

The ANwk are the same, Is that the problem?
No, not that. Go to the abilities and scroll to Text - Order String - Use/Turn on. If they share the same value, they must be changed. They must be based on Channel though, in order to freely change the ID with no collision (and Spell book ability, but not of our interest now).

Base them off Channel. Use "howlofterror" for the first and "roar" for the second.
 
Status
Not open for further replies.
Top