• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Detecting cliff level

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hey,

Is there a way to detect cliff levels, so that basically my items spawn in a random point on the map, when the cliff level is 0, so that they will never spawn on cliffs? I found the integer-comparison for cliff levels, the problem now is that I dont know how to make a detailed condition for the whole region.

  • Points 1 Cave
    • Events
      • Time - Every 0.35 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet IntegerVariable = 0
      • Item - Pick every item in Cave Spawn <gen> and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Picked item)) Equal to 1 Point
                  • (Item-type of (Picked item)) Equal to |cffffff002 Points|r
                  • (Item-type of (Picked item)) Equal to |cff00ffff3 Points|r
            • Then - Actions
              • Set VariableSet IntegerVariable = (IntegerVariable + 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IntegerVariable Less than 300
        • Then - Actions
          • Set VariableSet ItemSpawnCave = (Random point in Cave Spawn <gen>)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain cliff level at ItemSpawnCave) Equal to 0
            • Then - Actions
              • Item - Create SpawnedItems[(Random integer number between 1 and 3)] at ItemSpawnCave
              • Custom script: call RemoveLocation (udg_ItemSpawnCave)
            • Else - Actions
        • Else - Actions

The problem is it detects the whole region, which has cliffs, and therefore the condition is not fullfilled. I want it to basically spawn items "between" the cliffs/everywhere where no cliff is. If there is a simple solution for this I'd be glad to hear it. If it gets to complicated I guess Ill just scrap the idea, its not that important ^^
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
It shouldn't be detecting the whole region. It's detecting the cliff level at ItemSpawnCave, which is a random point in the region.

Also, you need to move:
  • Custom script: call RemoveLocation (udg_ItemSpawnCave)
To outside and below your If Then Else. Otherwise, if the cliff level is not equal to 0 it will remain forever and leak.

I recommend creating a text message that displays the Cliff level at ItemSpawnCave. This way you can tell what Cliff level it is.
 
Level 7
Joined
May 30, 2018
Messages
290
It shouldn't be detecting the whole region. It's detecting the cliff level at ItemSpawnCave, which is a random point in the region.

Also, you need to move:
  • Custom script: call RemoveLocation (udg_ItemSpawnCave)
To outside and below your If Then Else. Otherwise, if the cliff level is not equal to 0 it will remain forever and leak.

I recommend creating a text message that displays the Cliff level at ItemSpawnCave. This way you can tell what Cliff level it is.

Thanks for the advice. Anyways it unfortunately doesnt spawn any items :thinking: And how do I go about creating text displaying the cliff levels?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Well, what is the terrain cliff level displaying? Do you see any 0's?

Also, I had an idea. What if you created ~4 "safe" regions inside the Cave Spawn region. These new regions wouldn't have any cliffs in them. Then when you create an Item at an "unsafe" point (on a cliff), you move the Item to a random point in one of these "safe" regions. This way you guarantee that an Item will always be created.
 
Level 7
Joined
May 30, 2018
Messages
290
Well, what is the terrain cliff level displaying? Do you see any 0's?

Also, I had an idea. What if you created ~4 "safe" regions inside the Cave region. These regions wouldn't have any cliffs in them. Then when you create an Item at an "unsafe" point (on a cliff), you move it to a random point in one of these "safe" regions. This way you guarantee that an Item will always be created.

Sorry, my bad : how do I go about creating text displaying the cliff levels? I have no clue :c
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Sorry, my bad : how do I go about creating text displaying the cliff levels? I have no clue :c
  • Game - Display to (All players) for 30.00 seconds the text: (String((Terrain cliff level at ItemSpawnCave)))
It's under Conversion - Convert Integer to String. Then look for Environment - Terrain Cliff Level.

I think it's safe to assume that 0 is not the ground level.
 
Level 7
Joined
May 30, 2018
Messages
290
  • Game - Display to (All players) for 30.00 seconds the text: (String((Terrain cliff level at ItemSpawnCave)))
It's under Conversion - Convert Integer to String. Then look for Environment - Terrain Cliff Level.

Thanks! Ill have a look
 
Level 7
Joined
May 30, 2018
Messages
290
  • Game - Display to (All players) for 30.00 seconds the text: (String((Terrain cliff level at ItemSpawnCave)))
It's under Conversion - Convert Integer to String. Then look for Environment - Terrain Cliff Level.

I think it's safe to assume that 0 is not the ground level.

It always displays 2's! Interesting, I thought only the level 2 cliffs I made are cliff level 2 (logically) but it seems like the generel cliff level i for the whole region is 2. Now it works fine. :) Just changed the number to 2!
 
Last edited:
Level 5
Joined
Oct 16, 2007
Messages
67
On creation of your map you can choose a start cliff level. Default is 2.
cliff.JPG
 
Status
Not open for further replies.
Top