• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] gametype variable implementation

Status
Not open for further replies.
Code:
function Trig_MirrorStone_Conditions takes nothing returns nothing
    if (gg_gamecheck == GAME_TYPE_MELEE) then
        return true
    endif
    return false
endfunction

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

function Trig_MirrorStone_Actions takes nothing returns nothing
    if ( Trig_MirrorStone_Func001C() ) then
        call UnitAddItemByIdSwapped( GetItemTypeId(GetSpellTargetItem()), GetSpellAbilityUnit() )
    else
    endif
endfunction

//===========================================================================
function InitTrig_MirrorStone takes nothing returns nothing
    local gametype gg_gamecheck
    set gg_trg_MirrorStone = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_MirrorStone, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_MirrorStone, Condition( function Trig_MirrorStone_Conditions ) )
    call TriggerAddAction( gg_trg_MirrorStone, function Trig_MirrorStone_Actions )
endfunction

Can someone please tell me if this is written correctly and if not what do I need to in order to implement
such a variable in map script? I think gametype is a global variable and I'm not really sure where to add it if at all.
 
Status
Not open for further replies.
Top