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:
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
- 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:
JASS:
// Condition Check
function Spell_Check takes nothing returns boolean
if ( GetSpellAbilityId() == 'A001' ) then // the capture/conquer spell id
return true
endif
return false
endfunction
// Cancel on Damage
function C_C_Action takes nothing returns nothing
local unit engineer = GetTriggerUnit()
call IssueImmediateOrder(engineer, "stop")
endfunction
//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
endif
endfunction
//===========================================================================
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
endfunction
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