cho hỏi cách làm trigger như này : khi mua 1 item nào đó sẽ create random 1 -> 5 unit thuộc về unit mua
và chỉ dc mua 1 lần duy nhất đối với 1 player
và chỉ dc mua 1 lần duy nhất đối với 1 player
Chỉnh sửa cuối:
Trong phần Object Editor của unit, muốn unit nào ko hiển thị trên minimap thì chỉnh lại đó bạn..............................
Stats - Hide minimap Display ...................................False
Chỉnh lại thành True
Muốn như vậy bạn phải biết chắc chắn unit nào sẽ xuất hiện trong map, unit nào ko. tuy thủ công một chút nhưng tiện, muốn unit nào cứ chỉnh unit đó...............................
Còn ko thì bạn phải thay thế các image mặc định thể hiện house, creep camp, neutral, resource,.... bằng các image cùng định dạng, kích cỡ, nhưng trát hết bề mặt image bằng channel alpha ( để ảnh trong suốt ), tương tự như khi ta thay icon minimap hero thành ngôi sao, chấm tròn... vậy đó.......................................................Tiện và nhanh nhưng sẽ có hiệu ứng trên toàn bộ unit cùng loại................
Thay ờ các dòng như
Icon - Minimap Hero
Icon - Minimap Creep Camp ( Large )
vv...vv..............
Nguyên tắc lý thyết là vậy, nhưng chưa làm bao giờ vì thấy chả có tác dụng gì trong map mình..................
Dau Truong Ruc lua 2
Events
Time - Every 900.00 seconds of game time
Conditions
Actions
Wait 2.00 game-time seconds
Game - Display to (All players) the text: |c00FEBA0E§Êu Tr...
Wait 2.00 game-time seconds
Game - Display to (All players) the text: |c00FEBA0E4.|r |c00...
Wait 2.00 game-time seconds
Game - Display to (All players) the text: |c00FEBA0E3.|r |c00...
Wait 2.00 game-time seconds
Game - Display to (All players) the text: |c00FEBA0E2.|r |c00...
Wait 2.00 game-time seconds
Game - Display to (All players) the text: |c00FEBA0EB¾t §Ç...
Unit - Move (Random unit from (Units owned by Player 1 (Red))) instantly to (Center of Rect 1 <gen>)
Unit - Move (Random unit from (Units owned by Player 2 (Blue))) instantly to (Center of Rect 1 <gen>)
Unit - Move (Random unit from (Units owned by Player 3 (Teal))) instantly to (Center of Rect 1 <gen>)
Unit - Move (Random unit from (Units owned by Player 4 (Purple))) instantly to (Center of Rect 2 <gen>)
Unit - Move (Random unit from (Units owned by Player 5 (Yellow))) instantly to (Center of Rect 2 <gen>)
Unit - Move (Random unit from (Units owned by Player 6 (Orange))) instantly to (Center of Rect 2 <gen>)
Item - Create Huy Ch¬ng at (Center of Rect 1 <gen>)
Item - Create Huy Ch¬ng at (Center of Rect 2 <gen>)
Camera - Pan camera for Player 1 (Red) to (Center of Rect 1 <gen>) over 1.00 seconds
Camera - Pan camera for Player 2 (Blue) to (Center of Rect 1 <gen>) over 1.00 seconds
Camera - Pan camera for Player 3 (Teal) to (Center of Rect 1 <gen>) over 1.00 seconds
Camera - Pan camera for Player 4 (Purple) to (Center of Rect 2 <gen>) over 1.00 seconds
Camera - Pan camera for Player 5 (Yellow) to (Center of Rect 2 <gen>) over 1.00 seconds
Camera - Pan camera for Player 6 (Orange) to (Center of Rect 2 <gen>) over 1.00 seconds
Dau Truong Ruc Lua out
Events
Unit - A unit enters Rect 3 <gen>
Conditions
Actions
Wait 50.00 seconds
Game - Display to (All players) the text: |c00FEBA0ETh«ng b...
Unit - Move (Triggering unit) instantly to (Center of HS <gen>)
Camera - Pan camera for Player 1 (Red) to (Center of HS <gen>) over 1.00 seconds
Camera - Pan camera for Player 2 (Blue) to (Center of HS <gen>) over 1.00 seconds
Camera - Pan camera for Player 3 (Teal) to (Center of HS <gen>) over 1.00 seconds
Camera - Pan camera for Player 4 (Purple) to (Center of HS <gen>) over 1.00 seconds
Camera - Pan camera for Player 5 (Yellow) to (Center of HS <gen>) over 1.00 seconds
Camera - Pan camera for Player 6 (Orange) to (Center of HS <gen>) over 1.00 seconds

scope LifeAbsorb initializer InitTrig_LifeAbsorb
globals
private constant integer AbilID = 'A03R' //* The Spells MainAbility
private real array absorbLife[4]
endglobals
//* Extend your struct with the ChainAbility
struct LifeAbsorb extends ChainAbility
private real lifeAbsorbed=0.
integer level=0
//* Assign your own TargetFilter
//* Use ChainAbility.CurrentTarget instead of FilterUnit()
//* Use ChainAbility.CastingUnit as the Chains source unit
//* ! If this method is not declared in the Childstruct the standard filter will apply !
method targetFilter takes nothing returns boolean
return IsUnitEnemy(ChainAbility.CurrentTarget,GetOwningPlayer(ChainAbility.CastingUnit)) and not IsUnitType(ChainAbility.CurrentTarget, UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(ChainAbility.CurrentTarget, UNIT_TYPE_STRUCTURE) and IsUnitVisible(ChainAbility.CurrentTarget,GetOwningPlayer(ChainAbility.CastingUnit)) and GetWidgetLife(ChainAbility.CurrentTarget)>0.405
endmethod
//* Assign what shall happen when a unit gets hit by a Chain
//* Use ChainAbility.CurrentTarget as the Unit that gets hit
//* Use ChainAbility.CastingUnit as the Chains source Unit
//* Use ChainAbility.CurrentHit to get the number of allready hit targets
//* ! If this method is not declared in the Childstruct nothing will happen when a unit is hit !
method onTargetHit takes nothing returns nothing
if ChainAbility.CurrentTarget==ChainAbility.CastingUnit then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl",ChainAbility.CastingUnit,"origin"))
call SetWidgetLife(ChainAbility.CastingUnit,GetWidgetLife(ChainAbility.CastingUnit)+.lifeAbsorbed)
else
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl",ChainAbility.CurrentTarget,"chest"))
call UnitDamageTarget(ChainAbility.CastingUnit,ChainAbility.CurrentTarget,absorbLife[.level],true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
set .lifeAbsorbed=.lifeAbsorbed+absorbLife[.level]
endif
endmethod
//* The Life absorbed per level
static method lifeAbsorbSetup takes nothing returns nothing
set absorbLife[0]=25.
set absorbLife[1]=50.
set absorbLife[2]=75.
set absorbLife[3]=100.
endmethod
endstruct
//* The function that fires on SpellCast
private function SpellCast takes nothing returns nothing
local LifeAbsorb object
if GetSpellAbilityId()==AbilID then
//* Your Chain Setup:
//* Create the Chain with the source Unit, the target Unit and the Chains missile model path
set object=LifeAbsorb.create()
//* Change the Chains zArc to your value (makes the chain fly a parabola curve)
set object.useZArc=1.
//* Change the Chains model
set object.missileModel="Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissile.mdl"
//* Change the Chains Lightning model
set object.setLightningModel=DrainLife
//* Change the Chains movespeed
set object.missileSpeed=3700
//* Change the Chains detectionrange
set object.pickRange=600
//* Change the flag whether a unit gets hit more than once
set object.hitMoreThanOnce=false
//* Change the flag whether the chain shall move back to the source
set object.moveBackToSource=true
//* Change the Chains hitcount
set object.hitCount=8
//* Start the Chain
set object.level=GetUnitAbilityLevel(GetSpellAbilityUnit(),AbilID)-1
call object.Cast(GetSpellAbilityUnit(),GetSpellTargetUnit())
//* End Chain Setup
endif
endfunction
private function InitTrig_LifeAbsorb takes nothing returns nothing
local trigger t=CreateTrigger()
call LifeAbsorb.lifeAbsorbSetup()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction(t,function SpellCast)
endfunction
endscope
mọi người cho hỏi tại sao mình cast 1 spell JASS(cụ thể là chain lightning có thể hút máu ), thì nó có vấn đề là bị hiện lỗi:
double free of type: eventhandler
thỉnh thoảng hiện double free of type: dummy, double free of type: vector
code:
[SPOIL][/SPOIL]Mã:scope LifeAbsorb initializer InitTrig_LifeAbsorb globals private constant integer AbilID = 'A03R' //* The Spells MainAbility private real array absorbLife[4] endglobals //* Extend your struct with the ChainAbility struct LifeAbsorb extends ChainAbility private real lifeAbsorbed=0. integer level=0 //* Assign your own TargetFilter //* Use ChainAbility.CurrentTarget instead of FilterUnit() //* Use ChainAbility.CastingUnit as the Chains source unit //* ! If this method is not declared in the Childstruct the standard filter will apply ! method targetFilter takes nothing returns boolean return IsUnitEnemy(ChainAbility.CurrentTarget,GetOwningPlayer(ChainAbility.CastingUnit)) and not IsUnitType(ChainAbility.CurrentTarget, UNIT_TYPE_MAGIC_IMMUNE) and not IsUnitType(ChainAbility.CurrentTarget, UNIT_TYPE_STRUCTURE) and IsUnitVisible(ChainAbility.CurrentTarget,GetOwningPlayer(ChainAbility.CastingUnit)) and GetWidgetLife(ChainAbility.CurrentTarget)>0.405 endmethod //* Assign what shall happen when a unit gets hit by a Chain //* Use ChainAbility.CurrentTarget as the Unit that gets hit //* Use ChainAbility.CastingUnit as the Chains source Unit //* Use ChainAbility.CurrentHit to get the number of allready hit targets //* ! If this method is not declared in the Childstruct nothing will happen when a unit is hit ! method onTargetHit takes nothing returns nothing if ChainAbility.CurrentTarget==ChainAbility.CastingUnit then call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl",ChainAbility.CastingUnit,"origin")) call SetWidgetLife(ChainAbility.CastingUnit,GetWidgetLife(ChainAbility.CastingUnit)+.lifeAbsorbed) else call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl",ChainAbility.CurrentTarget,"chest")) call UnitDamageTarget(ChainAbility.CastingUnit,ChainAbility.CurrentTarget,absorbLife[.level],true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS) set .lifeAbsorbed=.lifeAbsorbed+absorbLife[.level] endif endmethod //* The Life absorbed per level static method lifeAbsorbSetup takes nothing returns nothing set absorbLife[0]=25. set absorbLife[1]=50. set absorbLife[2]=75. set absorbLife[3]=100. endmethod endstruct //* The function that fires on SpellCast private function SpellCast takes nothing returns nothing local LifeAbsorb object if GetSpellAbilityId()==AbilID then //* Your Chain Setup: //* Create the Chain with the source Unit, the target Unit and the Chains missile model path set object=LifeAbsorb.create() //* Change the Chains zArc to your value (makes the chain fly a parabola curve) set object.useZArc=1. //* Change the Chains model set object.missileModel="Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilMissile.mdl" //* Change the Chains Lightning model set object.setLightningModel=DrainLife //* Change the Chains movespeed set object.missileSpeed=3700 //* Change the Chains detectionrange set object.pickRange=600 //* Change the flag whether a unit gets hit more than once set object.hitMoreThanOnce=false //* Change the flag whether the chain shall move back to the source set object.moveBackToSource=true //* Change the Chains hitcount set object.hitCount=8 //* Start the Chain set object.level=GetUnitAbilityLevel(GetSpellAbilityUnit(),AbilID)-1 call object.Cast(GetSpellAbilityUnit(),GetSpellTargetUnit()) //* End Chain Setup endif endfunction private function InitTrig_LifeAbsorb takes nothing returns nothing local trigger t=CreateTrigger() call LifeAbsorb.lifeAbsorbSetup() call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddAction(t,function SpellCast) endfunction endscope
Mọi người cho mình hỏi là làm thế nào để tạo 1 hệ thống spell như Invoker trong Dota. Mình rất mê mẩn em này :( Ai có map demo cho xin thì càng tốt.
Hỏi câu nữa là có thể add 3 orb của invoker cho model khác được không, nếu có thì làm thế nào.