• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[General] Terrain/Doodad trigger actions

Status
Not open for further replies.
Level 21
Joined
Jul 10, 2009
Messages
481
Hi guys,

I'd like to copy a region with terrain, units, doodads, destructables, cliffs etc. to another region via trigger. This would allow me to setup a sample area in my map instead of manually creating the same stuff for 24 players.

I know that you can easily copy terrain, units and destructables, but I wonder, if the following things are also possible to do in Reforged:

  • Modifying cliff levels via trigger
  • Creating/removing doodads via trigger
  • Pick Doodads in Region
  • GetDoodadX, GetDoodadY, GetDoodadFacing
  • Create water via trigger
  • Creating destructable groups as variable types to loop through them via "FirstofGroup"

If there aren't any functions for this, what would come close to it?

Thank you in advance and best regards,
Eikonium
 
  • Pick Doodads in Region
  • GetDoodadX, GetDoodadY, GetDoodadFacing
Doodads can't be really worked with by nature, as there's no chance to reference one specific doodad. There's not even a data type for it, in common.j
There are the only API, where one can indirectly play some "specified" doodad animation:
JASS:
native SetDoodadAnimation      takes real x, real y, real radius, integer doodadID, boolean nearestOnly, string animName, boolean animRandom returns nothing
native SetDoodadAnimationRect   takes rect r, integer doodadID, string animName, boolean animRandom returns nothing
Create water via trigger
Sadly no. There's API to change color, or so for it only. You can search for "water" in common.j.

Modifying cliff levels via trigger
Not possible via code. Only changing height might work:
JASS:
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
Here's an example: Raising Terrain?

Creating destructable groups as variable types to loop through them via "FirstofGroup"
Finally yes. But this can be provided only by a custom system, where such API is used, as there's also no native type "destrictable group". Implementing a list or so, that is used as data strucuture, and then managing this list internally in the system.

If there aren't any functions for this, what would come close to it?
We're mainly talking about terrain things, but terrain things are hard to fetch with code, or not even possible. Such funtionality is required to make an external tool, which would basically be like a new little editor.
It's not simple to achive this programtically, here's some intresting thread about this: Generate random terrain

I would personally try to keep terrain simple, to make it more easy to copy & paste stuff in editor for all players. Or only if it's simple enough, without cliffs/water/doodads, you could try the trigger approach ... but this would could mean some loading / lag time at map start.
 
Level 21
Joined
Jul 10, 2009
Messages
481
Hey IcemanBo, thank you for the help, much appreciated!

Doodads can't be really worked with by nature, as there's no chance to reference one specific doodad.
Eikonium said:
Creating destructable groups as variable types to loop through them via "FirstofGroup"
Finally yes. But this can be provided only by a custom system, where such API is used, as there's also no native type "destrictable group". Implementing a list or so, that is used as data strucuture, and then managing this list internally in the system.
All right, I got a friend of mine to work on a destructable group linked list solution ;)
Btw, can the doodad limitation be bypassed by using trackables? I guess, this doesn't solve the problem, as doodads can't be spotted by triggers and trackables can't be placed via editor, right?
In that case, I'll just stick to destructables...

Eikonium said:
Modifying cliff levels via trigger
Only changing height might work. Here's an example: Raising Terrain?
That's at least something :). I had to modify the code in the linked ressource to prevent in-game lags, but it gave me the input that I needed.
By the way, this post on hive mentions that it might be possible to simulate cliffs via destructables:
Map making help needed trigger => cliffs
But I don't know the implications about pathability. Sounds like something I would get mad with anyway, so I better don't start with it :D

Eikonium said:
Create water via trigger
Sadly no. There's API to change color, or so for it only. You can search for "water" in common.j.
Eikonium said:
Modifying cliff levels via trigger
Not possible via code.
Sad to hear :(


Edit:
Btw, I'm still searching for
  • GetDestructableZ (is that occlusion height?)
  • GetDestructableFacing
  • GetDestructableScale
  • GetDestructableVariation
Do those functions exist or are there workarounds to retreive this information? (like maybe checking for the last digits in the model path to retreive the variation)?
Again, help greatly appreciated :)

Have a nice evening!
 
Last edited:
n that case, I'll just stick to destructables.
Yes, for trigger-only solution this would be best.

Sounds like something I would get mad with anyway, so I better don't start with it :D
Yeh, it really sounds like huge work for only "looking a bit like cliffs". :D

Btw, I'm still searching for
  • GetDestructableZ (is that occlusion height?)
  • GetDestructableFacing
  • GetDestructableScale
  • GetDestructableVariation
Do those functions exist or are there workarounds to retreive this information? (like maybe checking for the last digits in the model path to retreive the variation)?
Again, help greatly appreciated :)
OcclusionHeight is somethig different, it's something with vision block, or so. But yeh, those natives are missing.
W3X Tools (Beta) could be used to retrieve the destructable data like Z/Facing/Variation/Scale from outside map, and generae then JASS code for providing an API to retrieve this data. It's currently not working for newest patch, though. I try to fix it soon, and I could give support to use it, if you want. My discord is IcemanBo#5874. :)
 
Level 21
Joined
Jul 10, 2009
Messages
481
Great ressource!
Your courtesy is highly appreciated, thanks a lot!

My current map is a community project with friends, many of them being unexperienced with the WE. We plan to create a minigame collection, so we might actually use the "Copy 24 instances of some minigame template to the playing area" feature pretty often within the map, maybe including destructables benefitting from your tool (i.e. those, where scale, facing and variation matter). We are however rather at the beginning of development, so I'd rather wait, until a few games are finished and look, how important destructable placement will become :)

I've sent you a friend request on Discord (Wachtelbrei#4889). It's a pleasure!
 
Status
Not open for further replies.
Top