quanganh1109
Youtube Master Race
- 5/2/07
- 44
- 0
http://www.wc3c.net/showthread.php?t=101350 k phải k post a ạ mà là e reg nick k đk nên k xem đk ==
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Outdated:
This library has been rendered obsolete by AutoIndex. If you used this in your map, replace it by the following compatibility library.
Mã:library UnitIndexingUtils requires AutoIndex endlibrary
library UnitIndexingUtils initializer Init
//******************************************************************************
//* BY: Rising_Dusk
//*
//* -: BLUE FLAVOR :-
//*
//* This can be used to index units with a unique integer for use with arrays
//* and things like that. This has a limit of 8191 indexes allocated at once in
//* terms of actually being usable in arrays. It won't give you an error if you
//* exceed 8191, but that is an unrealistic limit anyways.
//*
//* The blue flavor uses a trigger that fires on death of a unit to release the
//* indexes of units. This is useful for maps where ressurection is not an issue
//* and doesn't require an O(n) search inside of a timer callback, making it
//* potentially less taxing on the game.
//*
//* To use, call GetUnitId on a unit to retrieve its unique integer id. This
//* library allocates a unique index to a unit the instant it is created, which
//* means you can call GetUnitId immediately after creating the unit with no
//* worry.
//*
//* Function Listing --
//* function GetUnitId takes unit u returns integer
//*
private struct unitindex
endstruct
//Function to get the unit's unique integer id, inlines to getting its userdata
function GetUnitId takes unit u returns integer
return GetUnitUserData(u)
endfunction
//Filter for units to index
private function UnitFilter takes nothing returns boolean
return true
endfunction
//Filter for what units to remove indexes for on death
private function Check takes nothing returns boolean
return not IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)
endfunction
private function Clear takes nothing returns nothing
local unit u = GetTriggerUnit()
call unitindex(GetUnitId(u)).destroy()
call SetUnitUserData(u,-1)
set u = null
endfunction
private function Add takes nothing returns boolean
if GetUnitUserData(GetFilterUnit()) == 0 then
//Only index units that haven't already been indexed
call SetUnitUserData(GetFilterUnit(),unitindex.create())
endif
return true
endfunction
private function GroupAdd takes nothing returns nothing
call SetUnitUserData(GetEnumUnit(),unitindex.create())
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local region r = CreateRegion()
local rect m = GetWorldBounds()
local group g = CreateGroup()
local integer i = 0
//Use a filterfunc so units are indexed immediately
call RegionAddRect(r, m)
call TriggerRegisterEnterRegion(t, r, And(Condition(function UnitFilter), Condition(function Add)))
call RemoveRect(m)
//Loop and group per player to grab all units, including those with locust
loop
exitwhen i > 15
call GroupEnumUnitsOfPlayer(g, Player(i), Condition(function UnitFilter))
call ForGroup(g, function GroupAdd)
set i = i + 1
endloop
//Set up the on-death trigger to clear custom values
set t = CreateTrigger()
call TriggerAddAction(t, function Clear)
call TriggerAddCondition(t, Condition(function Check))
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call DestroyGroup(g)
set r = null
set m = null
set t = null
set g = null
endfunction
endlibrary
library UnitIndexingUtils initializer Init
//******************************************************************************
//* BY: Rising_Dusk
//*
//* -: RED FLAVOR :-
//*
//* This can be used to index units with a unique integer for use with arrays
//* and things like that. This has a limit of 8191 indexes allocated at once in
//* terms of actually being usable in arrays. It won't give you an error if you
//* exceed 8191, but that is an unrealistic limit anyways.
//*
//* The red flavor uses a periodic timer to automatically recycle a unit's index
//* when UnitUserData goes to 0 for that unit (when it is removed from the game).
//* This can be slower than the blue flavor if you have many units on the map at
//* a time because it uses an O(n) search, but it automatically recycles indexes
//* for units that get removed from the game by decaying or RemoveUnit. It will
//* run the timer for COUNT_PER_ITERATION units before ending. The timer will
//* pick up where it left off on the next run-through.
//*
//* To use, call GetUnitId on a unit to retrieve its unique integer id. This
//* library allocates a unique index to a unit the instant it is created, which
//* means you can call GetUnitId immediately after creating the unit with no
//* worry.
//*
//* Function Listing --
//* function GetUnitId takes unit u returns integer
//*
globals
private constant real TIMER_PERIODICITY = 5.
private constant integer COUNT_PER_ITERATION = 64
private integer POSITION = 0
private integer array STACK
private unit array UNIT_STACK
private integer STACK_SIZE = 0
private integer ASSIGNED = 1
private integer MAX_INDEX = 0
endglobals
//Function to get the unit's unique integer id, inlines to getting its userdata
function GetUnitId takes unit u returns integer
return GetUnitUserData(u)
endfunction
//Filter for units to index
private function UnitFilter takes nothing returns boolean
return true
endfunction
private function Clear takes nothing returns nothing
local integer i = POSITION
loop
exitwhen (POSITION > MAX_INDEX or POSITION > i+COUNT_PER_ITERATION)
if UNIT_STACK[POSITION] != null and GetUnitUserData(UNIT_STACK[POSITION]) == 0 then
set STACK[STACK_SIZE] = POSITION
set STACK_SIZE = STACK_SIZE + 1
set UNIT_STACK[POSITION] = null
endif
set POSITION = POSITION + 1
endloop
if POSITION > MAX_INDEX then
set POSITION = 0
endif
endfunction
private function Add takes nothing returns boolean
local integer id = 0
if GetUnitUserData(GetFilterUnit()) != 0 then
//Only index units that haven't already been indexed
return true
endif
if STACK_SIZE > 0 then
set STACK_SIZE = STACK_SIZE - 1
set id = STACK[STACK_SIZE]
else
set id = ASSIGNED
set ASSIGNED = ASSIGNED + 1
if ASSIGNED > MAX_INDEX then
set MAX_INDEX = ASSIGNED
endif
endif
call SetUnitUserData(GetFilterUnit(), id)
set UNIT_STACK[id] = GetFilterUnit()
return true
endfunction
private function GroupAdd takes nothing returns nothing
local integer id = 0
if STACK_SIZE > 0 then
set STACK_SIZE = STACK_SIZE - 1
set id = STACK[STACK_SIZE]
else
set id = ASSIGNED
set ASSIGNED = ASSIGNED + 1
if ASSIGNED > MAX_INDEX then
set MAX_INDEX = ASSIGNED
endif
endif
call SetUnitUserData(GetEnumUnit(), id)
set UNIT_STACK[id] = GetEnumUnit()
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local region r = CreateRegion()
local rect m = GetWorldBounds()
local group g = CreateGroup()
local integer i = 0
//Use a filterfunc so units are indexed immediately
call RegionAddRect(r, m)
call TriggerRegisterEnterRegion(t, r, And(Condition(function UnitFilter), Condition(function Add)))
call RemoveRect(m)
//Start the timer to recycle indexes
call TimerStart(CreateTimer(), TIMER_PERIODICITY, true, function Clear)
//Loop and group per player to grab all units, including those with locust
loop
exitwhen i > 15
call GroupEnumUnitsOfPlayer(g, Player(i), Condition(function UnitFilter))
call ForGroup(g, function GroupAdd)
set i = i + 1
endloop
call DestroyGroup(g)
set r = null
set m = null
set t = null
set g = null
endfunction
endlibrary
Pro cho mình hỏi cách làm trigger ép ngọc vào items, có tỉ lệ thành công hoặc thất bại và tạo items để người chơi nhặt được khi đánh boss giống như map (f-day hero of heroes-chủ thớt kukulkan).Mình tìm mãi trong forum mà ko thấy ở đâu cả
). sau đó then action thì dùng lệnh item remove item manu gì gì ấy, create item nào đó cho hero và nếu cần thì dislay ra màn hình. còn không thì chỉ remove item thôi. (Sr ko ở nhà nên ko chỉ chi tiết dc
) Từ bài viết của taolahien00
Cho e hỏi cái skill Wrath of Zeus của Prince.Zero bên hiveworkshop ý e copy về nhưng mà khi save map nó lại hiện lên cái lỗi
Mấy bạn xem dùm mình đoạn Code JASS này với..
[spoil]
[/spoil]PHP:scope ShockWave initializer ShockWave globals private integer IdSpell = 'A010' private integer IdSpellDum = 'A03F' private integer IdDummy = 'h01B' endglobals private function Conditions takes nothing returns boolean return GetSpellAbilityId() == IdSpell endfunction private function Actions takes nothing returns nothing local unit caster = GetSpellAbilityUnit() local unit u local real x = GetUnitX(caster) local real y = GetUnitY(caster) local real tx = GetSpellTargetX() local real ty = GetSpellTargetY() local real angle = bj_RADTODEG*Atan2(ty-y,tx-x) local real dx local real dy local real cx local real cy local integer lv = GetUnitAbilityLevel(caster,IdSpell) local integer lvl = GetUnitLevel(caster) local integer A = -lv loop exitwhen A>lv if A!=0 then set dx = x+256*A*Cos((angle+90*A)*bj_DEGTORAD) set dy = y+256*A*Sin((angle+90*A)*bj_DEGTORAD) set cx = dx+128*Cos(angle*bj_DEGTORAD) set cy = dy+128*Sin(angle*bj_DEGTORAD) set u = CreateUnit(GetOwningPlayer(caster),IdDummy,dx,dy,angle) call SetUnitPathing(u,false) call SetUnitVertexColor(u,255,255,255,50) call UnitAddAbility(u,IdSpellDum) call SetUnitAbilityLevel(u,IdSpellDum,lv) call IssuePointOrder(u,"shockwave",cx,cy) call UnitApplyTimedLife(u,'BTLF',1) set u = null endif set A=A+1 endloop set caster = null set u = null endfunction //=========================================================================== private function ShockWave 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 Actions ) endfunction endscope
Mình muốn Spell này làm sao cho mấy con Dummy được call ra sẽ đứng thành 1 hàng ngang cạnh Caster .. nhưng mà không hiểu sao nó không như ý muốn mà nó cứ hiện 1 con kế bên và 1 con thì nằm sau caster không à chứa 2 con không chịu đứng kề Caster.
Ai rành JASS hướng dẫn cách khắc phục với.. mình thử nhiều lần rồi mà toàn ra thế này thế kia không .. bí quá lên đây hỏi +_+
Hình em nó[spoil]
[/spoil]![]()
Trình mình chỉ làm được thế này, không biết giúp ích gì được ko.
Link: http://www.mediafire.com/?sbd6allau95d5p5
scope ShockWave initializer ShockWave
globals
private integer IdSpell = 'A010'
private integer IdSpellDum = 'A03F'
private integer IdDummy = 'h01B'
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == IdSpell
endfunction
private function Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit u
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local real tx = GetSpellTargetX()
local real ty = GetSpellTargetY()
local real angle = bj_RADTODEG*Atan2(ty-y,tx-x)
local real dx
local real dy
local real cx
local real cy
local integer lv = GetUnitAbilityLevel(caster,IdSpell)
local integer lvl = GetUnitLevel(caster)
local integer A = -lv
loop
exitwhen A>lv
if A!=0 then
set dx = x+256*A*Cos[COLOR="#FF0000"]((angle+90)[/COLOR]*bj_DEGTORAD)
set dy = y+256*A*Sin[COLOR="#FF0000"]((angle+90)[/COLOR]*bj_DEGTORAD)
set cx = dx+128*Cos(angle*bj_DEGTORAD)
set cy = dy+128*Sin(angle*bj_DEGTORAD)
set u = CreateUnit(GetOwningPlayer(caster),IdDummy,dx,dy,angle)
call SetUnitPathing(u,false)
call SetUnitVertexColor(u,255,255,255,50)
call UnitAddAbility(u,IdSpellDum)
call SetUnitAbilityLevel(u,IdSpellDum,lv)
call IssuePointOrder(u,"shockwave",cx,cy)
call UnitApplyTimedLife(u,'BTLF',1)
set u = null
endif
set A=A+1
endloop
set caster = null
set u = null
endfunction
//===========================================================================
private function ShockWave 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 Actions )
endfunction
endscope
cho e hỏi tại sao lúc learn skill nó lại 0 tạo ra 3 cục điện vậy :(Mã:Từ bài viết của taolahien00 Cho e hỏi cái skill Wrath of Zeus của Prince.Zero bên hiveworkshop ý e copy về nhưng mà khi save map nó lại hiện lên cái lỗi
Ai có thể chỉ em làm sao cho con Unit nó mờ đi như chiêu lướt Mê Ảnh Tung trong TK ?

-ví dụ ta có n1,n2,...n list các items ta phải làm thế nào để item drop ngẫu nhiên?
-hoặc có 2 items n1,n2.
-và xin hướng dẫn cách tạo list items.
và làm theo kiểu WE nếu có jass nữa cũng đc
VD:Event:
Conditions:
Actions:
Item - Create (Random level [COLOR="#FF0000"]x[/COLOR] item-type) at (Random point in (Playable map area))

Dù sao cũng thanks pro rất nhiều nhưng cái đấy thì mình biết rồi.Ý mình muốn hỏi là bây giờ mình tạo được ra 3 items mới đó là: n1,n2,n3. mình muốn cho n1 có tỉ lệ drop là:60%, n2 có tỉ lệ drop là:70%, n3:20% như vậy thì phải tạo 1 trigger để great item sao cho cứ mỗi lần đánh 1 con boss mà phù hợp với conditions thì rơi 3 item trên với số tỉ lệ như trên.
Và cách làm trigger ép ngọc vào item ví dụ như có 1 item và có 1 viên soul(tỉ lệ thành công là 50%)(giống map f-day hero of heroes)nếu knick vào item đó thì nếu thành công sẽ tăng lên +1 nếu thất bại thì giữ nguyên hoặc mất luôn item.
Mong pro hướng dẫn bằng WE nếu WE ko làm được thì jass cũng được.

Boss
Events
Unit - A unit owned by Player 3 (Teal) Dies
Conditions
((Dying unit) is A Hero) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 2) Equal to 2
Then - Actions
Item - Create n1 at (Position of (Dying unit))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 5) Equal to 2
Then - Actions
Item - Create n2 at (Position of (Dying unit))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 3) Equal to 3
Then - Actions
Item - Create n3 at (Position of (Dying unit))
Else - Actions
Boss 2
Events
Time - Elapsed game time is 5.00 seconds
Conditions
Actions
Unit - Create 1 Blademaster for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
Set Boss = (Last created unit)
Item
Events
Unit - A unit owned by Player 4 (Purple) Dies
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Dying unit) Equal to Boss
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 2) Equal to 2
Then - Actions
Item - Create n1 at (Position of Boss)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 5) Equal to 2
Then - Actions
Item - Create n2 at (Position of Boss)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 3) Equal to 3
Then - Actions
Item - Create n3 at (Position of Boss)
Else - Actions
Else - Actions

Boss
Events
Unit - A unit owned by Player 3 (Teal) Dies
Conditions
((Dying unit) is A Hero) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 2) Equal to 2
Then - Actions
Item - Create n1 at (Position of (Dying unit))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 5) Equal to 2
Then - Actions
Item - Create n2 at (Position of (Dying unit))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 3) Equal to 3
Then - Actions
Item - Create n3 at (Position of (Dying unit))
Else - Actions
Boss 2
Events
Time - Elapsed game time is 5.00 seconds
Conditions
Actions
Unit - Create 1 Blademaster for Player 4 (Purple) at (Random point in (Playable map area)) facing Default building facing degrees
Set Boss = (Last created unit)
Item
Events
Unit - A unit owned by Player 4 (Purple) Dies
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Dying unit) Equal to Boss
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 2) Equal to 2
Then - Actions
Item - Create n1 at (Position of Boss)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 5) Equal to 2
Then - Actions
Item - Create n2 at (Position of Boss)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 3) Equal to 3
Then - Actions
Item - Create n3 at (Position of Boss)
Else - Actions
Else - Actions
Bác Evil Hunter biết làm dạng slide move dummy theo vòng tròn của vòng Loop ko, nếu đc làm dùm em cái Demo tham khảo @@



)
sài rồi 
Cái này em biết rồi, ý em cần là mấy con Dummy nó xoay vòng tròn quanh caster ấy, ko fải dạng nàysài rồi
P.S: Map demo mà cho tên mình vô luôn mới gê @@
Đâu, bạn cho mình xin cái Demo coi thửMình có làm 1 cái skill MUI dạng như Whirling Axes của troll đó. Có phải đó là kiểu cậu nói ko?