• 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.

Adjusting a point's y Axis to the terrain

Status
Not open for further replies.
Level 5
Joined
Jan 5, 2008
Messages
145
I'm attempting to correct the placement of a doodad on the y axis. I'm deforming the terrain upward in order to make a completely smooth map. Problem is the deformation is causing the doodads to go into the ground. While this does make an interesting effect, I need to place Skulls and other doodads that will not look good. Any help is welcomed.

Currently, I have a point that is placed randomly on the map and stored as Waterpoint (This is used to determine if the doodad is in water) After that I place a unit called Y Axis. (I'm assuming that the unit will automatically be placed where the Y axis of the land is.) After that I change the Y Axis of the doodad to the Y axis of Unit. However the problem comes in that the unit is being placed into the ground as well.

I know there is logic errors but I just want to get the freaking doodad to be corrected on the Y Axis before I care about those

Trigger

  • Generation Props
    • Events
    • Conditions
    • Actions
      • -------- FLOWERS/SHRUBS --------
      • For each (Integer B) from 1 to 1800, do (Actions)
        • Loop - Actions
          • Set WaterPoint = (Random point in (Entire map))
          • Unit - Create 1 Test Y for Neutral Passive at WaterPoint facing Default building facing degrees
          • Set TestY = (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at WaterPoint) Equal to Icecrown Glacier - Dark Ice
            • Then - Actions
            • Else - Actions
              • -------- FLOATING ICE MUST BE IN WATER --------
              • Set WaterPoint = (WaterPoint offset by ((X of WaterPoint), (Y of (Position of TestY))))
              • Floating Text - Create floating text that reads ((String((Y of (Position of TestY)))) + Y) at WaterPoint with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Destructible - Create a Shrub at WaterPoint facing (Random angle) with scale (Random real number between 0.80 and 1.00) and variation 1
              • Unit - Remove TestY from the game
Photo attached, The Archers are currently the TestY, normally they would be invisible but for this they are not.

Thanks
 

Attachments

  • wat.png
    wat.png
    1.8 MB · Views: 126
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You mean destructibles not doodads. They are different as doodads cannot be modified by triggers outside of playing animations while destructibles can be created and destroyed.

You are using the wrong axis. X and Y are map coordinates.

You want Z, which is the height a unit/destructible is above the ground.

Do note that changing terrain mesh height will not produce perfect results some times.

What you need to do is read the location Z (needs JASS as GUI lacks a wrapper) and then use that as the Z offset for the destructible you create. There are problems computing water height and land height as location Z only returns 1 of them (I forget which).

Also be aware that terrain deformation results are non-deterministic. Doing anything that alters game state non-cosmetically can cause clients to go out of synchronization in multiplayer sessions. Single player is unaffected but the results still may not be reproduced accurately and look as good as intended.
 
Level 5
Joined
Jan 5, 2008
Messages
145
You mean destructibles not doodads. They are different as doodads cannot be modified by triggers outside of playing animations while destructibles can be created and destroyed.

You are using the wrong axis. X and Y are map coordinates.

You want Z, which is the height a unit/destructible is above the ground.

Do note that changing terrain mesh height will not produce perfect results some times.

What you need to do is read the location Z (needs JASS as GUI lacks a wrapper) and then use that as the Z offset for the destructible you create. There are problems computing water height and land height as location Z only returns 1 of them (I forget which).

Also be aware that terrain deformation results are non-deterministic. Doing anything that alters game state non-cosmetically can cause clients to go out of synchronization in multiplayer sessions. Single player is unaffected but the results still may not be reproduced accurately and look as good as intended.

Thank you for replying,

I realized later in the night that I had the wrong axis. (whoops)

Should I give up deformations then? The last thing I want is desynchronization, as this may turn into a 2~4 player co-op game but as of right now it's a single-player experience. That being said should I just make the terrain a constant and then generate all the destructibles instead? I would much rather have destructibles that add to the terrain, than displacing the terrain to make water sources. It takes away from what I want to do, but I guess that's what I get for using Warcraft 3 FT.

Is there anyway to fix the leaks myself? Can I start a riot so Blizzard can finally release Warcraft 4?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Is there anyway to fix the leaks myself? Can I start a riot so Blizzard can finally release Warcraft 4?
What leaks? Also you have SC2, which is what WC4 would be like anyway.

Terrain deformations are fine as long as you do not use terrain Z for any sort of non-graphic result. For example it will desynchronize if you use terrain Z for calculating missiles bouncing but will not if you use terrain Z to create destructible at appropriate height.

This is not limited to trigger deformations, with the infamous shockwave standard ability having caused thousands of session desynchronizations over the years.
 
Level 5
Joined
Jan 5, 2008
Messages
145
What leaks? Also you have SC2, which is what WC4 would be like anyway.

Terrain deformations are fine as long as you do not use terrain Z for any sort of non-graphic result. For example it will desynchronize if you use terrain Z for calculating missiles bouncing but will not if you use terrain Z to create destructible at appropriate height.

This is not limited to trigger deformations, with the infamous shockwave standard ability having caused thousands of session desynchronizations over the years.

Sorry, I assumed that desynchronization was happening due to a leak of some sort. Should I just refer to a JASS tutorial and figure it out from there. I've never touched JASS before. Do I just convert a trigger to text and type in some stuff such as getTerrainz()?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Sorry, I assumed that desynchronization was happening due to a leak of some sort. Should I just refer to a JASS tutorial and figure it out from there. I've never touched JASS before. Do I just convert a trigger to text and type in some stuff such as getTerrainz()?
No...

You can either write in pure JASS by doing what you described or you can simply use a "custom script" GUI action with a single line of JASS in it.

There is no "getTerrainz()". The function is "GetLocationZ(location)". This is one of the few times in JASS that you are absolutely forced to use a location object. It is recommended to recycle the same location in form of a constant but is not required to do so.
 
Last edited:
Level 5
Joined
Jan 5, 2008
Messages
145
EDIT3:

After much testing, I've noticed while this works for Trees this doesn't work for the props I've made. It's really odd.
Also I've noticed that Trees are able to go through my condition to check that it can't spawn on X tile which is also odd.

Attached is a example of the props not being corrected.
I fix'd the problem with the trees.
 

Attachments

  • wat2.png
    wat2.png
    1.9 MB · Views: 118
  • wat3.png
    wat3.png
    1.5 MB · Views: 89
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Props are doodads unless I misunderstood.
Doodads are pre-placed terrain objects. They have no pathing as they write directly to the map pathing image. They also cannot be created or destroyed dynamically during a session.

He clearly means destructibles. Which are not doodads although the editor has a bad habit of throwing them together in a list. Destructibles are types of widget (the underlying type of units and items) and can be dynamically created/destroyed as well as modify the pathing map.
 
Status
Not open for further replies.
Top