GigaStar
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.


______________________________
 
Trang ChínhLatest imagesTìm kiếmĐăng kýĐăng Nhập

 

 Cách tạo 1 số skill passive trong dota

Go down 
Tác giảThông điệp
Admin
Admin



Tổng số bài gửi : 9
Join date : 11/04/2011

Cách tạo 1 số skill passive trong dota Empty
Bài gửiTiêu đề: Cách tạo 1 số skill passive trong dota   Cách tạo 1 số skill passive trong dota EmptyMon Apr 11, 2011 11:59 am

Link này là map test có 3 skill passive counter helix craggy extorior và polymorph auto
[You must be registered and logged in to see this link.]
Còn đây là về Omnislash(trigger variable)

Trigger


function Trig_Omnislash_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A005'
endfunction

function Unit_Group takes nothing returns boolean
return GetBooleanAnd( IsUnitAliveBJ(GetFilterUnit()) == true, IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction

function Trig_Omnislash_Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local integer i = 0
local group UnitGroup
local unit TargetRandom
local unit Target = GetSpellTargetUnit()
local effect Phoenix
local location R
local real Damage = 100
local integer Amount = 1 ( GetUnitAbilityLevelSwapped('A005', Caster) * 2 )
call TriggerSleepAction( 0.20 )
call SelectUnitRemove( Caster )
call SetUnitVertexColor( Caster, 150, 150, 150, 150 )
call SetUnitInvulnerable( Caster, true )
set Phoenix = AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl",Caster,"weapon" )
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", Caster, "chest" ))
call SetUnitPositionLocFacingBJ( Caster, PolarProjectionBJ(GetUnitLoc(Target), 50.00, GetRandomDirectionDeg()), AngleBetweenPoints(GetUnitLoc(Caster), GetUnitLoc(Target)) )
call UnitDamageTarget( Caster, Target, Damage, false, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_AXE_MEDIUM_CHOP )
call SetUnitAnimation( Caster, "attack" )
call TriggerSleepAction( 0.25 )
call SelectUnitRemove( Caster )
loop
set i = i 1
exitwhen i > Amount
set UnitGroup = GetUnitsInRangeOfLocMatching(600.00, GetUnitLoc(Caster), Condition(function Unit_Group))
if ( IsUnitGroupEmptyBJ(UnitGroup) == false ) then
set TargetRandom = GroupPickRandomUnit(UnitGroup)
set R = GetUnitLoc(TargetRandom)
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", Caster, "chest" ))
call SetUnitPositionLocFacingBJ( Caster, PolarProjectionBJ(R, 50.00, GetRandomDirectionDeg()), AngleBetweenPoints(GetUnitLoc(Caster), GetUnitLoc(TargetRandom)) )
call UnitDamageTarget( Caster, TargetRandom, Damage, false, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_AXE_MEDIUM_CHOP )
call SetUnitAnimation( Caster, "attack" )
call RemoveLocation ( R )
call TriggerSleepAction( 0.25 )
call SelectUnitRemove( Caster )
else
endif
call DestroyGroup(UnitGroup)
endloop
call SelectUnitForPlayerSingle( Caster, GetTriggerPlayer() )
call SetUnitInvulnerable( Caster, false )
call SetUnitVertexColor( Caster, 255, 255, 255, 255 )
call DestroyEffect( Phoenix )
set Phoenix = null
set Caster = null
set UnitGroup = null
set TargetRandom = null
set Target = null
set Amount = 0
set R = null
set Damage = 0
endfunction

//===========================================================================
function InitTrig_Omnislash takes nothing returns nothing
set gg_trg_Omnislash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Omnislash, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Omnislash, Condition( function Trig_Omnislash_Conditions ) )
call TriggerAddAction( gg_trg_Omnislash, function Trig_Omnislash_Actions )
endfunction


Phần 'A005' là phần đáng lưu ý khi tạo skill:vd bạn lấy skill storm bot(Mk trong custom map)hay 1 skill nào khác thì bạn phải lấy code của skill thay thế vào 'A005' =cách click vào skill storm bot rồi ấn Ctrl+D sau đó code skill sẽ hiện ra ở vị trí tên cũ của skill(vd skill storm bot sau khi bạn ấn Ctrl+D nó sẽ hiện lên A001 hoặc 1 code nào khác

Variable


[You must be registered and logged in to see this link.]
scope Omnislash

globals
private constant integer Spell_ID = 'A001' //The Raw Code of the ability "Omnislash" (might need to be changed in your map)
private constant integer Slash_Times_Base = 3 //The base amount of blinking/slashing (formula = Slash_Times_Base * lvl)
private constant real Damage_Base = 150 //The base damage for the spell (formula = Damage_Base + (lvl * 25)) [note that damage is dealt as a random value between Damage_Base and Damage_Base + (lvl * 25)]
private constant real Slash_Interval = 0.3 //The delay between each slash/attack/blink
private constant real Blink_Offset = 105 //The base offset range in which the caster is moved to when blinking to targets
private constant real AoE = 475 //The area-of-effect of the spell
private constant string Animation = "attack" //The animation that is played during each blink/slash
private constant string Caster_SFX_Attach_Point = "weapon" //The attachment point for the special effect "Caster_SFX"
private constant string Caster_SFX = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl" //The Special Effect that is created on the caster's "Caster_SFX_Attach_Point"
private constant string Caster_SFX2 = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" //The Special Effect that is created on the caster's chest during each blink/slash
endglobals

private struct dat
unit u
integer i
effect e
real dmgmax
endstruct

private function Omnislash_Filter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(bj_ghoul[5])) and GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true and IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING) != true and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) != true and IsUnitHidden(GetFilterUnit()) != true
endfunction

private function Slash takes nothing returns nothing
local timer t = GetExpiredTimer()
local dat d = dat(GetHandleInt(t, "d"))
local boolexpr b = Condition(function Omnislash_Filter)
local group g = CreateGroup()
local real ang = GetRandomReal(1, 360) * bj_DEGTORAD
local real ofst = GetRandomReal(0, 85)
local unit p

set bj_ghoul[5] = d.u
call GroupEnumUnitsInRange(g, GetUnitX(d.u), GetUnitY(d.u), AoE, b)

if CountUnitsInGroup(g) > 0 and d.i > 0 then
set d.i = d.i - 1
set p = GroupPickRandomUnit(g)
call SelectUnit(d.u, false)
call SetUnitPosition(d.u, GetUnitX(p) + (Blink_Offset + ofst) * Cos(ang), GetUnitY(p) + (Blink_Offset + ofst) * Sin(ang))
call DestroyEffect(AddSpecialEffectTarget(Caster_SFX2, d.u, "chest"))
call UnitDamageTarget(d.u, p, GetRandomReal(Damage_Base, d.dmgmax), false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)
call SetUnitAnimation(d.u, Animation)
set p = null
else
call DestroyEffect(d.e)
call SetUnitInvulnerable(d.u, false)
call SetUnitVertexColor(d.u, 255, 255, 255, 255)
if GetLocalPlayer() == GetOwningPlayer(d.u) then
call SelectUnit(d.u, true)
endif
call d.destroy()
call FlushHandleLocals(t)
call PauseTimer(t)
call DestroyTimer(t)
endif

call DestroyBoolExpr(b)
call DestroyGroup(g)

set t = null
set b = null
set g = null
endfunction

private function Cast takes nothing returns nothing
local dat d = dat.create()
local timer t = CreateTimer()
local unit T = GetSpellTargetUnit()
local real ang = GetRandomReal(1, 360) * bj_DEGTORAD
local real ofst = GetRandomReal(0, 85)

set d.u = GetTriggerUnit()
set d.e = AddSpecialEffectTarget(Caster_SFX, d.u, Caster_SFX_Attach_Point)
set d.i = GetUnitAbilityLevel(d.u, Spell_ID) * Slash_Times_Base - 1
set d.dmgmax = GetUnitAbilityLevel(d.u, Spell_ID) * 25 + Damage_Base

call SetUnitInvulnerable(d.u, true)
call SetUnitVertexColor(d.u, 255, 255, 255, 100)
call SelectUnit(d.u, false)
call SetUnitPosition(d.u, GetUnitX(T) + (Blink_Offset + ofst) * Cos(ang), GetUnitY(T) + (Blink_Offset + ofst) * Sin(ang))
call DestroyEffect(AddSpecialEffectTarget(Caster_SFX2, d.u, "chest"))
call UnitDamageTarget(d.u, T, GetRandomReal(Damage_Base, d.dmgmax), false, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, null)

call SetHandleInt(t, "d", d)
call TimerStart(t, Slash_Interval, true, function Slash)

set t = null
set T = null
endfunction

private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == Spell_ID
endfunction

function InitTrig_Omnislash takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition( function Conditions ) )
call TriggerAddAction(t, function Cast )
set t = null
endfunction

endscope

Good luck!!!!
Về Đầu Trang Go down
https://huongdan.forumvi.com
 
Cách tạo 1 số skill passive trong dota
Về Đầu Trang 
Trang 1 trong tổng số 1 trang
 Similar topics
-
» Cách tạo 1 số skill trong dota(part1)
» Cách tạo 1 số skill trong dota(part2)
» Cách tạo 1 số skill trong dota(part3)
» CÁC CÁCH SỬA MOVINAND CHO NHỮNG AI LÀ NẠN NHÂN CỦA H1DROID

Permissions in this forum:Bạn không có quyền trả lời bài viết
GigaStar :: Huong dan :: Huong dan ve game :: Game offline-
Chuyển đến