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

[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