- 29/8/09
- 2,654
- 5,688
Progress Casting Bar
PHP:
library ProgressCastingBar /* by Dhguardianes v1.01 and thank raivor! (System)
*/ requires R32 /* v1.10 http://goo.gl/ag8a7
*/ optional AutoFly/* http://goo.gl/YNcbR
model http://goo.gl/beovT
*************************************************************************************
* ____ ____ _ _ ____
*| _ \ _ __ ___ __ _ _ __ ___ ___ ___ / ___|__ _ ___| |_(_)_ __ __ _| __ ) __ _ _ __
*| |_) | '__/ _ \ / _` | '__/ _ \/ __/ __| | / _` / __| __| | '_ \ / _` | _ \ / _` | '__|
*| __/| | | (_) | (_| | | | __/\__ \__ \ |__| (_| \__ \ |_| | | | | (_| | |_) | (_| | |
*|_| |_| \___/ \__, |_| \___||___/___/\____\__,_|___/\__|_|_| |_|\__, |____/ \__,_|_|
* |___/ |___/
*************************************************************************************
* ProgressCastingBar la system su dung model ProgressCastingBar co animation la 1 giay!
* muc dich system nay su dung hien thi. casting bar tu` model!
* va` co the thay doi mau sac de dang` bang cach config tai. ColorType
*
*
* system nay yeu cau su dung RepeatData cua Daric Nguyen va co the tuong lai se ra phien ban xai TimerUltis!
* va duoc tuy chon AutoFly ban co the hok can su dung autofly system nay van se hoat dong binh thuong`
*
* function Castingbar takes unit caster, string order, real timed, integer color,real height, string ex, string attach returns
nothing
* caster la vi tri casting bar va` cung la OwningPlayer
* timed la thoi gian cua casting channel spell
* color la mau` sac' minh set trong day! o day mau do? la so 1
*
* order la order id cua spell cai nay su dung de check spell co' bi disable boi (stun,move,die v.v.) hok!
* order id hok dung' voi' order id cua spell thi` casting bar se bi destroy ngay,
* vi du su dung Channel spell order id la "channel"
*
* height la chieu cao cua casting bar su dung tang Z khi gap hero Z qua' cao
* ex la tao effect tai vi tri' Attach no se bi destroy sau khi ket castingbar!
*
* Credit:
* cam on toi raivor da cung cap model ProgressCastingBar.
*
***************************************************************************************/
globals
// external ObjectMerger w3u hpea pbar unam "Progress Casting Bar ver2" utyp "" usid 0 usin 0 ufoo 0 ucol 0 umvt
"fly" umvs 100 umvh 500 umvf 0 ushu "" umdl "war3mapImported\ProgressCastingBar.mdx" umxp 0. umxr 0. uico
"ReplaceableTextures\CommandButtons\BTNRune.blp" uabi "Aloc,Avul" uaen 0
private constant integer RAW_ID_DUMMY_BAR = 0x70626172
private integer red
private integer green
private integer blue
endglobals
private struct repeat extends RepeatData
unit caster
unit dummy
effect ex
string order
method onLoop takes nothing returns nothing
if (GetUnitCurrentOrder(this.caster)!= OrderId(this.order)) then
call this.stop()
endif
endmethod
method onEnd takes nothing returns nothing
call DestroyEffect(this.ex)
call SetUnitTimeScale(this.dummy, 1.00)
call UnitApplyTimedLife(this.dummy,0x42544c46, 0.01)
set this.ex = null
set this.caster = null
set this.dummy = null
endmethod
endstruct
private function ColorType takes integer i returns nothing
if i == 1 then//red
set red = 255
set green = 0
set blue = 0
elseif i == 2 then//yellow
set red = 255
set green = 255
set blue = 0
elseif i == 3 then//green
set red = 0
set green = 255
set blue = 0
elseif i == 4 then//blue
set red = 0
set green = 200
set blue = 255
elseif i == 4 then//gray
set red = 128
set green = 128
set blue = 128
elseif i == 5 then//orange
set red = 255
set green = 204
set blue = 0
elseif i == 6 then//purple
set red = 128
set green = 0
set blue = 128
else
set red = 255
set green = 255
set blue = 255
debug call BJDebugMsg(SCOPE_PREFIX + "Error: No color!")
endif
endfunction
function Castingbar takes unit caster, string order, real timed, integer color, real height, string ex, string attach returns
nothing
local repeat this = repeat.create(R32_Period, timed)
set this.caster = caster
set this.order = order
set this.ex = AddSpecialEffectTarget(ex, caster, attach)
set this.dummy = CreateUnit(GetOwningPlayer(caster), RAW_ID_DUMMY_BAR, GetUnitX(caster), GetUnitY
(caster), 270.)
call ColorType(color)
call SetUnitVertexColor(this.dummy, red, green, blue, 255)
call SetUnitTimeScale(this.dummy, 1 / timed)
static if LIBRARY_AutoFly then
call SetUnitFlyHeight(this.dummy, height, 999999)
else
call UnitAddAbility(this.dummy, 'Amrf')
call SetUnitFlyHeight(this.dummy, height, 999999)
call UnitRemoveAbility(this.dummy, 'Amrf')
endif
debug if this.caster == null then
debug call this.stop()
debug call BJDebugMsg(SCOPE_PREFIX + "Error: No Caster!")
debug endif
endfunction
endlibrary
Giới thiệu
chắc hẳn các bạn đã từng chơi qua những map Arena Style(action)
chẳng hạn như the fame(của Ice_water) có 1 ống bar chạy xong ống bar kia thì mới cast
được spell
và ống bar đó được gọi là CastingBar! Nhưng map của the fame và 1 số map Arena Style
khác là sử đụng floatingtext làm ống bar là đại đa số!
trong đó có cả map mình cũng thế! và mục đích mình làm system này là giúp "quảng bá" Repeat32 của Daric Nguyen sẵn giúp mọi người làm map ArenaStyle có thể sử dụng model
ProgressCastingBar này của raivor làm một ống casting bar dễ nhìn thích hợp hơn so với floatingtext và cũng hok bị giới hạn 100 của FloatingText nữa

Bạn nào muốn làm map Arena Style hay muốn sử dụng idea CastingBar thì dùng system mình!
Trình hàm
function Castingbar takes unit caster, string order, real timed, integer color,real height, string ex, string attach returns nothing
- caster là vị trí casting bar xuất hiện và cũng là OwningPlayer
- timed là life của castingbar! nếu spell bạn channel 5 giây thì hãy set 5.00
- color là màu sắc mình set cho casting bar ở đây màu đỏ là số 1 màu xanh la số 3 các bạn có thể set tại ColorType để config màu thích hợp
- order là order id của spell cái này sử dụng để check spell có bị disable bởi (stun,move,die, v.v..) hok! nếu order id hok đúng với order id của spell thì casting bar sẽ bị destroy ngay! ví dụ su dung Channel spell thì order id là "channel"
- height là chiều cao của castingbar sử dụng, vì đều này cho phép bạn tăng Z cho vừa cỡ của hero!
- ex là tạo effect tại vị trí Attach nó sẽ bị destroy sau khi kết castingbar!
ver 1.01
tối ưu hóa code
nâng cấp R32
sửa lỗi vấn đề độ cao của bar được giới hạn từ 0~500 Height
P/S: xóa dummy Progress Casting Bar và cài lại dummy mới tại ver này! bằng cách thêm ! vào //! external ObjectMerger ngay trong system
Chú ý
System này yêu cầu phải có R32 ver 1.10+
Auto Fly là tùy chọn!
bạn có thể import unit ngay trong system bằng cách thêm ! vào //! external ObjectMerger ngay trong system
và gửi lời cảm ơn tới raivor!
Download map demo
Link MF:
SystemProgressCastingBar.w3x
Chỉnh sửa cuối:

và up Snippet ở trong đó 
