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

[General] Is specific builidng under construction

Status
Not open for further replies.
Level 11
Joined
Jun 2, 2004
Messages
849
The blight dispel trick is the most reliable way. I don't know of any trigger-only ways to do it; perhaps you could somehow take advantage of its different armor type while under construction (though that also might not be general enough).
 
thanks guys,
armor check is to complicated;
dispel trick is fine for map specific solutions, but for public resource is annoying;
but from BuilderTrack I guess I can take just this small part for IsConstructed, cause I only need this.
So by use EVENT_PLAYER_UNIT_CONSTRUCT_FINISH and onIndex event and setting isContructed=false, and on EVENT_PLAYER_UNIT_CONSTRUCT_START setting to "true" it will work for all possible events? Like pre-placed units, normal construction, build by item ability (tiny castle) or created by user by CreateNUnitAtLoc in GUI? did you maybe tested when checking your BuilderTrack ?
 
Solved

JASS:
// requires Unit Event by Bribe
// use boolean isBuildingUnderConstruction[UnitUserData] to check
globals
    boolean array               isBuildingUnderConstruction
endglobals

function OnConstruct_Start_Cond takes nothing returns boolean
    set isBuildingUnderConstruction[GetUnitUserData(GetConstructingStructure())]=true
    return false
endfunction

function OnConstruct_Finish_Cond takes nothing returns boolean
    set isBuildingUnderConstruction[GetUnitUserData(GetConstructedStructure())]=false
    return false
endfunction

function OnBuilding_Enters_Cond takes nothing returns boolean
    if IsUnitType(udg_UDexUnits[udg_UDex], UNIT_TYPE_STRUCTURE) then
        set isBuildingUnderConstruction[udg_UDex]=false
    endif
    return false
endfunction
//===================================================================
function InitTrig_IsBuildingUnderConstruction takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_CONSTRUCT_START)
    call TriggerAddCondition(t, Condition(function OnConstruct_Start_Cond))
   
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_CONSTRUCT_FINISH)
    call TriggerAddCondition(t, Condition(function OnConstruct_Finish_Cond))
   
    set t = CreateTrigger()
    call TriggerRegisterVariableEvent(t, "udg_UnitIndexEvent", EQUAL, 1.00)
    call TriggerAddCondition(t, Condition(function OnBuilding_Enters_Cond))
    set t=null
endfunction
 
Status
Not open for further replies.
Top