• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[JASS] Fire Bomber

Status
Not open for further replies.
You are correct.
I implemented your code into the actions of my code, but i did a small optimization (replaced a BJ lol).

Now my code works greatly =)

I am still working on the other changes.
If you find anything else, please let me know.

Btw, here is the code I am using now:
[jass=New code version]
globals
trigger gg_trg_Bomber
endglobals
//=============================================================
function Trig_Bomber_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
//=============================================================
function Trig_Bomber_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local location loc = GetSpellTargetLoc()
local location lc = GetUnitLoc(caster)
local real angle = (180.0 / 3.14159) * Atan2(GetLocationY(loc) - GetLocationY(lc), GetLocationX(loc) - GetLocationX(lc))
local real X = GetLocationX(loc)
local real Y = GetLocationY(loc)
local player p = GetOwningPlayer(caster)
local unit bomb
local integer fade = 0
local real height
local integer bombcounter = 0
local real heightbomb

local unit bomber = CreateUnit(p, 'h002', X - 1450 * Cos(angle * (3.14159 / 180.0)), Y - 1450 * Sin(angle * (3.14159 / 180.0)), angle)

call SetUnitVertexColor(bomber, 255, 255, 255, fade)
set height = GetUnitFlyHeight(bomber)

call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))

loop
exitwhen(fade >= 255)
call TriggerSleepAction(0.1)
call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
set fade = fade + 30
call SetUnitVertexColor(bomber, 255, 255, 255, fade)
endloop

loop
exitwhen(height <= 450)
set height = height - 50
call SetUnitFlyHeight(bomber, height, 80)
call TriggerSleepAction(0.3)
call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
endloop

call TriggerSleepAction(0.6)
call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
loop
exitwhen(bombcounter == 6)
call IssuePointOrder( bomber, "move", X + 700 * Cos(angle * (3.14159 / 180.0)), Y + 700 * Sin(angle * (3.14159 / 180.0)))
set bomb = CreateUnit(p, 'h003', GetUnitX(bomber), GetUnitY(bomber), 270.0)
call SetUnitFlyHeight(bomb, height, 0)
set heightbomb = height
call UnitApplyTimedLife( bomb,'BHwe', 3)
loop
exitwhen(heightbomb <= 0)
set heightbomb = heightbomb - 100
call SetUnitFlyHeight(bomb, heightbomb, 140)
endloop
set bombcounter = bombcounter + 1
call TriggerSleepAction(0.25)
endloop

call IssuePointOrder( bomber, "move", X + 2000 * Cos(angle * (3.14159 / 180.0)), Y + 2000 * Sin(angle * (3.14159 / 180.0)))
call TriggerSleepAction(0.2)

loop
exitwhen(height >= 600)
set height = height + 50
call SetUnitFlyHeight(bomber, height, 100)
call TriggerSleepAction(0.2)
endloop

loop
exitwhen(fade <= 0)
call TriggerSleepAction(0.1)

set fade = fade - 30
call SetUnitVertexColor(bomber, 255, 255, 255, fade)
endloop

call ShowUnit(bomber, false)
call KillUnit(bomber)
call RemoveLocation(loc)
call RemoveLocation(lc)

set lc = null
set loc = null
set bomber = null
set bomb = null
set caster = null
set p = null
endfunction
//===========================================================================
function InitTrig_Bomber takes nothing returns nothing
set gg_trg_Bomber = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bomber, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Bomber, Condition( function Trig_Bomber_Conditions ) )
call TriggerAddAction( gg_trg_Bomber, function Trig_Bomber_Actions )
endfunction[/code]
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
use bj_DEGTORAD, bj_RADTODEG, they are faster then what you are doing and less kb because of character count

and explain what is "local location lc = GetUnitLoc(caster)" for
call ShowUnit(bomber, false) - call KillUnit(bomber) ?
JUST REMOVE
 
Hã !??
So you are telling me to replace the expression (180.0/3.14159) by bj_DEGTORAD rit !? i guess this is one of those exceptions in which the BJ is faster ...
I will replace it soon.

About the other thing you are trying to tell me, i don't understand a single word of what you say. Please explain yourself better.

Now behold, My new improved map (lol).
In this version I did several changes:
1 - Reduced number of bombs from 6 to 5
2 - Separated spells. Now instead of 1 spell, We have 2 spells: incendiary bombs and explosion bombs.
3 - Added angle by using Wolf's suggestion (now I use Atan2 and his code).
4 - Added a level up to the hero, as well as a revive trigger
5 - Added decent tooltips about the spells
6 - Now the Incendiary bomber causes less lag (I hope) because I replaced an effect with a dummy unit, and so I can nullify all variables 20 seconds faster.

Hope you like this version. And Plz report Bugs or anything that is not working properly !!!!
 

Attachments

  • Plane !.w3x
    96.6 KB · Views: 60
Level 19
Joined
Aug 24, 2007
Messages
2,888
it doesnt mean that its a bj so it lags
its a global variable
like udg_something
udg = User Declared Global
bj = Blizzard.j
bj_DEGTORAD, bj_RADTODEG are globals, constant globals which are FAST

Hide and kill ?
call RemoveUnit(bomber) :/

I downloaded the map and will check when I get home
 
MM, so you mean that BJ_degtorad is a constant variable, and that's why it is faster ?? Wow, that was the explanation I wanted to hear thx (+rep)

About Hide and kill. well yea =) I hide the plane, I then I kill him, silently... :smile: , so no one knows his died and never returned home (MUHAHAHHA lol).
About the remove unit, well, didn't remembered that when I was making the spell. But I will change that.

So, the changes I am going to make are (for now):
1 - Use that Bj_degtoRad
2 - use remove unit instead of hide unit and then kill unit.

Still, any more suggestions about the spells ?
 
Guys, I am having a serious problem with making stupid gas bombs explode....
I am so desperate that I ... that .. BEHOLD, my first spell using katan's something something !! and you know what ? It doesn't work !!
Please tell me what's wrong:

JASS:
function Trig_GasBombs_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'h000'
endfunction
//==========================================================
function GasEffect takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit bomb = GetHandleUnit(t, "bomb")
    local location l = GetUnitLoc(bomb)
    local group g = GetUnitsInRangeOfLocAll(250, l)
    local unit f
    local unit array dummy
    local player owner = GetOwningPlayer(bomb)
    loop
        exitwhen (f == null)
        set f = FirstOfGroup(g)
        if IsUnitEnemy(f, owner) and GetUnitState(f, UNIT_STATE_LIFE) > 0.405 and IsUnitType(f, UNIT_TYPE_STRUCTURE) == false then
            set dummy[0] = CreateUnit(owner, 'h001', GetUnitX(bomb), GetUnitY(bomb), 0.0)
            set dummy[1] = CreateUnit(owner, 'h001', GetUnitX(bomb), GetUnitY(bomb), 0.0)
            call UnitAddAbility(dummy[0], 'A002')
            call UnitAddAbility(dummy[1], 'A004')
            call IssueTargetOrder(dummy[0], "curse", f)
            call IssueTargetOrder(dummy[1], "slow", f)
            call UnitApplyTimedLife(dummy[0], 'BTLF', 1)
            call UnitApplyTimedLife(dummy[1], 'BTLF', 1)
        endif
        call GroupRemoveUnit(g, f)
    endloop
    call DestroyGroup(g)
    call RemoveLocation(l)
    set g = null
    set l = null
    set t = null
    set bomb = null
    set dummy[0] = null
    set dummy[1] = null
    set owner = null
endfunction
//==========================================================
function Trig_GasBombs_Actions takes nothing returns nothing
    local unit bomb = GetDyingUnit()
    local integer duration = 0
    local effect e  = AddSpecialEffect("war3mapImported\\Radioactivecloud.mdx", GetUnitX(bomb), GetUnitY(bomb))
    local timer t = CreateTimer()
    call SetHandleHandle(t, "bomb", bomb)
    
    loop
        exitwhen (duration == 10)
        call TimerStart(t, 1.0, true, function GasEffect)
        set duration = duration + 1
    endloop
    
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    call DestroyEffect(e)
    set e = null
    set t = null
    set bomb = null
endfunction
//==========================================================
function InitTrig_Gas_Bombs takes nothing returns nothing
    set gg_trg_Gas_Bombs = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Gas_Bombs, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Gas_Bombs, Condition( function Trig_GasBombs_Conditions ) )
    call TriggerAddAction( gg_trg_Gas_Bombs, function Trig_GasBombs_Actions )
endfunction

EDIT EDIT

I also have this on my map's header:

[jass=I think this is the Katan's sytem]
// ===========================
function H2I takes handle h returns integer
return h
return 0
endfunction

// ===========================
function LocalVars takes nothing returns gamecache
// Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
return InitGameCache("jasslocalvars.w3v")
endfunction

function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction

function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction[/code]

But nothing works !! I think that the computer doesn't even know that the bomb died !!! why !

If you guys want, I can post here the map for you to download and see the error .. =S but that way I won't be able to surprise you with another bomber spell (lol)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Your problem is that you flush the things you attached to your timer AND destroy the timer before it did anything.
JASS:
loop
        exitwhen (duration == 10)
        call TimerStart(t, 1.0, true, function GasEffect)
        set duration = duration + 1
    endloop
    call FlushHandleLocals(t)
    call DestroyTimer(t)


Timers do not stop the code (and thats whats so special about them) so duration is set to 10 after like 0.1 seconds lol.

Now just as a pointer - you need to flush the timer and destroy it inside the timer actions ! (unless its a timer with a wait or something like that that you can just wait some time and destroy it).

The code should be something like this:

JASS:
function Trig_GasBombs_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetTriggerUnit()) == 'h000'
endfunction
//==========================================================
function GasEffect takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit bomb = GetHandleUnit(t, "bomb")
    local integer duration = GetHandleInt(t, "duration")
    local real x = GetUnitX(bomb)
    local real y = GetUnitY(bomb)
    local group g = CreateGroup()
    local unit f
    local unit array dummy
    local player owner = GetOwningPlayer(bomb)
    call GroupEnumUnitsInRange(g, x, y, 250, null)
    loop
        exitwhen (f == null)
        set f = FirstOfGroup(g)
        if IsUnitEnemy(f, owner) and GetUnitState(f, UNIT_STATE_LIFE) > 0.405 and IsUnitType(f, UNIT_TYPE_STRUCTURE) == false then
            set dummy[0] = CreateUnit(owner, 'h001', GetUnitX(bomb), GetUnitY(bomb), 0.0)
            set dummy[1] = CreateUnit(owner, 'h001', GetUnitX(bomb), GetUnitY(bomb), 0.0)
            call UnitAddAbility(dummy[0], 'A002')
            call UnitAddAbility(dummy[1], 'A004')
            call IssueTargetOrder(dummy[0], "curse", f)
            call IssueTargetOrder(dummy[1], "slow", f)
            call UnitApplyTimedLife(dummy[0], 'BTLF', 1)
            call UnitApplyTimedLife(dummy[1], 'BTLF', 1)
        endif
        call GroupRemoveUnit(g, f)
    endloop
    call DestroyGroup(g)
    if duration >= 10 then
        call FlushHandleLocals(t)
        call DestroyTimer(t)
    else
        call SetHandleInt(t, "duration", duration + 1)
    endif
    set g = null
    set t = null
    set bomb = null
    set dummy[0] = null
    set dummy[1] = null
    set owner = null
endfunction
//==========================================================
function Trig_GasBombs_Actions takes nothing returns nothing
    local unit bomb = GetDyingUnit()
    local integer duration = 0
    local effect e  = AddSpecialEffect("war3mapImported\\Radioactivecloud.mdx", GetUnitX(bomb), GetUnitY(bomb))
    local timer t = CreateTimer()
    call SetHandleHandle(t, "bomb", bomb)
    call SetHandleInt(t, "duration", duration)
    call TimerStart(t, 1.0, true, function GasEffect)
    call TriggerSleepAction(10)
    call DestroyEffect(e)
    set e = null
    set t = null
    set bomb = null
endfunction
//==========================================================
function InitTrig_Gas_Bombs takes nothing returns nothing
    set gg_trg_Gas_Bombs = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Gas_Bombs, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Gas_Bombs, Condition( function Trig_GasBombs_Conditions ) )
    call TriggerAddAction( gg_trg_Gas_Bombs, function Trig_GasBombs_Actions )
endfunction


As you can probably see, you could just wait 10 seconds and then flush and destroy the timer.
I just put it this way so you'll understand a bit more how to use the handle local vars because in other cases you won't have this privilage (in any non-time-based timer).
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
lol didn't really look at the code before so I only now noticed this thing - f would be nulled the moment the loop starts since you only set a unit to it after the exitwhen condition.

JASS:
        // wrong  
        exitwhen (f == null)
        set f = FirstOfGroup(g)
JASS:
        // right  
        set f = FirstOfGroup(g)
        exitwhen (f == null)
 
Bah, it only works during the first second.
Just leave it, I will use a modification from the original version, slightly improved by me.

EDIT

ARRGGHHH is my WE bugged somehow !? Or is just that ALL code I download are crap !!!
Again, I did a very small change to the original and guess what ... it doesn't work ...
I wonder how it works in that map !!!
I will post the original and my changes ... if you find any error (because I couldn't) plz report it...

[jass=My code]function GasEffect_Conditions takes nothing returns boolean
local unit u = GetFilterUnit()
local player p = GetOwningPlayer(GetTriggerUnit())
return IsUnitEnemy(u, p) and GetUnitState(u, UNIT_STATE_LIFE) > 0.405 and IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false
endfunction
//=========================================================
function GasEffect_Actions takes nothing returns nothing
local unit array dummy
local player p = GetOwningPlayer(GetTriggerUnit())
local unit victim = GetEnumUnit()
set dummy[0] = CreateUnit(p, 'h001', GetUnitX(victim), GetUnitY(victim), 0.0)
set dummy[1] = CreateUnit(p, 'h001', GetUnitX(victim), GetUnitY(victim), 0.0)
call UnitAddAbility(dummy[0], 'A002')
call UnitAddAbility(dummy[1], 'A004')
call IssueTargetOrder(dummy[0], "curse", victim)
call IssueTargetOrder(dummy[1], "slow", victim)
call UnitApplyTimedLife(dummy[0], 'BTLF', 1)
call UnitApplyTimedLife(dummy[1], 'BTLF', 1)
set p = null
set dummy[0] = null
set dummy[1] = null
set victim = null
endfunction
//=========================================================
function Trig_GasBombs_Actions takes nothing returns nothing
local unit bomb = GetDyingUnit()
local integer bombID = GetUnitTypeId(bomb)
local player p = GetOwningPlayer(bomb)
local effect e
local integer duration = 0
local group g
local location l = GetUnitLoc(bomb)
if bombID == 'h000' then
set e = AddSpecialEffect("war3mapImported\\Radioactivecloud.mdx", GetUnitX(bomb), GetUnitY(bomb)) //creates the Cloud effect in the target loc
loop
exitwhen (duration == 10)
set g = GetUnitsInRangeOfLocMatching(250.00, l, Condition( function GasEffect_Conditions))
call ForGroupBJ( g, function GasEffect_Actions )
call TriggerSleepAction(1.00 )
set duration = duration + 1
endloop
call RemoveLocation(l)
call DestroyEffect(e)
call DestroyGroup(g)
endif
set l = null
set g = null
set e = null
set bomb = null
set p = null
endfunction
//===========================================================================
function InitTrig_Gas_Bombs takes nothing returns nothing
set gg_trg_Gas_Bombs = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Gas_Bombs, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Gas_Bombs, function Trig_GasBombs_Actions )
endfunction[/code]

and now the Original code:
[jass=original code]
function Trig_Poison_Gas_Grenade_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00Q' ) ) then
return false
endif
return true
endfunction

//Poisen Gas Grenade temporary Unitgroup actions

function PGGgroupActions takes nothing returns nothing
call UnitDamageTargetBJ( GetTriggerUnit(), GetEnumUnit(), ( 45.00 * I2R(GetUnitAbilityLevelSwapped('A00Q', GetTriggerUnit())) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
call AddSpecialEffectTargetUnitBJ( "chest", GetEnumUnit(), "Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call CreateTextTagUnitBJ( ( I2S(( 45 * GetUnitAbilityLevelSwapped('A00Q', GetTriggerUnit()) )) + "!" ), GetEnumUnit(), 0, 10, 0.00, 100, 0.00, 0 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 40.00, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 3.00 )
endfunction

//Poisen Gas Grenade temporary Conditions actions

function PGGgroupW takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction

function PGGgroupQ takes nothing returns boolean
return ( GetUnitStateSwap(UNIT_STATE_LIFE, GetFilterUnit()) > 0.00 )
endfunction

function PGGCondition takes nothing returns boolean
return GetBooleanAnd( PGGgroupW(), PGGgroupQ() )
endfunction

//Poisen Gas Grenade Trigger

function Trig_Poison_Gas_Grenade_Actions takes nothing returns nothing
local location PGGlocA = GetUnitLoc(GetTriggerUnit())
local location PGGlocB = GetSpellTargetLoc()
local group PGGgroupA
local integer IntegerPGG
local effect EffPGG
call CreateNUnitsAtLoc( 1, 'e003', GetOwningPlayer(GetTriggerUnit()), PGGlocA, AngleBetweenPoints(PGGlocA, PGGlocB) )
call IssuePointOrderLocBJ( GetLastCreatedUnit(), "attackground", PGGlocB )
call SetUnitPathing( GetLastCreatedUnit(), false )
call UnitApplyTimedLifeBJ( 0.90, 'BTLF', GetLastCreatedUnit() )
call TriggerSleepAction( ( DistanceBetweenPoints(PGGlocA, PGGlocB) / 800.00 ) )
call AddSpecialEffectLocBJ( PGGlocB, "war3mapImported\\Radioactivecloud.mdx" )
set EffPGG = GetLastCreatedEffectBJ()
set IntegerPGG = 1
loop
exitwhen IntegerPGG > 10
set PGGgroupA = GetUnitsInRangeOfLocMatching(220.00, PGGlocB, Condition(function PGGCondition))
call ForGroupBJ( PGGgroupA, function PGGgroupActions )
call TriggerSleepAction(1.00 )
set IntegerPGG = IntegerPGG + 1
endloop
call DestroyEffectBJ( EffPGG )
call RemoveLocation(PGGlocA)
call RemoveLocation(PGGlocB)
call DestroyGroup(PGGgroupA)
set PGGlocA = null
set PGGlocB = null
set PGGgroupA = null
set EffPGG = null
set IntegerPGG = 0
endfunction

//===========================================================================
function InitTrig_Poison_Gas_Grenade takes nothing returns nothing
set gg_trg_Poison_Gas_Grenade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Poison_Gas_Grenade, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Poison_Gas_Grenade, Condition( function Trig_Poison_Gas_Grenade_Conditions ) )
call TriggerAddAction( gg_trg_Poison_Gas_Grenade, function Trig_Poison_Gas_Grenade_Actions )
endfunction

[/code]



My code is cleaner and smaller, with only 1 BJ (For Group), but ignoring the very small differences I don't know why it doesn't work ...

If you somehow know anything that could help ... Plz
 
Well, I want to cast 2 spells on all units inside the cloud. This includes that if some unit leaves the could, and then enters it again, that unit must be affected again. Units inside the cloud will miss attacks (miss) and have slower attack speed (slow).
I will also add 25 damage per second while inside the cloud with a triggers system.
But for now i just want them to get affected by the stupid spells .... I re-made that damn gas ability so many times, that I really can't think of a way of creating it another way...

Hey, if some1 likes challenges, I challenge you guys to have a look on my chain spell.... it is nothing because the map is bugged .. if some1 could help me, i would be very appreciated... the thread is "life or death" ... although I believe it is death by now ...
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Well the problem in your code is a mystery for me but I created a new code.

This works (you won't hear them cast after the first time, I searched for a bug for like 10 minutes and then put a text and it just didn't play the sounds, it did cast).

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
 
Well, Wolf your code has the same problems the others have - they just work on the first second.

I changed 5 lines in your code (2 of them because the dummies, 2 because of a new var called p, and 3 because of the effect).

If it works during 10 secs on your map, then I dunno what's wrong with my WE ... perhaps I should use WEU ?

Anyway, I a last act for help, I will post here the map, among with its secret bombardment ... (which also does not work lol)

Here it goes, I hope some one can find the problem on the code =S
 

Attachments

  • Plane !.w3x
    118.7 KB · Views: 50
Status
Not open for further replies.
Top