- Joined
- May 4, 2007
- Messages
- 2,260
Hiiii, guys, well, I have a real question for you (a real problem you might say).
As some of you already know I am creating a spell pack of bombardments ... A plane comes from the skies and drops some bombs upon your dam enemies!
However, Some people say my bombs are slow (ARGGH GW !!!!!) and some suggested me to add a quadratic effect to the fall of the bombs ... but I don't know how to do it !!!
I will post my plane's code here. If you guys also have any ideas about how to optimize it I would like to hear them as well. This trigger is the hear of the spell pack.
Please, help me make my bombs fall in a better way !!!
[jass=Plane Trigger]
function Trig_InBomber_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 - 1400 * Cos(angle * (3.14159 / 180.0)), Y - 1400 * 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 == 5)
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[/code]
This code is very simple !!! If you guys don't understand it please say something about it !
HEELPPPP (plz, rep+ will be awarded as well as credits in the spell pack).
For more information please download the spell pack Bombardment Spells. This is the most recent version of the spell pack.
PS - i only need help on the Bomber trigger. I am currently optimizing the other triggers, but I don't need help on them for now =P
As some of you already know I am creating a spell pack of bombardments ... A plane comes from the skies and drops some bombs upon your dam enemies!
However, Some people say my bombs are slow (ARGGH GW !!!!!) and some suggested me to add a quadratic effect to the fall of the bombs ... but I don't know how to do it !!!
I will post my plane's code here. If you guys also have any ideas about how to optimize it I would like to hear them as well. This trigger is the hear of the spell pack.
Please, help me make my bombs fall in a better way !!!
[jass=Plane Trigger]
function Trig_InBomber_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 - 1400 * Cos(angle * (3.14159 / 180.0)), Y - 1400 * 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 == 5)
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[/code]
This code is very simple !!! If you guys don't understand it please say something about it !
HEELPPPP (plz, rep+ will be awarded as well as credits in the spell pack).
For more information please download the spell pack Bombardment Spells. This is the most recent version of the spell pack.
PS - i only need help on the Bomber trigger. I am currently optimizing the other triggers, but I don't need help on them for now =P