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

WC2: 2ndGen Script

Status
Not open for further replies.
Level 1
Joined
Sep 7, 2010
Messages
3
Hi, i need help with this script (Warcraft 2: 2nd Generation -Strategy Master)
Because the Mod is not be worked on any more and i want to play it in Lan, without this bug:

When Player1 open the "Build Structure"-Button, the construction-menu is also open for allied Player 2.

Does anyone have a solution for this or a better script ?

JASS:
function Advanced_Build takes unit caster,integer buildtype returns nothing
    local integer new_builder_id= 0
    local unit new_builder= null
    local player p= GetOwningPlayer(caster)

    if buildtype == cgm_HADVBUILD then
        set new_builder_id=cgm_ADVPEASANT
    elseif buildtype == cgm_OADVBUILD then
        set new_builder_id=cgm_ADVPEON
    elseif buildtype == cgm_HSTDBUILD then
        set new_builder_id=cgm_PEASANT
    else
        set new_builder_id=cgm_PEON
    endif
    
    if GetUnitTypeId(caster) != new_builder_id then
        set new_builder=ReplaceWorkerWJ(caster , new_builder_id)
        call SelectUnitAddForPlayer(new_builder, p)
    else
        set new_builder=caster
        //call TriggerSleepAction( 0.10 )
       // call GroupAddUnitSimple( new_builder, spg_UNITGRPAdvancedBuildCommand )
    endif
    call IssueImmediateOrderBJ(new_builder, "build")
    set new_builder=null
    set p=null

endfunction

function Trgs_Worker_Advanced_Build_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == cgm_HADVBUILD or GetSpellAbilityId() == cgm_OADVBUILD or GetSpellAbilityId() == cgm_HSTDBUILD or GetSpellAbilityId() == cgm_OSTDBUILD
endfunction

function Trgs_Worker_Advanced_Build_Actions takes nothing returns nothing
    call Advanced_Build(GetSpellAbilityUnit() , GetSpellAbilityId())
endfunction

//===========================================================================
function InitTrgs_Worker_Advanced_Build takes nothing returns nothing
    set trg_Worker_Advanced_Build=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(trg_Worker_Advanced_Build, EVENT_PLAYER_UNIT_SPELL_CAST)
    call TriggerAddCondition(trg_Worker_Advanced_Build, Condition(function Trgs_Worker_Advanced_Build_Conditions))
    call TriggerAddAction(trg_Worker_Advanced_Build, function Trgs_Worker_Advanced_Build_Actions)
endfunction
 
Status
Not open for further replies.
Top