- Joined
- Sep 25, 2005
- Messages
- 71
FIXED: Set dummy unit movement type to hover, they now work appropriately
Alright. I'm getting there, but something new has come up. Whenever I have a spell which involves moving a dummy unit, and there's a change in Z, I had it set to change the unit's Z relative to the ground. This works for spells I want traveling along a line well enough, and especially so for ones with special fx (though theoretically if I need a z of fx I could deploy dummy units, attach the special fx with it as the target, etc.)... But now I've got sort of another issue.
One of my spells had uses of lightning effects on top of it. It would create a cone of damaging lightning. It works and for the most part looks fine (there's an issue wherein the Z for a terrain drop/raise seems wayyyyyy too low/high to the point it coasts into the ground instead of staying the desired amount of units above in Z), but as I show in the video, whenever there's some form of raised/lowered ground that isn't a terrain height change, the z between the units and the lightning effects changes in a way that is different an definitely not as I intended.
[youtube]
http://www.youtube.com/watch?v=vj0A5fajVyU
[/youtube]
The method I had for setting a "constant" fly height for the projectiles relative to the ground was using a GetLocationZ that used a location created from the x/y values of the dummy unit:
If there's a better way to keep a projectile above the ground at a certain height above the ground I'd appreciate some insight. I was even considering just dismissing the idea of it changing in height in favor of it affecting units above/below but simply coasting on at the appropriate height of the casting terrain.
In regards to the other spells, such an implementation would be easy (I think I mentioned it above they simply create special fx based on the x/y of the dummy projectile unit, and I could create a unit with proper attachment points (origin,) give it the moving properties of the projectile dummy, and attach it there before killing it, but here I have to manage lightning effects.
Anyways, if anyone's got some advice, or there's something critical about the spell in its current form (mostly I don't want leaks,) let me know.
Alright. I'm getting there, but something new has come up. Whenever I have a spell which involves moving a dummy unit, and there's a change in Z, I had it set to change the unit's Z relative to the ground. This works for spells I want traveling along a line well enough, and especially so for ones with special fx (though theoretically if I need a z of fx I could deploy dummy units, attach the special fx with it as the target, etc.)... But now I've got sort of another issue.
One of my spells had uses of lightning effects on top of it. It would create a cone of damaging lightning. It works and for the most part looks fine (there's an issue wherein the Z for a terrain drop/raise seems wayyyyyy too low/high to the point it coasts into the ground instead of staying the desired amount of units above in Z), but as I show in the video, whenever there's some form of raised/lowered ground that isn't a terrain height change, the z between the units and the lightning effects changes in a way that is different an definitely not as I intended.
[youtube]
http://www.youtube.com/watch?v=vj0A5fajVyU
[/youtube]
The method I had for setting a "constant" fly height for the projectiles relative to the ground was using a GetLocationZ that used a location created from the x/y values of the dummy unit:
JASS:
static method LightningConeExecution takes nothing returns nothing
local integer i = 0
local integer ballcount = 0
local unit enemy
local effect collisionFX
local location zLoc
local real array z
local LightningConeData localLightningCone
loop
exitwhen i >= LightningConeInstances
set localLightningCone = LightningConeArray[i]
if localLightningCone.distance < localLightningCone.maxDist then
if localLightningCone.transparency > 0. and (localLightningCone.distance / localLightningCone.maxDist) > .85 then
set localLightningCone.transparency = localLightningCone.transparency - .20
endif
loop
exitwhen ballcount == 6
call MoveUnit(localLightningCone.balls[ballcount], LightningConeSpeed, GetUnitFacing(localLightningCone.balls[ballcount]))
// Stuff that matters is here
set zLoc = Location(GetUnitX(localLightningCone.balls[ballcount]), GetUnitY(localLightningCone.balls[ballcount]))
set z[ballcount] = GetLocationZ(zLoc) + 36.
call SetUnitFlyHeight(localLightningCone.balls[ballcount], z[ballcount], 0.)
if (localLightningCone.distance / localLightningCone.maxDist) > .60 then
call SetUnitVertexColor(localLightningCone.balls[ballcount], 255, 255, 255, R2I(localLightningCone.transparency*255))
endif
if ballcount != 6 then
call MoveLightningEx(localLightningCone.beams[ballcount], true, GetUnitX(localLightningCone.balls[ballcount-1]), GetUnitY(localLightningCone.balls[ballcount-1]), z[ballcount-1], GetUnitX(localLightningCone.balls[ballcount]), GetUnitY(localLightningCone.balls[ballcount]), z[ballcount])
endif
if (localLightningCone.distance / localLightningCone.maxDist) > .60 then
call SetLightningColor(localLightningCone.beams[ballcount], 100., 100., 100.,localLightningCone.transparency)
endif
call GroupEnumUnitsInRange(LightningConeEnumGroup, GetUnitX(localLightningCone.balls[ballcount]), GetUnitY(localLightningCone.balls[ballcount]), 128., null)
loop
set enemy = FirstOfGroup(LightningConeEnumGroup)
exitwhen enemy == null
if ValidAliveTargetGroupedGround(enemy, localLightningCone.caster, localLightningCone.LightningConeTargets) == true then
call GroupAddUnit(localLightningCone.LightningConeTargets, enemy)
call UnitDamageTarget(localLightningCone.caster, enemy, 50., true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE, null)
set collisionFX = AddSpecialEffectTarget("Abilities\\Weapons\\FarseerMissile\\FarseerMissile.mdl", enemy, "chest")
call DestroyEffect(collisionFX)
endif
call GroupRemoveUnit(LightningConeEnumGroup, enemy)
endloop
set ballcount = ballcount + 1
endloop
set ballcount = 0
set localLightningCone.distance = localLightningCone.distance + LightningConeSpeed
endif
if localLightningCone.distance >= localLightningCone.maxDist then
set LightningConeInstances = LightningConeInstances - 1
set LightningConeArray[i] = LightningConeArray[LightningConeInstances]
call DestroyGroup(localLightningCone.LightningConeTargets)
call localLightningCone.destroy()
endif
set collisionFX = null
set zLoc = null
set i = i + 1
endloop
if LightningConeInstances == 0 then
call PauseTimer(LightningConeTimer)
endif
endmethod
If there's a better way to keep a projectile above the ground at a certain height above the ground I'd appreciate some insight. I was even considering just dismissing the idea of it changing in height in favor of it affecting units above/below but simply coasting on at the appropriate height of the casting terrain.
In regards to the other spells, such an implementation would be easy (I think I mentioned it above they simply create special fx based on the x/y of the dummy projectile unit, and I could create a unit with proper attachment points (origin,) give it the moving properties of the projectile dummy, and attach it there before killing it, but here I have to manage lightning effects.
Anyways, if anyone's got some advice, or there's something critical about the spell in its current form (mostly I don't want leaks,) let me know.
Attachments
Last edited: