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

Ai cho em hỏi với sao cái khoảng đất em nâng lên cái phần xung quanh khoảng đất ấy lại màu như thế này mặc dù tile em là grass và Ciff type của em cũng là grass nhưng nó ra như vầy : http://upanh.com/snow_editor_upanh/v/1vm2dx3l7jd.htm
Anh Tom hoặc mấy anh khác biết trường hợp này thì chỉ em cách khắc phục với:8cool_cry:
 
Có cách nào làm cho 1 unit bé tí gần như không nhìn thấy gì nhưng các unit khác không đi xuyên qua được unit đó không nhỉ?
 
cho m` hỏi: làm thể nào để tạo 1 effect xuất hiện ngẫu nhiên liên tục trong 1 phạm vi???
 
@Drakkar Knight : Poison Slow là một loại orb effect nhưng nó có thể stack vs Lifesteal (hút máu)
Bé đi nhưng nó vẫn có collusion size nên vẫn ko thể di xuyên qua được (nếu mà bé đến nỗi ko nhìn thấy thì nên dùng trigger chỉnh cho unit đó trong suốt thì hay hơn là thu nho lại)
@Dyland : thứ nhất có vị trí trung tâm của phạm vi đó , ,thứ 2 chạy timer (vd: cứ 1s thì tạo 1 effect tại Point với khoảng cách và góc độ đến vị trí trung tâm là random)
Point là biến ,sau mỗi lần tạo thì xóa leak và tạo Point mới (cái này quyết định phần random)
 
Mã:
function ICcond takes nothing returns boolean
   return GetSpellAbilityId()=='A000'
endfunction

function ICact takes nothing returns nothing
   local unit cast
   local unit u
   local group g
   local string sfx
   local location p
   local real dam
   
   set cast = GetTriggerUnit()
   set p = GetSpellTargetLoc()
   set g = GetUnitsInRangeOfLocAll(400.00,p)
   set dam = 60.00+(40.00*I2R(GetUnitAbilityLevelSwapped('A000',cast)))
   set sfx = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
   loop 
       set u = FirstOfGroup(g)
       exitwhen u==null
       call AddSpecialEffectLoc(sfx,p)
       call DestroyEffect(GetLastCreatedEffectBJ())
       if IsUnitEnemy(u, GetOwningPlayer(cast))==true then
          call GroupRemoveUnit(g,u)
          call UnitDamageTargetBJ(cast,u,dam,ATTACK_TYPE_HERO,DAMAGE_TYPE_UNIVERSAL)
        endif
    endloop
    
    set g = null
    set u = null
    set cast = null
    set p = null
endfunction

function InitTrig_IC takes nothing returns nothing
   local trigger t
   set t = CreateTrigger()
   call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
   call TriggerAddCondition(t, Condition(function ICcond))
   call TriggerAddAction(t, function ICact)
endfunction

bác nào xem giúp e trigger có sai chỗ nào mà k có tác dụng k ạ. (Tạo 1 effect ngay tại vị trí cast và gây damage, A000 là base spell từ Rain Of Fire), và có thể sữa giúp e là tạo ngẫu nhiên 1 effect trong phạm vi cast spell đó 500, tks trước.

@Goldvipder: e k hỉu ý bác lắm @@ (Sr còn gà)
 
Mã:
function ICcond takes nothing returns boolean
   return GetSpellAbilityId()=='A000'
endfunction

function ICact takes nothing returns nothing
   local unit cast
   local unit u
   local group g
   local string sfx
   local location p
   local real dam
   
   set cast = GetTriggerUnit()
   set p = GetSpellTargetLoc()
   set g = GetUnitsInRangeOfLocAll(400.00,p)
   set dam = 60.00+(40.00*I2R(GetUnitAbilityLevelSwapped('A000',cast)))
   set sfx = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
   loop 
       set u = FirstOfGroup(g)
       exitwhen u==null
       call AddSpecialEffectLoc(sfx,p)
       call DestroyEffect(GetLastCreatedEffectBJ())
       if [B]IsUnitEnemy(u, GetOwningPlayer(cast))==true[/B] then
          [B]call GroupRemoveUnit(g,u)[/B]
          call UnitDamageTargetBJ(cast,u,dam,ATTACK_TYPE_HERO,DAMAGE_TYPE_UNIVERSAL)
        endif
    endloop
    
    set g = null
    set u = null
    set cast = null
    set p = null
endfunction

Lâu rồi không đụng vào mà nhìn hình như có cái bị sai phải không nhỉ, giả sử có 1 con Unit nào đó trong Group không thỏa điều kiện, thì sẽ không bị loại khỏi Group, vậy thì vòng lặp này vô tận rùi. Bạn nên để dòng call GrouprRemoveUnit... ở ngoài if
 
Mã:
function ICcond takes nothing returns boolean
   return GetSpellAbilityId()=='A000'
endfunction

function ICact takes nothing returns nothing
   local unit cast
   local unit u
   local group g
   local string sfx
   local location p
   local real dam
   
   set cast = GetTriggerUnit()
   set p = GetSpellTargetLoc()
   set g = GetUnitsInRangeOfLocAll(400.00,p)
   set dam = 60.00+(40.00*I2R(GetUnitAbilityLevelSwapped('A000',cast)))
   set sfx = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
   loop 
       set u = FirstOfGroup(g)
       exitwhen u==null
       call AddSpecialEffectLoc(sfx,p)
       call DestroyEffect(GetLastCreatedEffectBJ())
       if IsUnitEnemy(u, GetOwningPlayer(cast))==true then
          call GroupRemoveUnit(g,u)
          call UnitDamageTargetBJ(cast,u,dam,ATTACK_TYPE_HERO,DAMAGE_TYPE_UNIVERSAL)
        endif
    endloop
    
    set g = null
    set u = null
    set cast = null
    set p = null
endfunction

function InitTrig_IC takes nothing returns nothing
   local trigger t
   set t = CreateTrigger()
   call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
   call TriggerAddCondition(t, Condition(function ICcond))
   call TriggerAddAction(t, function ICact)
endfunction

bác nào xem giúp e trigger có sai chỗ nào mà k có tác dụng k ạ. (Tạo 1 effect ngay tại vị trí cast và gây damage, A000 là base spell từ Rain Of Fire), và có thể sữa giúp e là tạo ngẫu nhiên 1 effect trong phạm vi cast spell đó 500, tks trước.

@Goldvipder: e k hỉu ý bác lắm @@ (Sr còn gà)

Sao tạo effect ở location p trong Loop làm gì cho lag ?
Còn muốn tạo effect ngẫu nhiên thì


Mã:
local real x
local real y
local string sfx= ""
local location p=GetSpellTargetLoc()
real x=GetLocationX(p)+GetRandomReal(0,500)*Cos(GetRandomReal(0,360)*bj_DEGTORAD)
real y=GetLocationY(p)+GetRandomReal(0,500)*Sin(GetRandomReal(0,360)*bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(sfx,x,y))
 
@NGoc Leo:
Mã:
function ICcond takes nothing returns boolean
   return GetSpellAbilityId()=='A000'
endfunction

function ICact takes nothing returns nothing
   local unit cast
   local unit u
   local group g
   local string sfx
   local location p
   local real dam
   local real x
   local real y
   
   set cast = GetTriggerUnit()
   set p = GetSpellTargetLoc()
   set x = GetLocationX(p)+GetRandomReal(0,400)*Cos(GetRandomReal(0,360)*bj_DEGTORAD)
   set y = GetLocationY(p)+GetRandomReal(0,400)*Sin(GetRandomReal(0,360)*bj_DEGTORAD)
   set g = GetUnitsInRangeOfLocAll(400.00,p)
   set dam = 60.00+(40.00*I2R(GetUnitAbilityLevelSwapped('A000',cast)))
   set sfx = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
   call DestroyEffect(AddSpecialEffect(sfx,x,y))
   loop 
       set u = FirstOfGroup(g)
       exitwhen u==null
       if IsUnitEnemy(u, GetOwningPlayer(cast))==true then
          call UnitDamageTargetBJ(cast,u,dam,ATTACK_TYPE_HERO,DAMAGE_TYPE_UNIVERSAL)
        endif
      call GroupRemoveUnit(g,u)
    endloop
    
    set g = null
    set u = null
    set cast = null
    set p = null
endfunction

function InitTrig_IC takes nothing returns nothing
   local trigger t
   set t = CreateTrigger()
   call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST )
   call TriggerAddCondition(t, Condition(function ICcond))
   call TriggerAddAction(t, function ICact)
endfunction

m` sửa lại thành như vầy, nhưng vào test thử thì k có chuyện j` xảy ra @@
 
@NGoc Leo:
Mã:
function ICcond takes nothing returns boolean
   return GetSpellAbilityId()=='A000'
endfunction

function ICact takes nothing returns nothing
   local unit cast
   local unit u
   local group g
   local string sfx
   local location p
   local real dam
   local real x
   local real y
   
   set cast = GetTriggerUnit()
   set p = GetSpellTargetLoc()
   set x = GetLocationX(p)+GetRandomReal(0,400)*Cos(GetRandomReal(0,360)*bj_DEGTORAD)
   set y = GetLocationY(p)+GetRandomReal(0,400)*Sin(GetRandomReal(0,360)*bj_DEGTORAD)
   set g = GetUnitsInRangeOfLocAll(400.00,p)
   set dam = 60.00+(40.00*I2R(GetUnitAbilityLevelSwapped('A000',cast)))
   set sfx = "Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
   call DestroyEffect(AddSpecialEffect(sfx,x,y))
   loop 
       set u = FirstOfGroup(g)
       exitwhen u==null
       if IsUnitEnemy(u, GetOwningPlayer(cast))==true then
          call UnitDamageTargetBJ(cast,u,dam,ATTACK_TYPE_HERO,DAMAGE_TYPE_UNIVERSAL)
        endif
      call GroupRemoveUnit(g,u)
    endloop
    
    set g = null
    set u = null
    set cast = null
    set p = null
endfunction

function InitTrig_IC takes nothing returns nothing
   local trigger t
   set t = CreateTrigger()
   call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST )
   call TriggerAddCondition(t, Condition(function ICcond))
   call TriggerAddAction(t, function ICact)
endfunction

m` sửa lại thành như vầy, nhưng vào test thử thì k có chuyện j` xảy ra @@

Sorry,bạn phải tạo 2 biến để lưu GetRandomReal,còn muốn tạo nhiều effect thì bạn phải dùng loop

Mã:
local real x
local real y
local string sfx= ""
local location p=GetSpellTargetLoc()
local real ra=GetRandomReal(0,500)
local real rb=GetRandomReal(0,360)
real x=GetLocationX(p)+ra*Cos(rb*bj_DEGTORAD)
real y=GetLocationY(p)+ra*Sin(rb*bj_DEGTORAD)
call DestroyEffect(AddSpecialEffect(sfx,x,y))
 
@Ngoc Leo: e bó tay @@, ngồi fix mà cũng k đc, vào test k có tác dụng. Bác làm demo giúp e spell trên đc k?
Base từ Rain Of Fire hay skill j mà AOE cũng đc, khi cast thì cast liên tục 1 effect (các effect giản cách 0.1s) trong 1 fạm vi 400, gây sát thương. Tks bác
 
Bác nào giúp mình cái này nhé:
-Hiện damage của skill (giống như hiện damage của đòn tấn công thông thường ấy)
-Khi Hero vào Region nào đấy thì hiện ra text "Wellcome to..." , mình chưa tìm thấy cái Action nào ghép vào hợp lý cả :(

Mã:
Melee Initialization
    Events
        Unit - A unit enters (Current camera bounds)
    Conditions
    Actions
        Game - Display to (All players) the text: Welcome to abc!
 
@Ngoc Leo: e bó tay @@, ngồi fix mà cũng k đc, vào test k có tác dụng. Bác làm demo giúp e spell trên đc k?
Base từ Rain Of Fire hay skill j mà AOE cũng đc, khi cast thì cast liên tục 1 effect (các effect giản cách 0.1s) trong 1 fạm vi 400, gây sát thương. Tks bác
Demo:http://www.mediafire.com/?ywbfp6vy3fybxh8
Mã:
library Spell initializer init requires TimerUtils,GroupUtils
   globals
      private integer     SpellId       ='A000'
      private real        SpellAoe      =400
      private real        SpellSpeed    =0.1
      private real        SpellDur      =4
      private real array  SpellDamage
      private string      SpellSfx      ="Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl"
      private player      TempPlayer
   endglobals
   private function GetSpellDamage takes integer level returns real
      return I2R(level)*50
   endfunction
   struct Spell
      unit u
      real x
      real y
      real tik
      integer level
      method stop takes nothing returns nothing
         set.u=null
         call.destroy()
      endmethod
      method Effect takes nothing returns nothing
         local real x
         local real y
         local real r=GetRandomReal(0,SpellAoe)
         set x=.x+r*Cos(r*bj_DEGTORAD)
         set y=.y+r*Sin(r*bj_DEGTORAD)
         call DestroyEffect(AddSpecialEffect(SpellSfx,x,y))
      endmethod
      static method Check takes nothing returns boolean
         local boolean b=true
         local unit u=GetFilterUnit()
         set b=b and GetWidgetLife(u)>.405
         set b=b and IsUnitType(u,UNIT_TYPE_STRUCTURE)==false
         set b=b and IsUnitEnemy(u,TempPlayer)
         set u=null
         return b
      endmethod
      method Damage takes nothing returns nothing
         local group g=NewGroup()
         local unit u
         set TempPlayer=GetOwningPlayer(.u)
         call GroupEnumUnitsInArea(g,.x,.y,SpellAoe,Condition(function thistype.Check))
         loop
            set u=FirstOfGroup(g)
            exitwhen u==null
            call UnitDamageTarget(.u,u,GetSpellDamage(.level),true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_MAGIC,null)
            call GroupRemoveUnit(g,u)
            set u=null
         endloop
         call ReleaseGroup(g)
         set TempPlayer=null
         set g=null
         set u=null
      endmethod
      static method Loop takes nothing returns nothing
         local timer ti=GetExpiredTimer()
         local thistype this=GetTimerData(ti)
         set.tik=.tik-1
         if.tik<=0then
            call ReleaseTimer(ti)
            call.stop()
         else
            call.Effect() 
            call.Damage()
         endif
         set ti=null
      endmethod      
      static method Create takes unit u,real x,real y returns thistype
         local thistype this=thistype.allocate()
         local timer ti=NewTimer()
         set.u=u
         set.x=x
         set.y=y
         set.level=GetUnitAbilityLevel(.u,SpellId)
         set.tik=SpellDur/SpellSpeed
         call SetTimerData(ti,this)
         call TimerStart(ti,SpellSpeed,true,function thistype.Loop)
         set ti=null
         return this
      endmethod
   endstruct
   private function Cd takes nothing returns boolean
      if GetSpellAbilityId()==SpellId then
         call Spell.Create(GetSpellAbilityUnit(),GetSpellTargetX(),GetSpellTargetY())
      endif
      return false
   endfunction   
   private function init takes nothing returns nothing
      local integer i=0
      local trigger t=CreateTrigger()
      loop
         if GetPlayerSlotState(Player(i))==PLAYER_SLOT_STATE_PLAYING then
            call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
         endif
         set i=i+1
         exitwhen i==bj_MAX_PLAYER_SLOTS
      endloop
      call TriggerAddCondition(t,function Cd)
      set t=null
   endfunction
endlibrary
 
Anh nào biết cái trigger biến hình trong legend of the dragon thì chỉ giúp em với. VD : Em có Item Beam hoặc những item khác thì khi hero đi vào cái region đó thì sẽ biến thành hero mới và có một dòng chữ hiện ra như là : Bạn đã chọn tướng mới là Beam hay gì đó. Ai bik thì chỉ giúp em với tại cái đó em ko bik làm như thế nào:9cool_haha:
 
Mã:
Melee Initialization
    Events
        Unit - A unit enters (Current camera bounds)
    Conditions
    Actions
        Game - Display to (All players) the text: Welcome to abc!
Bạn hiểu nhầm ý mình rồi. Chỉ hiện text cho Player của Triggering unit thôi :))
Mình toàn thấy cho All players hoặc Group nên chả biết làm thế nào cả.
 
Bạn hiểu nhầm ý mình rồi. Chỉ hiện text cho Player của Triggering unit thôi :))
Mình toàn thấy cho All players hoặc Group nên chả biết làm thế nào cả.

Mã:
function Msg takes player p , string s returns nothing
    local force f = GetForceOfPlayer(p)
    call DisplayTextToForce( f, s )
    call DestroyForce(f)
endfunction
Muốn hiện player nào thì viết thêm dòng này vào trigger

Mã:
call Msg(Player,"Welcome to ......")
 
Anh nào biết cái trigger biến hình trong legend of the dragon thì chỉ giúp em với. VD : Em có Item Beam hoặc những item khác thì khi hero đi vào cái region đó thì sẽ biến thành hero mới và có một dòng chữ hiện ra như là : Bạn đã chọn tướng mới là Beam hay gì đó. Ai bik thì chỉ giúp em với tại cái đó em ko bik làm như thế nào:9cool_haha:
Có cái action là replace hero mới thay thế hero cũ đó,condition là trong người có item đó và đi vào khu vực đó :D.Cái dòng chữ hiện ra để vào dưới cùng của action nữa :)).Thử mò mà làm koi đc ko nha
 
@Ngoc LeO: bác cho e xin cái Y!H hay facebook đc hk? còn vài thắc mắc muốn hỏi. tks

Cho e hỏi: Là làm sao để nào sử dụng every xx time trong jass ???
 
@Ngoc LeO: bác cho e xin cái Y!H hay facebook đc hk? còn vài thắc mắc muốn hỏi. tks

Cho e hỏi: Là làm sao để nào sử dụng every xx time trong jass ???

Mã:
call TriggerRegisterTimerEventPeriodic( which trigger , which periodic time )
 
Cho mình hỏi các trigger này có cái nào leak ko ? Đánh 20p, lên một chỗ nhất định là lag vãi. Nghi nhất là mấy em này :5cool_sweat:
Mã:
Initialization
    Events
        Map initialization
    Conditions
    Actions
        Custom script:   set bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
            Loop - Actions
                Set Integer = (Integer + 1)
                Set Creep_Loc[Integer] = (Position of (Picked unit))
                Set Creep_Face_Ang[Integer] = (Facing of (Picked unit))
                Unit - Set the custom value of (Picked unit) to Integer
        Destructible - Pick every destructible in (Entire map) and do (Trigger - Add to Revive Trees <gen> the event (Destructible - (Picked destructible) dies))

Mã:
Revive Creeps
    Events
        Unit - A unit Dies
    Conditions
        ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
    Actions
        Wait (Random real number between 5.00 and 20.00) seconds
        Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at Creep_Loc[(Custom value of (Triggering unit))] facing Creep_Face_Ang[(Custom value of (Triggering unit))] degrees
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))

Mã:
Revive Trees
    Events
    Conditions
    Actions
        Wait 15.00 seconds
        Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation
 
Cho mình hỏi các trigger này có cái nào leak ko ? Đánh 20p, lên một chỗ nhất định là lag vãi. Nghi nhất là mấy em này :5cool_sweat:
Mã:
Initialization
    Events
        Map initialization
    Conditions
    Actions
        Custom script:   set bj_wantDestroyGroup = true
        Unit Group - Pick every unit in (Units in [B](Playable map area)[/B] owned by Neutral Hostile) and do (Actions)
            Loop - Actions
                Set Integer = (Integer + 1)
                Set Creep_Loc[Integer] = [B](Position of (Picked unit))[/B]
                Set Creep_Face_Ang[Integer] = (Facing of (Picked unit))
                Unit - Set the custom value of (Picked unit) to Integer
        Destructible - Pick every destructible in [B](Entire map)[/B] and do (Trigger - Add to Revive Trees <gen> the event (Destructible - (Picked destructible) dies))

Mã:
Revive Creeps
    Events
        Unit - A unit Dies
    Conditions
        ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
    Actions
        Wait (Random real number between 5.00 and 20.00) seconds
        Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at [B]Creep_Loc[(Custom value of (Triggering unit))][/B] facing Creep_Face_Ang[(Custom value of (Triggering unit))] degrees
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))

Mã:
Revive Trees
    Events
    Conditions
    Actions
        Wait 15.00 seconds
        Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation

Leak,trigger thứ hai dùng point xong cũng chưa remove
 
Back
Top