• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Terrain Creation problem - Polar coordinate issue

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2005
Messages
7
Hello. I am trying to get the terrain underneath a created unit, and spawn a replica of the terrain in another area.

Code:
    call StoreInteger(udg_gc, "TerrainCenter", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 0.00, 0) ) )
    call StoreInteger(udg_gc, "TerrainLowerRight", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 128.00, 315) ) )
    call StoreInteger(udg_gc, "TerrainLower", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 128.00, 270) ) )
    call StoreInteger(udg_gc, "TerrainLowerLeft", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 128.00, 225) ) )
    call StoreInteger(udg_gc, "TerrainLeft", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 128.00, 180) ) )
    call StoreInteger(udg_gc, "TerrainUpperLeft", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 128.00, 135) ) )
    call StoreInteger(udg_gc, "TerrainUpper", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 128.00, 90) ) )
    call StoreInteger(udg_gc, "TerrainUpperRight", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 128.00, 45) ) )
    call StoreInteger(udg_gc, "TerrainRight", s, GetTerrainTypeBJ( PolarProjectionBJ( GetUnitLoc( GetConstructingStructure() ), 128.00, 0) ) )
This code stores the terrain info just fine, exactly the way I want it to.

Code:
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 0.00, 0), GetStoredInteger(udg_gc, "TerrainCenter", s), -1, 1, 1 )
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 256.00, 0), GetStoredInteger(udg_gc, "TerrainRight", s), -1, 1, 1 )
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 315.00, 45), GetStoredInteger(udg_gc, "TerrainUpperRight", s), -1, 1, 1 )
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 256.00, 90), GetStoredInteger(udg_gc, "TerrainUpper", s), -1, 1, 1 )
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 315.00, 135), GetStoredInteger(udg_gc, "TerrainUpperLeft", s), -1, 1, 1 )
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 256.00, 180), GetStoredInteger(udg_gc, "TerrainLeft", s), -1, 1, 1 )
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 315.00, 225), GetStoredInteger(udg_gc, "TerrainLowerLeft", s), -1, 1, 1 )
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 256.00, 270), GetStoredInteger(udg_gc, "TerrainLower", s), -1, 1, 1 )
    call SetTerrainTypeBJ( PolarProjectionBJ(GetRectCenter(gg_rct_View), 315.00, 315), GetStoredInteger(udg_gc, "TerrainLowerRight", s), -1, 1, 1 )

This code however, which should produce the exact same terrain, just spaced out a bit, produces this:

terrainweird2ju.jpg

The dirt is background, and the 1x1 sections of grass are the copied and pasted terrain.

The problem lies in the sections of grass that the 3 night elf "Pointers" are "Pointing" at. (Bad editing job I know... I can't afford Photoshop =P)

Any ideas what might be causing the sections at angles 135, 45, and 315 to mess up, while 225 works perfectly? If no one knows, that's ok, but leave a suggestion or an idea please. I'm at my wit's end with this one.
 
Status
Not open for further replies.
Top