• 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.

[JASS] GAS Bomb ...AGain ..

Status
Not open for further replies.
Hi guys, I know we all must be tired from seeing this post but fact is .. I am having problem once more ... Now because I lost O2 and Wolf's codes, when can just say I am in a crappy situation.

Now do the following code works .. for the first second only !! and I don't know why again ... ca you guys help me again plz ?

JASS:
function GasBomb_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'h000'  
endfunction
//==========================================================
function GasBomb_Effect takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit bomb = GetHandleUnit(t, "bomb")
    local group g = CreateGroup()
    local unit f 
    local player p = GetOwningPlayer(bomb) 
    local unit dum
    call GroupEnumUnitsInRange( g, GetUnitX( bomb ), GetUnitY( bomb ), 250, Filter(null) )  
    loop  
        set f = FirstOfGroup(g)  
        exitwhen (f == null)  
        call GroupRemoveUnit(g,f)
        if IsUnitEnemy(f, p) then  
            set dum = CreateUnit(p, 'h007', GetUnitX(f), GetUnitY(f), 0)  
            call UnitAddAbility(dum, 'A007')  
            call IssueTargetOrder(dum, "shadowstrike", f)  
            call UnitApplyTimedLife(dum, 'BTLF', 1.5)
        endif     
    endloop
    call DestroyGroup(g)
    set g = null
    set t = null
    set p = null
    set bomb = null
    set dum = null
endfunction
//=========================================================
function GasBomb_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real uX = GetUnitX(u)
    local real uY = GetUnitY(u)
    local player p = GetOwningPlayer(u)
    local timer t = CreateTimer()
    local unit eff = CreateUnit(p, 'h008', uX, uY, 0)
    call UnitApplyTimedLife(eff, 'BTLF', 10)
  
    call SetHandleHandle(t, "bomb", u)
    call TimerStart(t, 1.0, true, function GasBomb_Effect)
    call TriggerSleepAction(10.0)
    
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    set u = null
    set p = null
    set t = null
    set eff = null
endfunction
//===========================================================================
function InitTrig_GasBombs takes nothing returns nothing
    set gg_trg_GasBombs = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_GasBombs, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_GasBombs, Condition( function GasBomb_Conditions))
    call TriggerAddAction( gg_trg_GasBombs, function GasBomb_Actions  )
endfunction

It uses Katana's Handle System, but I think it is very easy to understand.
If some1 could help again =S
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
And yet again can't find any problem... maybe another bug or something like that lol.

If you want my code again its here (atleast I think its the right one).
JASS:
function NewTriggerConditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'h000'
endfunction
function NewTriggerTimerActions takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit whichUnit = GetHandleUnit(t, "whichUnit")
    local unit u
    local unit dummyOne
    local unit dummyTwo
    local real x = GetHandleReal(t, "x")
    local real y = GetHandleReal(t, "y")
    local group g = CreateGroup()
    call UnitDamagePoint(whichUnit, 0, 200, x, y, 30, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
    call GroupEnumUnitsInRange(g, x, y, 200, null)
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call GroupRemoveUnit(g, u)
        if IsUnitEnemy(u, GetOwningPlayer(whichUnit)) and GetWidgetLife(u) > 0.4 then
            set dummyOne = CreateUnit(GetOwningPlayer(whichUnit), 'h001', x, y, 0)
            set dummyTwo = CreateUnit(GetOwningPlayer(whichUnit), 'h001', x, y, 0)
            call IssueTargetOrder(dummyOne, "curse", u)
            call IssueTargetOrder(dummyTwo, "slow", u)
            call UnitApplyTimedLife(dummyOne, 'BTLF', .5)
            call UnitApplyTimedLife(dummyTwo, 'BTLF', .5)
        endif    
    endloop
    set dummyOne = null
    set dummyTwo = null
    call DestroyGroup(g)
    set t = null
    set whichUnit = null
    set g = null
endfunction
function NewTriggerActions takes nothing returns nothing
    local timer t = CreateTimer()
    local unit whichUnit = GetTriggerUnit()
    local real x = GetUnitX(whichUnit)
    local real y = GetUnitY(whichUnit)
    local effect e = AddSpecialEffect("Abilities\\Weapons\\LordofFlameMissile\\LordofFlameMissile.mdl", x, y)
    call SetHandleHandle(t, "whichUnit", whichUnit)
    call SetHandleReal(t, "x", x)
    call SetHandleReal(t, "y", y)
    call TimerStart(t, 1, true, function NewTriggerTimerActions)
    call TriggerSleepAction(10)
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    call DestroyEffect(e)
    set whichUnit = null 
    set t = null
    set e = null
endfunction
//==== Init Trigger NewTrigger ====
function InitTrig_NewTrigger takes nothing returns nothing
    set gg_trg_NewTrigger = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( gg_trg_NewTrigger, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition(gg_trg_NewTrigger, Condition(function NewTriggerConditions))
    call TriggerAddAction(gg_trg_NewTrigger, function NewTriggerActions)
endfunction
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Lost my code ?
To All: As you can see, this is what it happens when you lose one of my knowladge products

it should work if Bomb does decay
My suggestion: Attach eff as damager instead of u
And check for raw codes, orders, mana costs (lol)

Optional Suggestions: Repleace Filter(null) with null, Create Group in start, store it in handle, use it in timer without destroying it inside
local group g = GetHandleGroup(timer,g) <ENTER> GroupEnumUnitsInRange(g,............) <ENTER> Loop thingies <ENTER> set g = null // without destroying
And Destroy Group at where you destroy Timer
 
Last edited:
Crap... Wolf I tested two of your codes yesterday and they didn't work.
Also, the problem is not in the Object Editor, the death time of the bomb is fine.

O2 !!! Your suggestions didn't solve anything ... I just need your code once ,more =S
Also, I will try that group thing, but I don't know if it will work, if I din''t destroy the timer there, and nullify the links there, where will I do it ?
 
Level 9
Joined
Mar 25, 2005
Messages
252
Oh 1 thing you should always check is if a timer recycler solves the problem. Timer recycler == Vexorian's 'CSSafety' or Cohadar's 'Recycler'. Incase you dont already know here is how to use them:
  • get a timer recycler script
  • replace all CreateTimer() calls with NewTimer() and all DestroyTimer(t) calls with PauseTimer(t) + ReleaseTimer(t)
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
local group a = CreateGroup()
Attach a to timer
local group g = attached group // inside timer
null g in timer

DestroyTimer
DestroyGroup(a)
set a = null

And store eff instead of u = WIN or check rawcodesNstuff

And run msn sometimes >.<
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Oh 1 thing you should always check is if a timer recycler solves the problem. Timer recycler == Vexorian's 'CSSafety' or Cohadar's 'Recycler'. Incase you dont already know here is how to use them:
  • get a timer recycler script
  • replace all CreateTimer() calls with NewTimer() and all DestroyTimer(t) calls with PauseTimer(t) + ReleaseTimer(t)

it has nothing to do with it

DOUBLE POST !!!! ownage
Level 100 Ralle has been fall3n
 
O2, I don't understand a bit of what you say ..
please specify it ...

EDIT


Today I decided to re-do the code. But it still doesn't work, and the bug it's the same. It seems that nothing is able to solve this dam bug.

Here is the code, for those who want to see it:

JASS:
function GasBomb_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'h000'  
endfunction
//==========================================================
function GasBomb_Effect takes nothing returns nothing
    local unit u = GetEnumUnit() 
    local player p = GetOwningPlayer(GetTriggerUnit()) 
    local unit dum
    
    if IsUnitEnemy(u, p) then
        set dum = CreateUnit(p, 'h007', GetUnitX(u), GetUnitY(u), 0)  
        call UnitAddAbility(dum, 'A007')  
        call IssueTargetOrder(dum, "shadowstrike", u)  
        call UnitApplyTimedLife(dum, 'BTLF', 1.5)
    endif
    
    set u = null
    set p = null
    set dum = null
endfunction
//=========================================================
function GasBomb_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real uX = GetUnitX(u)
    local real uY = GetUnitY(u)
    local player p = GetOwningPlayer(u)
    local unit eff = CreateUnit(p, 'h008', uX, uY, 0)
    local integer i = 0
    local group g 
     
    call UnitApplyTimedLife(eff, 'BTLF', 10)
  
    loop
        exitwhen (i > 10)
        call GroupEnumUnitsInRange( g, uX, uY, 250, Filter(null) )
        call ForGroup( g, function GasBomb_Effect )
        call TriggerSleepAction(1.00 )
        set i = i + 1
    endloop

    call DestroyGroup(g)
    set g = null
    set u = null
    set p = null
    set eff = null
endfunction
//===========================================================================
function InitTrig_GasBombs takes nothing returns nothing
    set gg_trg_GasBombs = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_GasBombs, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_GasBombs, Condition( function GasBomb_Conditions))
    call TriggerAddAction( gg_trg_GasBombs, function GasBomb_Actions  )
endfunction


Also, if you find anyway to solve the bug, I would like to know it plz.

EDIT , MEGA EDIT, SUPER EDIT, COMBO EDITATION !!!

GUYSSS, I finally managed to fix that stupid bug !! All I had to do was use an inner loop, thing I tried at first, but didn't work. However now it works !!
And does my map !!

BEHOLD, MY GAS BOMB !!!
Plz enjoy it !! it is not 100% done yet, but I have a strange feeling you will find it quite funny =)
 

Attachments

  • JAss Plane !.w3x
    121.4 KB · Views: 103
Status
Not open for further replies.
Top