AzuhaSky
T.E.T.Я.I.S
- 30/5/10
- 550
- 51
Một system sky vừa viết ra!Nói chung nó rất đơn giản để làm nhưng rất hữu dụng với những bạn rành về trigger spell!
Đây:
Rất đơn giản để sử dụng!Chỉ cần dùng lệnh:
TargetCast(người dùng,mục tiêu,chỉ số code kỹ năng,lệnh sử dụng,cấp độ)
Chúc các bạn có thể dùng tốt với trigger của mình!:)
Đây:
Mã:
library TargetCast
//***********************************************************
//* Target cast Library
//* Written by Azuha Sky
//* Requires A Dummy
//* A simple system but useful!
//***********************************************************
//* Dummy Cast Ability Event
//* Some time,you like create a dummy and order it cast ability
//* to a unit!But that is bad because some leak can't remove
//* and it's very long!
//* And here!You can use this library to cast spell to a target
//* it's short and useful!
//***********************************************************
//* Use this code to cast ability to a target
//* call TargetCast(unit source,unit target,integer ability,string order,integer level of ability)
//* or
//* call TargetCastEx(unit source,unit target,integer ability,string order,real damage,attack attack type,damagetype damage type,integer level)
//* and Area
//* call TargetCastLoc(unit source,real x,real y,integer ability,string order,integer level of ability)
//* call TargetCastLocEx(unit source,real x,real y,integer ability,string order,real damage,attacktype Att,damagetype damage type,integer level of ability,real area effect)
//* Any effect create with percent (Might be you want create a buff for target with percent cast)
//* function AdvancedCast takes unit source,unit target,integer spell,string order,integer level,integer percent
//*
//* Thank you for using!
//***********************************************************
globals
private constant integer DUMMY_UNITED = 'o000' //You can edit that DUMMY UNITED to cast to target
// because some you dummy not is this ID!
private constant integer imID = 'Amim' //Requires target unit not Resistant any spell!
private unit u
endglobals
// *******************
// ***Using Trigger***
// *******************
function AdvancedCast takes unit source,unit target,integer spell,string order,integer level,integer percent returns nothing
local unit dummy = CreateUnitAtLoc(GetOwningPlayer(source),DUMMY_UNITED,GetUnitLoc(target),0.0)
call UnitAddAbility(dummy,spell)
call UnitAddAbility(dummy,'Aloc')
call SetUnitAbilityLevel(dummy,spell,level)
call SetUnitUserData(dummy,0)
call SetUnitFlyHeight(dummy,0,0)
call UnitApplyTimedLife(dummy, 'BTLF', 0.50)
call PauseUnit(dummy,false)
if percent>GetRandomInt(1,100) then
if GetUnitAbilityLevel(target,imID)>0 then
debug call BJDebugMsg("Can't cast ability to this target!May be this target resist this spell!Unit: "+GetUnitName(target))
else
call IssueTargetOrder(dummy,order,target)
endif
endif
set dummy = null
set source = null
set target = null
endfunction
function TargetCast takes unit source, unit target, integer spell, string order, integer level returns nothing
local unit dummy = CreateUnitAtLoc(GetOwningPlayer(source),DUMMY_UNITED,GetUnitLoc(target),0.0)
call UnitApplyTimedLife(dummy, 'BTLF', 0.40)
call UnitAddAbility(dummy,spell)
call UnitAddAbility(dummy,'Aloc')
call SetUnitAbilityLevel(dummy,spell,level)
call SetUnitUserData(dummy,0)
call SetUnitFlyHeight(dummy,0,0)
call IssueTargetOrder(dummy,order,target)
call PauseUnit(dummy,false)
if (GetUnitAbilityLevel(target,imID) > 0) then
debug call BJDebugMsg("Can't cast ability to this target!May be this target resist this spell!Unit: "+GetUnitName(target))
endif
set dummy = null
set source = null
set target = null
set u = null
endfunction
function TargetCastEx takes unit source, unit target, integer spell, string order, real damage, attacktype Atype, damagetype Dtype, integer level returns nothing
local unit dummy = CreateUnitAtLoc(GetOwningPlayer(source),DUMMY_UNITED,GetUnitLoc(target),0.0)
call UnitApplyTimedLife(dummy, 'BTLF', 0.40)
call UnitAddAbility(dummy,spell)
call UnitAddAbility(dummy,'Aloc')
call SetUnitAbilityLevel(dummy,spell,level)
call SetUnitUserData(dummy,0)
call SetUnitFlyHeight(dummy,0,0)
call IssueTargetOrder(dummy,order,target)
call PauseUnit(dummy,false)
//Call damage target
if (GetUnitAbilityLevel(target,imID) > 0) then
debug call BJDebugMsg("Can't cast ability to this target!May be this target resist this spell!Unit: "+GetUnitName(target))
else
call UnitDamageTarget(source,target,damage,false,false,Atype,Dtype,null)
endif
if damage ==0 then
debug call BJDebugMsg("Can't cause damage to target!Please fix error at your trigger!May be real damage taken equal to 0!")
endif
set dummy = null
set source = null
set target = null
set u = null
endfunction
// *********************
// **Location Trigger **
// *********************
private function Check takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(u)) and GetWidgetLife(GetFilterUnit())>0.405 and GetUnitAbilityLevel(GetFilterUnit(),'Avul')==0
endfunction
function TargetCastLoc takes unit source, real x, real y, integer spell, string order, integer level returns nothing
local unit dummy = CreateUnit(GetOwningPlayer(source),DUMMY_UNITED,x,y,0.0)
call UnitApplyTimedLife(dummy, 'BTLF', 0.45)
call UnitAddAbility(dummy,spell)
call UnitAddAbility(dummy,'Aloc')
call SetUnitAbilityLevel(dummy,spell,level)
call SetUnitUserData(dummy,0)
call SetUnitFlyHeight(dummy,0,0)
call IssuePointOrder(dummy,order,x,y)
call PauseUnit(dummy,false)
set dummy = null
set source = null
set u = null
endfunction
function TargetCastLocEx takes unit source, real x, real y, integer spell, string order, real damage, attacktype Atype, damagetype Dtype, integer level, real range returns nothing
local group g = CreateGroup()
local unit enum
local unit dummy = CreateUnit(GetOwningPlayer(source),DUMMY_UNITED,x,y,0.0)
call UnitApplyTimedLife(dummy, 'BTLF', 0.45)
call UnitAddAbility(dummy,spell)
call UnitAddAbility(dummy,'Aloc')
call SetUnitAbilityLevel(dummy,spell,level)
call SetUnitUserData(dummy,0)
call SetUnitFlyHeight(dummy,0,0)
call IssuePointOrder(dummy,order,x,y)
call PauseUnit(dummy,false)
set u=source
if damage ==0 then
debug call BJDebugMsg("Can't cause damage to target!Please fix error at your trigger!May be real damage taken equal to 0!")
endif
call GroupEnumUnitsInRange(g,x,y,range,Condition(function Check))
loop
set enum = FirstOfGroup(g)
exitwhen (enum==null)
call GroupRemoveUnit(g,enum)
call UnitDamageTarget(source,enum,damage,false,false,Atype,Dtype,null)
endloop
set dummy = null
set source = null
set enum = null
set u = null
call GroupClear(g)
call DestroyGroup(g)
endfunction
endlibrary
TargetCast(người dùng,mục tiêu,chỉ số code kỹ năng,lệnh sử dụng,cấp độ)
Chúc các bạn có thể dùng tốt với trigger của mình!:)

