Re: Topic hỏi đáp về cách tạo Warcraft III
em sữa dc r nhưng mà mấy anh giúp em làm 3 team là kẻ thù đi, nó cứ là bạn thì sao mà chơi?
rebellion wrote:em sữa dc r nhưng mà mấy anh giúp em làm 3 team là kẻ thù đi, nó cứ là bạn thì sao mà chơi?
rebellion wrote:cái dó thì làm r nhưng start map thì ceep bên ra đều là đồng minh thì sao ma chơi zz
rebellion wrote:ý em nói là 2 phe đánh nhau , lính do player 5 dk
và player 10 Dk
2 bên đánh nhau, em hỏi làm sao cho 12345 là 1 team và 678910 là 1 team nữa
rebellion wrote:k dc ah ơi , tạo 3 force thì force 1 va` 2 là đồng minh cùng đánh force 3 nhưng em muốn nó đánh nhau zz , mấy cái ô trong cái add force em đều k tích
rebellion wrote:k dc ah ơi , tạo 3 force thì force 1 va` 2 là đồng minh cùng đánh force 3 nhưng em muốn nó đánh nhau zz , mấy cái ô trong cái add force em đều k tích
Clap Kizaru
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Light Dome
Actions
Set Unitt_Skill[2] = (Casting unit)
Set Pointt_Skill[3] = (Target point of ability being cast)
Set Dmgg_Skill[2] = ((Real((Level of Light Dome for Unitt_Skill[1]))) x (Real((Agility of Unitt_Skill[1] (Include bonuses)))))
Set Groupp_Skill[2] = (Units within 800.00 of Pointt_Skill[3] matching ((((Matching unit) belongs to an enemy of Player 10 (Light Blue)) Equal to True) and (((Matching unit) is dead) Equal to False)))
For each (Integer A) from 1 to 3, do (Actions)
Loop - Actions
Unit - Pause Unitt_Skill[2]
Animation - Change Unitt_Skill[2]'s animation speed to 100.00% of its original speed
Special Effect - Create a special effect at (Position of Unitt_Skill[2]) using ManaBurst.mdx
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect attached to the weapon of Unitt_Skill[2] using Abilities\Weapons\ZigguratMissile\ZihhuratMissile.mdl
Unit - Add Crow Form to Unitt_Skill[2]
Wait 0.01 seconds
Unit - Remove Crow Form from Unitt_Skill[2]
Wait 0.01 seconds
Animation - Play Unitt_Skill[2]'s Spell animation
Wait 0.01 seconds
Animation - Play Unitt_Skill[2]'s Spell animation
Animation - Change Unitt_Skill[2] flying height to 600.00 at 900.00
Unit - Create 1 Explosion Dummy 1 for Player 10 (Light Blue) at (Position of Unitt_Skill[2]) facing 270.00 degrees
Unit - Add Light Dome to (Last created unit)
Wait 0.01 seconds
Unit - Remove (Last created unit) from the game
Animation - Change Unitt_Skill[2] flying height to 0.00 at 700.00
Animation - Play Unitt_Skill[2]'s stand animation
Wait 0.01 seconds
Animation - Play Unitt_Skill[2]'s Spell animation
Wait 0.01 seconds
Animation - Play Unitt_Skill[2]'s Spell animation
Wait 0.01 seconds
Special Effect - Destroy (Last created special effect)
Unit Group - Pick every unit in Groupp_Skill[2] and do (Actions)
Loop - Actions
Unit - Cause Unitt_Skill[1] to damage (Picked unit), dealing Dmgg_Skill[1] damage of attack type Chaos and damage type Lightning
Unit - Create 1 Dummy 1 for (Owner of Unitt_Skill[2]) at (Position of Unitt_Skill[2]) facing Default building facing degrees
Wait 0.10 seconds
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Add Light Dome to (Last created unit)
Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
Special Effect - Create a special effect at (Position of Unitt_Skill[2]) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Unit - Unpause Unitt_Skill[2]
Unit - Remove (Last created unit) from the game
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Pointt_Skill[2])
Custom script: call DestroyGroup(udg_Groupp_Skill[2])
globals
private group enumGroup = CreateGroup()
private Event onStaminaChange
endglobals
private keyword Stamina
private keyword add
private keyword remove
private keyword added
struct StaminaUnits extends array
readonly boolean added
readonly thistype next
readonly thistype prev
method add takes nothing returns nothing
if (added) then
return
endif
set added = true
set prev = thistype(0).prev
set next = 0
set thistype(0).prev.next = this
set thistype(0).prev = this
endmethod
method remove takes nothing returns nothing
if (not added) then
return
endif
set added = false
set prev.next = next
set next.prev = prev
endmethod
endstruct
private struct StationaryList extends array
readonly boolean added
readonly thistype next
readonly thistype prev
method add takes nothing returns nothing
if (added or IsUnitNativelyMovingById(this)) then
return
endif
set added = true
set prev = thistype(0).prev
set next = 0
set thistype(0).prev.next = this
set thistype(0).prev = this
call StaminaUnits(this).add()
endmethod
method remove takes nothing returns nothing
if (not added) then
return
endif
set added = false
set prev.next = next
set next.prev = prev
call StaminaUnits(this).remove()
endmethod
endstruct
private struct MovementList extends array
readonly boolean added
readonly thistype next
readonly thistype prev
method add takes nothing returns nothing
if (added or not IsUnitNativelyMovingById(this)) then
return
endif
set added = true
set prev = thistype(0).prev
set next = 0
set thistype(0).prev.next = this
set thistype(0).prev = this
call StaminaUnits(this).add()
endmethod
method remove takes nothing returns nothing
if (not added) then
return
endif
set added = false
set prev.next = next
set next.prev = prev
call StaminaUnits(this).remove()
endmethod
endstruct
private struct Stamina extends array
private real valueT
private real regenT
private real costT
private real maxT
method operator value takes nothing returns real
return valueT
endmethod
method operator value= takes real v returns nothing
if (v > maxT) then
set valueT = maxT
return
endif
if (0 > v) then
set valueT = 0
return
endif
set valueT = v
endmethod
method operator regen takes nothing returns real
return regenT
endmethod
method operator regen= takes real v returns nothing
set regenT = v
if (0 == v or 0 == maxT) then
call StationaryList(this).remove()
else
call StationaryList(this).add()
endif
endmethod
method operator cost takes nothing returns real
return costT
endmethod
method operator cost= takes real v returns nothing
set costT = v
if (0 == v or 0 == maxT) then
call MovementList(this).remove()
else
call MovementList(this).add()
endif
endmethod
method operator max takes nothing returns real
return maxT
endmethod
method operator max= takes real v returns nothing
set maxT = v
if (0 == v) then
call MovementList(this).remove()
call StationaryList(this).remove()
else
call MovementList(this).add()
call StationaryList(this).add()
endif
endmethod
endstruct
private struct StaminaType extends array
private static Table regenT
private static Table costT
private static Table maxT
private static method onInit takes nothing returns nothing
set regenT = Table.create()
set costT = Table.create()
set maxT = Table.create()
endmethod
method operator regen takes nothing returns real
return regenT.real[this]
endmethod
method operator regen= takes real new returns nothing
local unit u
local real old = regen
local Stamina stamina
set regenT.real[this] = new
call GroupEnumUnitsOfType(enumGroup, GetObjectName(this), null)
loop
set u = FirstOfGroup(enumGroup)
exitwhen null == u
call GroupRemoveUnit(enumGroup, u)
set stamina = GetUnitUserData(u)
set stamina.regen = stamina.regen + new - old
endloop
endmethod
method operator cost takes nothing returns real
return costT.real[this]
endmethod
method operator cost= takes real new returns nothing
local unit u
local real old = cost
local Stamina stamina
set costT.real[this] = new
call GroupEnumUnitsOfType(enumGroup, GetObjectName(this), null)
loop
set u = FirstOfGroup(enumGroup)
exitwhen null == u
call GroupRemoveUnit(enumGroup, u)
set stamina = GetUnitUserData(u)
set stamina.cost = stamina.cost + new - old
endloop
endmethod
method operator max takes nothing returns real
return maxT.real[this]
endmethod
method operator max= takes real new returns nothing
local unit u
local real old = max
local Stamina stamina
set maxT.real[this] = new
call GroupEnumUnitsOfType(enumGroup, GetObjectName(this), null)
loop
set u = FirstOfGroup(enumGroup)
exitwhen null == u
call GroupRemoveUnit(enumGroup, u)
set stamina = GetUnitUserData(u)
set stamina.max = stamina.max + new - old
endloop
endmethod
endstruct
private struct StaminaTypePlayer extends array
private Table regenT
private Table costT
private Table maxT
private static method onInit takes nothing returns nothing
local thistype this = 15
loop
set regenT = Table.create()
set costT = Table.create()
set maxT = Table.create()
exitwhen 0 == this
set this = this - 1
endloop
endmethod
method getRegen takes integer unitTypeId returns real
return regenT.real[unitTypeId]
endmethod
method setRegen takes integer unitTypeId, real new returns nothing
local unit u
local real old = getRegen(unitTypeId)
local Stamina stamina
set regenT.real[unitTypeId] = new
call GroupEnumUnitsOfPlayer(enumGroup, Player(this), null)
loop
set u = FirstOfGroup(enumGroup)
exitwhen null == u
call GroupRemoveUnit(enumGroup, u)
if (GetUnitTypeId(u) == unitTypeId) then
set stamina = GetUnitUserData(u)
set stamina.regen = stamina.regen + new - old
endif
endloop
endmethod
method getCost takes integer unitTypeId returns real
return costT.real[unitTypeId]
endmethod
method setCost takes integer unitTypeId, real new returns nothing
local unit u
local real old = getCost(unitTypeId)
local Stamina stamina
set costT.real[unitTypeId] = new
call GroupEnumUnitsOfPlayer(enumGroup, Player(this), null)
loop
set u = FirstOfGroup(enumGroup)
exitwhen null == u
call GroupRemoveUnit(enumGroup, u)
if (GetUnitTypeId(u) == unitTypeId) then
set stamina = GetUnitUserData(u)
set stamina.cost = stamina.cost + new - old
endif
endloop
endmethod
method getMax takes integer unitTypeId returns real
return maxT.real[unitTypeId]
endmethod
method setMax takes integer unitTypeId, real new returns nothing
local unit u
local real old = getMax(unitTypeId)
local Stamina stamina
set maxT.real[unitTypeId] = new
call GroupEnumUnitsOfPlayer(enumGroup, Player(this), null)
loop
set u = FirstOfGroup(enumGroup)
exitwhen null == u
call GroupRemoveUnit(enumGroup, u)
if (GetUnitTypeId(u) == unitTypeId) then
set stamina = GetUnitUserData(u)
set stamina.max = stamina.max + new - old
endif
endloop
endmethod
endstruct
private struct Core extends array
private static method onUnitStationary takes nothing returns boolean
local Stamina stamina = GetMovingUnitById()
call MovementList(stamina).remove()
if (0 != stamina.regen and 0 != stamina.max) then
call StationaryList(stamina).add()
endif
return false
endmethod
private static method onUnitMove takes nothing returns boolean
local Stamina stamina = GetMovingUnitById()
call StationaryList(stamina).remove()
if (0 != stamina.cost and 0 != stamina.max) then
call MovementList(stamina).add()
endif
return false
endmethod
private static method onUnitActive takes nothing returns boolean
local Stamina stamina = GetUnitTypeId(GetUnitById(GetMovingUnitById()))
if (0 != stamina.regen and 0 != stamina.max) then
call StationaryList(stamina).add()
endif
if (0 != stamina.cost and 0 != stamina.max) then
call MovementList(stamina).add()
endif
return false
endmethod
private static method onUnitInactive takes nothing returns boolean
local Stamina stamina = GetUnitTypeId(GetUnitById(GetMovingUnitById()))
call MovementList(stamina).remove()
call StationaryList(stamina).remove()
return false
endmethod
private static method onIndex takes nothing returns boolean
local StaminaTypePlayer owningPlayer = GetPlayerId(GetOwningPlayer(GetIndexedUnit()))
local Stamina stamina = GetUnitUserData(GetIndexedUnit())
local StaminaType staminaType = GetUnitTypeId(GetIndexedUnit())
set stamina.cost = staminaType.cost + owningPlayer.getCost(staminaType)
set stamina.regen = staminaType.regen + owningPlayer.getRegen(staminaType)
set stamina.max = staminaType.max + owningPlayer.getMax(staminaType)
return false
endmethod
private static method onInit takes nothing returns nothing
call StationaryUnits.event.register(Condition(function thistype.onUnitStationary))
call NativelyMovingUnits.event.register(Condition(function thistype.onUnitMove))
call MovementTracker.eventIndex.register(Condition(function thistype.onUnitActive))
call MovementTracker.eventDeindex.register(Condition(function thistype.onUnitInactive))
call RegisterUnitIndexEvent(Condition(function thistype.onIndex), UnitIndexer.INDEX)
set onStaminaChange = Event.create()
endmethod
endstruct
private struct StaminaLoss extends array
implement CT32
local MovementList moving = MovementList(0).next
local StationaryList stationary = StationaryList(0).next
local Stamina stamina
loop
exitwhen 0 == moving
set stamina = moving
if (0 < stamina.value) then
set stamina.value = stamina.value - stamina.cost*.03125
endif
set moving = moving.next
endloop
loop
exitwhen 0 == stationary
set stamina = stationary
if (stamina.value < stamina.max) then
set stamina.value = stamina.value + stamina.regen*.03125
endif
set stationary = stationary.next
endloop
implement CT32End
private static method onInit takes nothing returns nothing
call StaminaLoss.start()
endmethod
endstruct
function SetUnitStaminaById takes UnitIndex index, real value returns nothing
set Stamina(index).value = value
endfunction
function SetUnitStaminaRegenById takes UnitIndex index, real value returns nothing
set Stamina(index).regen = value
endfunction
function SetUnitStaminaCostById takes UnitIndex index, real value returns nothing
set Stamina(index).cost = value
endfunction
function SetUnitStaminaMaxById takes UnitIndex index, real value returns nothing
set Stamina(index).max = value
endfunction
function GetUnitStaminaById takes UnitIndex index returns real
return Stamina(index).value
endfunction
function GetUnitStaminaRegenById takes UnitIndex index returns real
return Stamina(index).regen
endfunction
function GetUnitStaminaCostById takes UnitIndex index returns real
return Stamina(index).cost
endfunction
function GetUnitStaminaMaxById takes UnitIndex index returns real
return Stamina(index).max
endfunction
function SetUnitTypeStaminaRegen takes integer unitTypeId, real value returns nothing
set StaminaType(unitTypeId).regen = value
endfunction
function SetUnitTypeStaminaCost takes integer unitTypeId, real value returns nothing
set StaminaType(unitTypeId).cost = value
endfunction
function SetUnitTypeStaminaMax takes integer unitTypeId, real value returns nothing
set StaminaType(unitTypeId).max = value
endfunction
function GetUnitTypeStaminaRegen takes integer unitTypeId returns real
return StaminaType(unitTypeId).regen
endfunction
function GetUnitTypeStaminaCost takes integer unitTypeId returns real
return StaminaType(unitTypeId).cost
endfunction
function GetUnitTypeStaminaMax takes integer unitTypeId returns real
return StaminaType(unitTypeId).max
endfunction
function SetUnitTypeStaminaRegenForPlayer takes integer unitTypeId, integer playerId, real value returns nothing
call StaminaTypePlayer(playerId).setRegen(unitTypeId, value)
endfunction
function SetUnitTypeStaminaCostForPlayer takes integer unitTypeId, integer playerId, real value returns nothing
call StaminaTypePlayer(playerId).setCost(unitTypeId, value)
endfunction
function SetUnitTypeStaminaMaxForPlayer takes integer unitTypeId, integer playerId, real value returns nothing
call StaminaTypePlayer(playerId).setMax(unitTypeId, value)
endfunction
function GetUnitTypeStaminaRegenForPlayer takes integer unitTypeId, integer playerId returns real
return StaminaTypePlayer(playerId).getRegen(unitTypeId)
endfunction
function GetUnitTypeStaminaCostForPlayer takes integer unitTypeId, integer playerId returns real
return StaminaTypePlayer(playerId).getCost(unitTypeId)
endfunction
function GetUnitTypeStaminaMaxForPlayer takes integer unitTypeId, integer playerId returns real
return StaminaTypePlayer(playerId).getMax(unitTypeId)
endfunction
endlibrary
Permissions in this forum:
You cannot reply to topics in this forum
|
|