• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Capture System ( Single Target Buildings)

Not open for further replies.



Level 1
Dec 12, 2010
Hi, this Trigger is supposed to work like this:
- Unit uses Ability X
- After 10 Seconds of Casttime the Building changes Ownership to the Owner of the Casting Unit
-IF the CastingUnit is damaged the spell is canceled and the capture is stopped
- Owner of the Building gets a message and a minimap ping as warning

Thats what ive got this far:

// Condition Check
function Spell_Check takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A001' ) then   // the capture/conquer spell id
    return true
    return false

// Cancel on Damage
function C_C_Action takes nothing returns nothing
    local unit engineer = GetTriggerUnit()
    call IssueImmediateOrder(engineer, "stop")

//The Spell Effect
function Trig_Capture_Building_Human_Actions takes nothing returns nothing
    // setting of local var
    local unit engineer = GetTriggerUnit()  // casting unit
    local unit building = GetSpellTargetUnit() // the building which is to be captured
    local location building_loc = GetSpellTargetLoc()
    local trigger Capture_Cancel = CreateTrigger( )
    //Damage Taken Check
    call TriggerRegisterUnitEvent(Capture_Cancel, engineer, EVENT_UNIT_DAMAGED)
    call TriggerAddAction(Capture_Cancel,function C_C_Action)
    // Building is Captured
    call DisplayTextToPlayer( GetOwningPlayer( engineer),0,0,"Test")
    call DisplayTextToPlayer( GetOwningPlayer( building ),0,0, "A Building is being conquered!") // warning to the player whose building is captured
    call PingMinimapLocForPlayer( GetOwningPlayer( building ), building_loc, 5) // same as line above just as ping on mini map
    call TriggerSleepAction(11)
    if ( UnitHasBuffBJ(building,'B001') == true)  then // check if building has the capture buff , which wont show up if the spell was canceled earlier
    call SetUnitOwner( building, GetOwningPlayer( engineer ), true ) // owner Change
    call RemoveUnit( engineer) // engineer is lost in the process; like in Command and Conquer

function InitTrig_Capture_Building_Human_Kopieren takes nothing returns nothing
    local trigger gg_trg_Capture_Building_Human_Kopieren = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Capture_Building_Human_Kopieren, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Capture_Building_Human_Kopieren, Condition( function Spell_Check ) )
    call TriggerAddAction( gg_trg_Capture_Building_Human_Kopieren, function Trig_Capture_Building_Human_Actions )
    set gg_trg_Capture_Building_Human_Kopieren = null

What happens Ingame:
The Spell is correctly canceled if the unit takes damage.
Ping and message also work correctly-
But the building isn't captured after 10 seconds.
When i change the condition from UnitHasBuffBJ to anything else that returns true it works though.
So the Fault is with the Buff-Check.
The Spell itself is based on banish and there is a buff("Zauberverstärker" in my localized version of warcraft) on the building matching 'B001'.

Does anyone see the error in the trigger?
Syntax seems to be right since im getting no error in SyntaxCheck.

PS:I think that I'm leaking the Loc of the Building ,but thats to optimize after the spell works.

Thanks in advance for your time and Help



Level 1
Dec 12, 2010
well if i untick "is a building" then how can i use the spell if it only targets buildings?
I did modify the game constants so that status show on Buildings too.
Tested with a paladin devotion aura which was set to affect buildings too.

Edit: Ok, now it works. The Times are a bit off but a bit tweaking will do the job.
Its funny that a building is a building even if "is a building" is set to false.

Ty blacksheepwall for your help.
Last edited:
Not open for further replies.