- Joined
- May 4, 2007
- Messages
- 2,260
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]
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]