• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] I have problem with my spell help plz!!

Status
Not open for further replies.
Level 5
Joined
Jan 4, 2009
Messages
118
JASS:
function Liquid_Fire_Trap_Actions takes nothing returns nothing
    local unit u = udg_DrinkingMaster
    local unit trap = GetDyingUnit()
    local unit dummy
    local integer i = GetUnitAbilityLevel(u, 'A042')
        
    if(GetUnitTypeId(GetDyingUnit()) == 'n002' ) then
        set dummy = CreateUnit(GetOwningPlayer(u), 'n002', GetUnitX(trap), GetUnitY(trap), 0)
        call UnitAddAbility(dummy, 'A043')
        call IssuePointOrder(dummy, "flamestrike", GetUnitX(trap), GetUnitY(trap))
        call SetUnitAbilityLevel(dummy, 'A043', i)
        call UnitApplyTimedLife(dummy, 'BTLF', 1.5)  
    endif
        
    set u = null
    set dummy = null
    set trap = null  
endfunction

function InitTrig_Liquid_Fire_Trap takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddAction(t, function Liquid_Fire_Trap_Actions)
    set t = null
endfunction

When I cast this spell. It's will work infinite loop Create unit and Order 1 2 3 time and more not stop...

Why? help me plz!!
 
Level 4
Joined
Dec 3, 2011
Messages
35
ALTELMA, troll) try it:

JASS:
function LiquidFireA takes nothing returns nothing
    local unit a = GetDyingUnit()
    local unit e = CreateUnit(GetOwningPlayer(udg_DrinkingMaster), 'n002', GetUnitX(a), GetUnitY(a), 0)
    call UnitAddAbility(e,'A043')
    call IssuePointOrder(e,"flamestrike", GetUnitX(a), GetUnitY(a))
    call SetUnitAbilityLevel(e,'A043',GetUnitAbilityLevel(udg_DrinkingMaster,'A042'))
    call UnitApplyTimedLife(e,'BTLF',1.5)  
    call SetUnitUserData(e,1)
    set e = null
    set a = null
endfunction

function LiquidConditon takes nothing returns boolean
    if (GetUnitTypeId(GetDyingUnit()) == 'n002') then
        if GetUnitUserData(GetDyingUnit()) != 1 then
            call LiquidFireA()
        endif
    endif
    return false
endfunction

function InitTrig_Liquid_Fire_Trap takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddCondition(t,Condition(function LiquidConditon))
    set t = null
endfunction

and learn cJass, its easy
JASS:
nothing LiquidFireA (unit u) {
   real x = GetUnitX(u), y = GetUnitY(u)
   unit e = CreateUnit(GetOwningPlayer(udg_DrinkingMaster),'n002',x,y,0)
   UnitAddAbility(e,'A043')
   IssuePointOrder(e,"flamestrike",x,y)
   SetUnitAbilityLevel(e,'A043',GetUnitAbilityLevel(udg_DrinkingMaster,'A042'))
   UnitApplyTimedLife(e,'BTLF',1.)  
   SetUnitUserData(e,1)
   e = null
}

boolean LiquidConditon (nothing) {
   unit u = GetDyingUnit()
   if GetUnitTypeId(u) == 'n002' {
      if GetUnitUserData(u) != 1 {
         LiquidFireA(u)
      }
   }
   u = null; return false
}

nothing InitTrig_Liquid_Fire_Trap (nothing) {
   trigger t = CreateTrigger()
   TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
   TriggerAddCondition(t,Condition(function LiquidConditon))
   t = null
}

Dummy kill system(use it):

JASS:
define {
    dummyID = 'hfoo'
}

boolean DummyEnter (nothing) {
    unit u = GetEnteringUnit()
    if GetUnitTypeId(u) == dummyID {
        SetUnitInvulnerable(u,true)
        UnitApplyTimedLife(u,0x42487765,2.)
        ShowUnit(u,false)
        SetUnitPathing(u,false)
    }
    u = null; return false
}

nothing InitTrig_dummyfilter (nothing) {
    trigger t = CreateTrigger()
    region a = CreateRegion()
    RegionAddRect(a,bj_mapInitialPlayableArea)
    TriggerRegisterEnterRegion(t,a,null)
    TriggerAddCondition(t,Condition(function DummyEnter))
    t = null; a = null
}
 
Last edited by a moderator:
Status
Not open for further replies.
Top