Topic hỏi đáp về cách làm map | version 14

Status
Không mở trả lời sau này.
Cho mình hỏi mình làm trinnger cho cái giáp phản dame mà sao khi mình bật lên thì bọn Creep hoặc hero đánh mất máu vậy mà đến khi lên GG mình dùng thì vẫn bị phe nó bem cris 4 500 mà nó không mất tý máu nào :(
Mã:
GiapPhanDame1
    Events
        Time - Elapsed game time is 0.00 seconds
    Conditions
    Actions
        Set TakeDamGroup = (Units in (Playable map area))
        Unit Group - Pick every unit in TakeDamGroup and do (Actions)
            Loop - Actions
                Trigger - Add to ReturnDame <gen> the event (Unit - (Picked unit) Takes damage)
Tringger 2
Mã:
GiapPhanDame2
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        ((Triggering unit) is in TakeDamGroup) Equal to False
    Actions
        Unit Group - Add (Triggering unit) to TakeDamGroup
        Trigger - Add to ReturnDame <gen> the event (Unit - (Triggering unit) Takes damage)
Tringger 3
Mã:
ReturnDame
    Events
    Conditions
        ((Triggering unit) has buff Nhan Linh Giap ) Equal to True
        (Triggering unit) Not equal to (Damage source)
    Actions
        Trigger - Turn off (This trigger)
        Unit - Cause (Triggering unit) to damage (Damage source), dealing (Damage taken) damage of attack type Hero and damage type Normal
        Trigger - Turn on (This trigger)
nếu không phải do tringger thì do lỗi gì có thể mọi người giúp với

Damage taken là damage đã bị giảm bởi giáp,khi phản lại bạn để damage type là normal nó sẽ lại tiếp tục giảm nếu damage source có giáp cao,bạn thử chỉnh damage phản lại cao hơn hoặc chỉnh damage type thành divine xem :)
 
Đã gần 1 tuần k ai chỉ =.=''........... help me plz !!!!

Trigger dải thế cơ mà, không ai xem là phải.
- Trong trigger Cage of Eden

Mã:
Cage of Eden
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Cage Of Eden 
    Actions
        [B][COLOR="#FF0000"]Set MUI[9] = (MUI[9] + 1)[/COLOR][/B]
- Trong trigger Narural Order :
Mã:
Nature Order
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Natural Order (Spell)
    Actions
        [B][COLOR="#FF0000"]Set MUI[10] = (MUI[10] + 1)[/COLOR][/B]
Lúc đầu, khi cast 2 spell cùng lượt thì
MUI[9] = MUI[9] + 1
______ = 0 + 1 = 1

MUI[10] = MUI[10] + 1
_______= 0 + 1 = 1

- Hai biến MUI[9] và MUI[10] đều có cùng giá trị là 1, có nghĩa:
_RealMUI[MUI[9]] = RealMUI[MUI[10]] = RealMUI[1] => Lỗi

o Cách giải quyết: dùng 2 biến RealMUI khác nhau cho mỗi spell.

P/s: Vấn đề của bạn là ở chỗ tên biến. Trong 5 trigger trên là 2 skill riêng biệt nhưng lại có khá nhiều biến chung, có thể khi làm bạn nhầm lẫn tên biến. Các bạn làm map thường rất ngại tạo nhiều biến, nhưng mỗi skill nên có 1 bộ biến riêng. Bạn nên sửa tên biến lại cho dễ nhìn, theo tôi thì tên biến nên đặt theo quy tắc:
HeroName+SkillNumber_VarName
  • Hero Name = tên hoặc kí tự đặt biệt hoặc tên rút gọn của hero
  • Skill Number = số thứ tự của skill
  • Var Name = tên biến
Ví dụ hero là Demon Hunter, skill Evasion (skill thử 3) và biến cần tạo là real thì tôi đặt tên biến là DH3_Real

Đừng coi thường việc đặt tên biến, đặt tên biến không theo thứ tự sẽ gây khó trong quá trình làm và sửa map
 
Chỉnh sửa cuối:
Giả sử tôi có 1 item gồm 2 spell:
- Harder Skin (1): X% block 10 hero damage
- Harder Skin (2): Y% block 10 all type damage
Vậy thì có stack không?
 
Mã:
private function HacHonCd takes nothing returns boolean
       return GetSpellAbilityId() == ABIHH
   endfunction 
   
   private function HacHonM takes nothing returns boolean
       local unit u = GetFilterUnit()
       return (IsUnitDeadBJ(u) == true) and (IsUnitType(u,UNIT_TYPE_STRUCTURE) == false) and (IsUnitType(u,UNIT_TYPE_HERO) == false)   
       set u = null
       return true
   endfunction

   private function HacHonP takes nothing returns nothing
       local unit uc = GetSpellAbilityUnit()
       local unit u = GetEnumUnit()
       local location l = GetUnitLoc(u)
       call CreateNUnitsAtLoc(1,'u00P',GetOwningPlayer(uc),l,0)
       call UnitApplyTimedLife(GetLastCreatedUnit(),'BTLF',0.5)
       call UnitAddAbility(GetLastCreatedUnit(),'A0S1')
       call IssueTargetOrder(GetLastCreatedUnit(),"shadowstrike",uc)
       call AddSpecialEffectLoc("Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl",l)
       call DestroyEffect(GetLastCreatedEffectBJ())
       call RemoveUnit(u)
       call RemoveLocation(l)   
       set l = null
       set u = null
       set uc = null
   endfunction   
   
   private function HacHonAc takes nothing returns nothing
       local unit u = GetSpellAbilityUnit()
       local location l = GetUnitLoc(u)
       local group g = GetUnitsInRangeOfLocMatching(600,l,function HacHonM)
       local integer i = CountUnitsInGroup(g)
       local real r = GetUnitState(u,UNIT_STATE_LIFE) + (15 * I2R(GetUnitAbilityLevel(u,ABIHH)) * I2R(i))
       local integer iam = i * 3
       local integer idm = i * 5
       call SetUnitState(u,UNIT_STATE_LIFE,r)       
       call ForGroup(g,function HacHonP)
       call State_SetArmor(u,iam)
       call State_SetDamage(u,idm)       
       call RemoveLocation(l)
       call DestroyGroup(g) 
       set l = null
       set g = null
       call TriggerSleepAction(15)
       call State_SetArmor(u,-iam)
       call State_SetDamage(u,-idm)
       set u = null
   endfunction

Ai xem giúp mình đoạn code trên,mình pick every unit đã chết tạo dummy tại position picked unit,add ability rồi cho dummy cast spell vào caster. Mà sao không hiểu sao chỉ có 1 dummy cast spell vào caster ?
 
Chỉnh sửa cuối:
Mã:
private function HacHonCd takes nothing returns boolean
       return GetSpellAbilityId() == ABIHH
   endfunction 
   
   private function HacHonM takes nothing returns boolean
       local unit u = GetFilterUnit()
       [COLOR="#FF0000"]return (IsUnitDeadBJ(u) == true) and (IsUnitType(u,UNIT_TYPE_STRUCTURE) == false) and (IsUnitType(u,UNIT_TYPE_HERO) == false)   [/COLOR]
       set u = null
       [COLOR="#FF0000"]return true[/COLOR] [COLOR="#800000"]/* Ơ hơ..... */[/COLOR]
   endfunction

   private function HacHonP takes nothing returns nothing
       local unit uc = [COLOR="#FF0000"]GetSpellAbilityUnit()[/COLOR] [COLOR="#800000"]/*-> Đang Pick Group - giá trị ở đâu??? */[/COLOR]
       local unit u = GetEnumUnit()
       local location l = GetUnitLoc(u)
       [COLOR="#FF8C00"]local unit d[/COLOR]
       [COLOR="#FF8C00"]set d=[/COLOR] CreateNUnitsAtLoc(1,'u00P',GetOwningPlayer(uc),l,0)
       call UnitApplyTimedLife([COLOR="#FF8C00"]d[/COLOR],'BTLF',0.5)
       call UnitAddAbility([COLOR="#FF8C00"]d[/COLOR],'A0S1')
       call IssueTargetOrder([COLOR="#FF8C00"]d[/COLOR],"shadowstrike",uc)
       call DestroyEffect([COLOR="#FF8C00"]AddSpecialEffectLoc("Abilities\\Spells\\Undead\\CarrionSwarm\\CarrionSwarmDamage.mdl",l)[/COLOR])
       call RemoveUnit(u)
       call RemoveLocation(l)   
       set l = null
       set u = null
       set uc = null
       [COLOR="#FF8C00"]set d=null[/COLOR]
   endfunction   
   
   private function HacHonAc takes nothing returns nothing
       local unit u = GetSpellAbilityUnit() [COLOR="#008000"]// cái này là GetTriggerUnit() phải ko?, [/COLOR]
       local location l = GetUnitLoc(u)
       local group g = GetUnitsInRangeOfLocMatching(600,l,function HacHonM)
       local integer i = CountUnitsInGroup(g)
       local real r = GetUnitState(u,UNIT_STATE_LIFE) + (15 * I2R(GetUnitAbilityLevel(u,ABIHH)) * I2R(i))
       local integer iam = i * 3
       local integer idm = i * 5
       call SetUnitState(u,UNIT_STATE_LIFE,r)       
       call ForGroup(g,function HacHonP)
       call State_SetArmor(u,iam)
       call State_SetDamage(u,idm)       
       call RemoveLocation(l)
       call DestroyGroup(g) 
       set l = null
       set g = null
       call TriggerSleepAction(15)
       call State_SetArmor(u,-iam)
       call State_SetDamage(u,-idm)
       set u = null
   endfunction

anh xem lại xem =_________= .
anh nên dùng cách pick group theo cách anh Tom-sama hướng dẫn ýk, như vậy dễ lấy giá trị caster từ function trước thay vì dùng 2 function để thực hiện
 
Chỉnh sửa cuối:
anh xem lại xem =_________= .
anh nên dùng cách pick group theo cách anh Tom-sama hướng dẫn ýk, như vậy dễ lấy giá trị caster từ function trước thay vì dùng 2 function để thực hiện

Cám ơn bạn,nhưng...giờ nó nằm ở trang nào nhỉ,hix...

NgocLeo ơi cho hỏi font chữ trong map DnF tên là j thế ?

VNVOGU.TTF đó bạn :D

P/s: Mọi người cho hỏi vì sao ở code dưới effect sau khi tạo ko bị destroy vậy +_+ ???


Mã:
scope Poison initializer Spell

   globals
      private constant integer ABI = 'A001'
      private constant integer DUM = 'h001'
   endglobals
   
   private struct doc
      unit uc
      unit ut
      integer dur
      integer tk
      real dmg
      string sfx
   endstruct
   
   private function Damage takes nothing returns nothing
      local timer ti = GetExpiredTimer()
      local doc data = GetCSData(ti)
      local location l = GetUnitLoc(data.ut)
      
      call UnitDamageTarget(data.uc,data.ut,data.dmg,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
      call AddSpecialEffectLoc(data.sfx,l)
      call DestroyEffectBJ(GetLastCreatedEffectBJ())
      
      call RemoveLocation(l)
      
      set l = null
      
      set data.tk = data.tk - 1
      
      if data.tk <= 0 then
         call data.destroy()
         call ReleaseTimer(ti)
      endif
      
      set ti = null      
   endfunction
   
   private function SetData takes unit uc,unit ut,integer dur, real dmg,string sfx returns nothing
      local doc data = doc.create()
      local timer ti = NewTimer()
      
      set data.uc = uc
      set data.ut = ut
      set data.dur = dur
      set data.dmg = dmg
      set data.sfx = sfx      
      set data.tk = R2I(data.dur / 0.05)
      
      call SetCSData( ti , data )
      call TimerStart(ti,0.05,true,function Damage)
      
      set ti = null
   endfunction
   
   private function PoisonCd takes nothing returns boolean
      return GetSpellAbilityId() == ABI
   endfunction
   
   private function PoisonAc takes nothing returns nothing
      local unit u = GetSpellAbilityUnit()
      local unit ut = GetSpellTargetUnit()
      local integer i = 10
      local real r = 5 * GetUnitAbilityLevel(u,ABI)
      
      call SetData(u,ut,i,r,"Abilities\\Spells\\NightElf\\CorrosiveBreath\\ChimaeraAcidTargetArt.mdl")
      
      set u = null
      set ut = null      
    endfunction
      
      
   
   private function Spell takes nothing returns nothing
      local trigger tr = CreateTrigger()
      
      call TriggerRegisterAnyUnitEventBJ(tr,EVENT_PLAYER_UNIT_SPELL_EFFECT)
      call TriggerAddCondition(tr,function PoisonCd)
      call TriggerAddAction(tr,function PoisonAc)  
      
      set tr = null   
   endfunction

endscope

À thôi cám ơn,nhưng mình sửa được rồi,là do mấy cái BJ,cái dòng trên không có BJ mà bên dưới lại destroy effect BJ nên vậy @@,sorry vì chưa thử đã hỏi :H
vậy là biết dùng struct rồi :x
 
Chỉnh sửa cuối:
cho hỏi làm sao để sửa text của chữ "melee", mình tìm trong Gameplay - Interface mỏi mắt ko thấy T_T, thấy có mỗi Melee Upgrade
 
Mình đọc cách remove leak và làm thế này cò leak không, và tại sao ko có hiệu ứng cột ánh sáng vậy ?
Mã:
Set loc[0] = (Position of Casting Unit)
Set loc[1] = (Target point of ability being cast)
Special Effect - Create a special effect at loc[0] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Create a special effect at loc[1] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script:   call RemoveLocation(udg_loc[0])
Set loc[0] = loc[1]
Custom script:   call RemoveLocation(udg_loc[1])
Special Effect - Create a special effect at loc[0] using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
Custom script:   call RemoveLocation(udg_loc[0])
Special Effect - Destroy (Last created special effect)
 
Mình đọc cách remove leak và làm thế này cò leak không, và tại sao ko có hiệu ứng cột ánh sáng vậy ?
Mã:
Set loc[0] = (Position of Casting Unit)
Set loc[1] = (Target point of ability being cast)
[COLOR="#FF0000"]Special Effect - Create a special effect at loc[0] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl[/COLOR]
Special Effect - Create a special effect at loc[1] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script:   call RemoveLocation(udg_loc[0])
Set loc[0] = loc[1]
Custom script:   call RemoveLocation(udg_loc[1])
Special Effect - Create a special effect at loc[0] using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
Custom script:   call RemoveLocation(udg_loc[0])
Special Effect - Destroy (Last created special effect)

leak đó, và làm sao phải set/remove rách việc vậy?


Mã:
Set loc[0] = (Position of Casting Unit)
Set loc[1] = (Target point of ability being cast)
[COLOR="#0000FF"]Special Effect - Create a special effect at loc[0] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Destroy (Last created special effect)[/COLOR]
Special Effect - Create a special effect at loc[1] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script:   call RemoveLocation(udg_loc[0])
Special Effect - Create a special effect at [COLOR="#0000FF"]loc[1][/COLOR] using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script:   call RemoveLocation(udg_loc[1])

còn vụ ko thấy effect thì chịu =)
 
Mình đọc cách remove leak và làm thế này cò leak không, và tại sao ko có hiệu ứng cột ánh sáng vậy ?
Mã:
Set loc[0] = (Position of Casting Unit)
Set loc[1] = (Target point of ability being cast)
Special Effect - Create a special effect at loc[0] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Create a special effect at loc[1] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Destroy (Last created special effect)
Custom script:   call RemoveLocation(udg_loc[0])
Set loc[0] = loc[1]
[COLOR="#B22222"]Custom script:   call RemoveLocation(udg_loc[1])[/COLOR]
Special Effect - Create a special effect at loc[0] using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
Custom script:   call RemoveLocation(udg_loc[0])
Special Effect - Destroy (Last created special effect)


Câu thứ nhất : Có leak. Để ko leak thì phải :


Mã:
Special Effect - Create a special effect at loc[0] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at loc[1] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Special Effect - Destroy (Last created special effect)



Câu thứ 2 : "tại sao ko có hiệu ứng cột ánh sáng". Vì ko có kiểu set như này :


Mã:
Set loc[0] = loc[1]




Mà phải là :

Mã:
Set loc[0] = (Target point of ability being cast)
Và phải bỏ dòng màu đỏ lên trên, xong mới set.
 
Chỉnh sửa cuối:
Cho mình hỏi khi 1 shop bán item hoặc unit làm sao chỉ bán được 1 lần nhỉ , bán item 1 lần rồi trong shop item đó cũng biến mất luôn :-s
 
Remove Shop đó luôn thì với event A unit sell item form shop

Mã:
Unit - Remove Selling Unit

Muốn item đó chỉ bán được một lần add loại item đó cho shop bằng cách

Mã:
Neutral Building - Add Tome of Experience to (Triggering unit) with 1 in stock and a max stock of 1

Sau khi bán xong item đó sẽ mất luôn,thực ra thì để giá trị stock và max stock bao nhiêu thì cũng chỉ bán được một lần
 
Giả sử tôi có 1 item gồm 2 spell:
- Harder Skin (1): X% block 10 hero damage
- Harder Skin (2): Y% block 10 all type damage
Vậy thì có stack không?

Có stack! Cách tính như sau
- Nếu là hero: ( Dam Y%-10) X%-10
- All type mà ko phải hero: Dam Y%-10 ()
Nhưng nếu để X và Y =100% thì skill nào ở trước trong list skill thì skill đó sẽ vô hiệu hóa skill còn lại
Còn nếu X hoặc Y = 100% thì cái nào =100 sẽ vô hiệu hóa cái còn lại!

Tương tự như vậy nếu có 2 skill miss
Skill A miss 50%, Skill B cũng miss 50%
% đánh trúng có thể nói là 25% nhưng cũng ko hoàn toàn là như thế:
- Đầu tiên sẽ tính xem skill A có tác dụng miss attack đó hay ko? Nếu có rồi thì ko tính skill B nữa.
- Nhưng nếu đã thuộc 50% trúng của skill A thì lại tính tiếp xem attack đó trượt hay trúng với 50% của skill B
Nhưng nếu là miss=100% thì đương nhiên là vô hiệu hóa skill miss khác rồi :-??

Còn với critical thì khác 1 chút
Có Dam=100, skill A 50% crit x2 và skill B 50% crit x3
vậy sẽ có 1 crit của skill A nảy với dam=100x2=200!
Và nếu ko có nhảy crit của skill A thì có khả năng nhảy 50% crit của skill B với dam=100x3=300!

Quy luật tính trung cho việc stack các skill cùng loại theo % như sau:
- Skill nào để ở trước thì tính theo skill đó trước.
- Skill 100% sẽ đè lên các skill khác
 
Remove Shop đó luôn thì với event A unit sell item form shop

Mã:
Unit - Remove Selling Unit

Muốn item đó chỉ bán được một lần add loại item đó cho shop bằng cách

Mã:
Neutral Building - Add Tome of Experience to (Triggering unit) with 1 in stock and a max stock of 1

Sau khi bán xong item đó sẽ mất luôn,thực ra thì để giá trị stock và max stock bao nhiêu thì cũng chỉ bán được một lần

Thanks bạn :D Trong quá trình làm map có điều gì chưa hiểu rất mong các bạn giúp đỡ :D
 
Trích từ FAQ_vuongkkk
Làm sao để shop chỉ bán 1 item/ unit được 1 lần rồi mất luôn ở trong shop?
Xóa 1 item / unit khỏi shop thì làm thế nào?

[spoil]
Mã:
Add One-shot item and unit
    Events
        Map initialization
    Conditions
    Actions
        Neutral Building - Add <Item type> to <Shop Unit> with 1 in stock and a max stock of 1
        Neutral Building - Add <Unit type> to <Shop Unit> with 1 in stock and a max stock of 1
hoặc
Mã:
delete Unit A from shop
    Events
        Unit - A unit Sells a unit
    Conditions
        (Unit-type of (Sold unit)) Equal to <Unit type A>
    Actions
        Neutral Building - Remove (Unit-type of (Sold unit)) from all marketplaces
Mã:
delete item A from shop
    Events
        Unit - A unit Sells a item
    Conditions
        (Item-type of (Sold item)) Equal to <Item type A>
    Actions
        Neutral Building - Remove (Item-type of (Sold item)) from all marketplaces
[/spoil]
 
Chỉnh sửa cuối:
Status
Không mở trả lời sau này.
Back
Top