- Joined
- Feb 27, 2007
- Messages
- 5,578
I'm trying to make a quick, deep terrain deformation from 1 location to another, but I don't really understand what some of the arguments do in the natives, and the BJ terrain deformation functions don't make it any clearer. They are below:
So first off, if you've used these before and could explain, for example:
Now, I'm presuming I don't actually want to use these because I've read about their ability to cause desyncs with GetLocationZ(), but if I'm not gonna trigger them then what other options do I have? This thread (click link and search for "deform") seems to imply that I could do it by casting a dummy Shockwave/Thunderclap/War Stomp ability, but it looks like I can only modify two data fields and neither of those will change the radius of the deformation.
Anyone have experience with deformations? I want to create a thin, deep deformation from point 1 to point 2 that travels relatively quickly. And I want to avoid casting a dummy War Stomp ability 100+ times if I can avoid it.
JASS:
//Natives
//===========================================================================
native TerrainDeformCrater takes real x, real y, real radius, real depth, integer duration, boolean permanent returns terraindeformation
native TerrainDeformRipple takes real x, real y, real radius, real depth, integer duration, integer count, real spaceWaves, real timeWaves, real radiusStartPct, boolean limitNeg returns terraindeformation
native TerrainDeformWave takes real x, real y, real dirX, real dirY, real distance, real speed, real radius, real depth, integer trailTime, integer count returns terraindeformation
native TerrainDeformRandom takes real x, real y, real radius, real minDelta, real maxDelta, integer duration, integer updateInterval returns terraindeformation
native TerrainDeformStop takes terraindeformation deformation, integer duration returns nothing
native TerrainDeformStopAll takes nothing returns nothing
//BJs
//===========================================================================
function TerrainDeformationCraterBJ takes real duration, boolean permanent, location where, real radius, real depth returns terraindeformation
set bj_lastCreatedTerrainDeformation = TerrainDeformCrater(GetLocationX(where), GetLocationY(where), radius, depth, R2I(duration * 1000), permanent)
return bj_lastCreatedTerrainDeformation
endfunction
//===========================================================================
function TerrainDeformationRippleBJ takes real duration, boolean limitNeg, location where, real startRadius, real endRadius, real depth, real wavePeriod, real waveWidth returns terraindeformation
local real spaceWave
local real timeWave
local real radiusRatio
if (endRadius <= 0 or waveWidth <= 0 or wavePeriod <= 0) then
return null
endif
set timeWave = 2.0 * duration / wavePeriod
set spaceWave = 2.0 * endRadius / waveWidth
set radiusRatio = startRadius / endRadius
set bj_lastCreatedTerrainDeformation = TerrainDeformRipple(GetLocationX(where), GetLocationY(where), endRadius, depth, R2I(duration * 1000), 1, spaceWave, timeWave, radiusRatio, limitNeg)
return bj_lastCreatedTerrainDeformation
endfunction
//===========================================================================
function TerrainDeformationWaveBJ takes real duration, location source, location target, real radius, real depth, real trailDelay returns terraindeformation
local real distance
local real dirX
local real dirY
local real speed
set distance = DistanceBetweenPoints(source, target)
if (distance == 0 or duration <= 0) then
return null
endif
set dirX = (GetLocationX(target) - GetLocationX(source)) / distance
set dirY = (GetLocationY(target) - GetLocationY(source)) / distance
set speed = distance / duration
set bj_lastCreatedTerrainDeformation = TerrainDeformWave(GetLocationX(source), GetLocationY(source), dirX, dirY, distance, speed, radius, depth, R2I(trailDelay * 1000), 1)
return bj_lastCreatedTerrainDeformation
endfunction
//===========================================================================
function TerrainDeformationRandomBJ takes real duration, location where, real radius, real minDelta, real maxDelta, real updateInterval returns terraindeformation
set bj_lastCreatedTerrainDeformation = TerrainDeformRandom(GetLocationX(where), GetLocationY(where), radius, minDelta, maxDelta, R2I(duration * 1000), R2I(updateInterval * 1000))
return bj_lastCreatedTerrainDeformation
endfunction
//===========================================================================
function TerrainDeformationStopBJ takes terraindeformation deformation, real duration returns nothing
call TerrainDeformStop(deformation, R2I(duration * 1000))
endfunction
//===========================================================================
function GetLastCreatedTerrainDeformation takes nothing returns terraindeformation
return bj_lastCreatedTerrainDeformation
endfunction
- Why the fuck are durations in integers? I realize its in MS but... why?
- spaceWaves/timeWaves?
- What exactly are dirx and diry for? When
TerrainDeformationWaveBJ
uses them they're effectively Cos() and Sin() of the angle between start/end points, but I tried putting that in to my own call and it went all wonky. - What does
integer count
do inTerrainDeformWave
?
Now, I'm presuming I don't actually want to use these because I've read about their ability to cause desyncs with GetLocationZ(), but if I'm not gonna trigger them then what other options do I have? This thread (click link and search for "deform") seems to imply that I could do it by casting a dummy Shockwave/Thunderclap/War Stomp ability, but it looks like I can only modify two data fields and neither of those will change the radius of the deformation.
Code:
Data - Terrain Deformation Amplitude
Data - Terrain Deformation Duration (ms)
Anyone have experience with deformations? I want to create a thin, deep deformation from point 1 to point 2 that travels relatively quickly. And I want to avoid casting a dummy War Stomp ability 100+ times if I can avoid it.