Добавлен Таренас,
опубликован
Алгоритмы, Наработки и Способности
Способ реализации:
vJass
Тип:
Способность
Версия Warcraft:
1.26a
Эти 3 способности изначально были созданы для обучения в хештаблицы. Чтобы не пропадали зря решил залить на сайт.
Примечание: все способности можно использовать свободно и они не сломаются
Лаги: нет
Лаги: нет
Способности
код
scope Owner initializer Init
globals
private hashtable hash = InitHashtable()
private unit cast
private unit target
private integer typetarget
private integer unithash = StringHash("UNIT")
private integer targhash = StringHash("UNITTARG")
private integer realhash = StringHash("n_real")
private location loc
private constant string EFFECT_PATH = "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl"
private constant integer SPELL_ID = 'A001'
private constant integer BUFF_ID = 'Brai'
private constant real TIME = 15.
endglobals
private function time takes nothing returns nothing
local timer n_timer = GetExpiredTimer()
local unit u = LoadUnitHandle(hash, GetHandleId(n_timer), unithash)
local real timeleft = LoadReal(hash, GetHandleId(n_timer), realhash)
local effect eff
set target = LoadUnitHandle(hash, GetHandleId(n_timer), targhash)
set timeleft = timeleft - 0.01
set loc = GetUnitLoc(target)
call SaveReal(hash,GetHandleId(n_timer), realhash, timeleft)
if timeleft <= 0. or IsUnitAliveBJ(target) != true then
call SetUnitPositionLoc(u, loc )
call PauseUnit(u, false)
call ShowUnit(u, true)
set eff = AddSpecialEffectTarget( EFFECT_PATH, u, "origin" )
call DestroyEffect(eff)
call FlushChildHashtable( hash, GetHandleId(n_timer) )
call PauseTimer(n_timer)
call DestroyTimer(n_timer)
endif
set n_timer = null
set target = null
set u = null
call RemoveLocation(loc)
call DestroyEffect(eff)
endfunction
private function Action takes nothing returns nothing
local timer n_timer
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local real timeleft = TIME
set target = GetSpellTargetUnit()
if GetSpellAbilityId() == SPELL_ID then
set n_timer = CreateTimer()
call SaveUnitHandle(hash,GetHandleId(n_timer), unithash, u)
call SaveReal(hash,GetHandleId(n_timer), realhash, timeleft)
call TimerStart(n_timer, 0.01, true, function time)
call SetUnitOwner( target, p, false)
call PauseUnit(u, true)
call ShowUnit(u, false)
call UnitApplyTimedLife( target, BUFF_ID , 15.)
call SaveUnitHandle(hash,GetHandleId(n_timer), targhash, target)
endif
set u = null
set p = null
set target = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set gg_trg_Owner = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Owner, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Owner, function Action )
endfunction
endscope
установка
- скопировать триггер Owner в свою карту
- скопировать способность Подчинение в свою карту
- вставить нужный айди способности в: private constant integer SPELL_ID = 'A001'
настройка
изменить эффект:
поменять строку в
private constant string EFFECT_PATH = "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl"
изменить время:
поменять реальную в
private constant real TIME = 15.
поменять строку в
private constant string EFFECT_PATH = "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl"
изменить время:
поменять реальную в
private constant real TIME = 15.
код
scope Scare initializer Init
globals
private hashtable hash = InitHashtable()
private unit cast
private unit target
private real unitx
private real unity
private player PLAYER
private constant real RADIUS = 400.
private constant integer SPELL_ID = 'A000'
private constant real TIME = 10.
endglobals
private function start takes nothing returns nothing
local unit u = GetEnumUnit()
local location loc1 = GetUnitLoc(u)
local rect rec = RectFromCenterSizeBJ(loc1, 200.00, 200.00)
local location loc2 = GetRandomLocInRect(rec)
if IsUnitEnemy(u, PLAYER ) == true then
call IssuePointOrderLoc( u, "move", loc2 )
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call RemoveRect(rec)
set u = null
endfunction
private function loop takes nothing returns nothing
local timer n_timer = GetExpiredTimer()
local group grou = LoadGroupHandle(hash, GetHandleId(n_timer), StringHash("n_units"))
local real time = LoadReal(hash, GetHandleId(n_timer), StringHash("n_real"))
set PLAYER = LoadPlayerHandle(hash, GetHandleId(n_timer), StringHash("PLAYER"))
call ForGroup(grou, function start)
set PLAYER= null
set time = time - 1.
call SaveReal(hash,GetHandleId(n_timer), StringHash("n_real"), time)
if time <= 0. then
call FlushChildHashtable( hash, GetHandleId(n_timer) )
call PauseTimer(n_timer)
call DestroyTimer(n_timer)
endif
set n_timer = null
set grou = null
endfunction
private function Action takes nothing returns nothing
local timer n_timer
local group grou
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local real time = TIME
set unitx = GetUnitX(u)
set unity = GetUnitY(u)
set PLAYER = p
if GetSpellAbilityId() == SPELL_ID then
set n_timer = CreateTimer()
set grou = CreateGroup()
call GroupEnumUnitsInRange(grou, unitx, unity, RADIUS, null )
call ForGroup(grou, function start)
call SaveGroupHandle(hash,GetHandleId(n_timer), StringHash("n_units"), grou)
call SavePlayerHandle(hash,GetHandleId(n_timer), StringHash("PLAYER"), p)
call SaveReal(hash,GetHandleId(n_timer), StringHash("n_real"), time)
call TimerStart(n_timer, 1., true, function loop)
endif
set u = null
set p = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set gg_trg_Scare = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Scare, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Scare, function Action )
endfunction
endscope
установка
- скопировать триггер Scare в свою карту
- скопировать способность Испуг в свою карту
- вставить нужный айди способности в: private constant integer SPELL_ID = 'A000'
настройка
изменить время:
поменять реальную в
private constant real TIME = 10.
поменять реальную в
private constant real TIME = 10.
код
scope zamena initializer Init
globals
private hashtable hash = InitHashtable()
private unit cast
private unit target
private real unitx
private real unity
private real unitax
private real unitay
private constant real BBlCOTA = 100.
private constant string EFFECT_PATH = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
private constant integer SPELL_ID = 'A004'
private constant real TIME = 8.
endglobals
private function SetTime takes nothing returns nothing
local timer timerz = GetExpiredTimer()
local unit lcast = LoadUnitHandle(hash, GetHandleId(timerz), StringHash("Zamena"))
local unit ltarget = LoadUnitHandle(hash, GetHandleId(timerz) , StringHash("Zamena1"))
local real timez = LoadReal(hash, GetHandleId(timerz), StringHash("Zamena3") )
local lightning llig
local effect eff
set llig = LoadLightningHandle(hash, GetHandleId(timerz), StringHash("Zamena4") )
set timez = timez - 0.05
set unitx = GetUnitX(lcast)
set unity = GetUnitY(lcast)
set unitax = GetUnitX(ltarget)
set unitay = GetUnitY(ltarget)
call MoveLightningEx(llig, true, unitx, unity, BBlCOTA, unitax, unitay, BBlCOTA)
if timez <= 0 then
call SetUnitX(lcast, unitax )
call SetUnitY(lcast, unitay )
call SetUnitX(ltarget, unitx )
call SetUnitY(ltarget, unity )
set eff = AddSpecialEffectTarget( EFFECT_PATH, lcast, "origin" )
call DestroyEffect(eff)
set eff = AddSpecialEffectTarget( EFFECT_PATH, ltarget, "origin" )
call DestroyEffect(eff)
call DestroyLightning(llig)
set lcast = null
set timez = 0
call DestroyTimer(timerz)
call FlushChildHashtable( hash, GetHandleId(timerz) )
else
call SaveReal( hash, GetHandleId(timerz), StringHash("Zamena3"), timez )
endif
call DestroyEffect(eff)
endfunction
private function Action takes nothing returns nothing
local timer timerz
local lightning lig
local real timez
if GetSpellAbilityId() == SPELL_ID then
set timerz = CreateTimer()
set target = GetSpellTargetUnit()
set cast = GetTriggerUnit()
set timez = TIME
set unitx = GetUnitX(cast)
set unity = GetUnitY(cast)
set unitax = GetUnitX(target)
set unitay = GetUnitY(target)
set lig = AddLightningEx("DRAL", true, unitx, unity, BBlCOTA, unitax, unitay, BBlCOTA)
call TimerStart( timerz, 0.05, true, function SetTime )
call SaveUnitHandle( hash, GetHandleId(timerz), StringHash("Zamena"), cast )
call SaveUnitHandle( hash, GetHandleId(timerz), StringHash("Zamena1"), target )
call SaveReal( hash, GetHandleId(timerz), StringHash("Zamena3"), timez)
call SaveLightningHandle( hash, GetHandleId(timerz), StringHash("Zamena4"), lig )
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set gg_trg_Zamena = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Zamena, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Zamena, function Action )
endfunction
endscope
установка
- скопировать триггер Zamena в свою карту
- скопировать способность Замена в свою карту
- вставить нужный айди способности в: private constant integer SPELL_ID = 'A004'
настройка
изменить эффект:
поменять строку в
private constant string EFFECT_PATH = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
изменить время:
поменять реальную в
private constant real TIME = 8.
поменять строку в
private constant string EFFECT_PATH = "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl"
изменить время:
поменять реальную в
private constant real TIME = 8.
`
ОЖИДАНИЕ РЕКЛАМЫ...
Чтобы оставить комментарий, пожалуйста, войдите на сайт.
По типу:
Отредактирован SAND
Отредактирован gordik