• 🏆 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!

unit pathing, cliff height recognition

Status
Not open for further replies.
Level 4
Joined
Oct 1, 2010
Messages
89
hello

is it possible to have a unit recognize cliff levels when issued an order?
this problem of mine developed after recent gate installations...

if this is even possible, how do you make a unit 'recognize' a movement order has been issued to a different cliff height? [i.e. recognize as an event for a trigger]

My city (Gondor) has lots of levels and there are gates blocking access to these levels at the stairs that go to that level. Gates only open when units approach them (unit enters region - trigger) and thus remain closed (and the pathing blocked) when units are not close to the gate.

As a result, when you issue unit with a move order to the next level (i.e one higher/lower) the unit just runs into the cliff, as no walkable path exists for them to run along. (the closed gate is in the way!)



The two black circles represent 2 city levels. The blue dot is where the unit is initially. The red 3 is where the order is issued to. The green dot is where the unit ends up now when issued the movement order. The black square (on the left) is the gate & opening/closing trigger region.

The red arrows indicate what should be happening. Rally points should be set to red 1 & 2 first, then move to 3 (the point of the original movement order)



Thus, I'd like to incorporate rally points to the gates [i.e. first into gate open region so trigger fires (nr. 1 in picture), then out of gate region so closing trigger fires (nr. 2 in picture), then to point original click (move order) was made].

This trigger (the rally point one) should only fire if units move between levels (up and down). So the question is, is it possible to recognize as an event (probably using conditions), the issuing of a move order to different cliff heights?

I was looking for relevant triggers in the trigger editor for ages, but couldn't find any that would seem to work.... Was my search in vain, or is this possible?


EDIT: RE: picture, the last arrow is the wrong way! just turn it around in your head! :p
 

Attachments

  • pathing problem.JPG
    pathing problem.JPG
    27.1 KB · Views: 159
Level 12
Joined
Jan 30, 2009
Messages
1,067
I actually think he is talking about players, ;)

Some of them are rather stupid at times, hehe.

Sorry the gates broke your system though, perhaps someone more knowledgeable will help you out. GL mate.
 
  • Height
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • -------- Set up point variables to remove leaks later --------
      • Set Point[1] = (Target point of issued order)
      • Set Point[2] = (Position of (Triggering unit))
      • -------- Check the height of the cliff. This is an Integer comparison and uses: Event Responce - Terrain Cliff Level --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain cliff level at Point[1]) Equal to (Terrain cliff level at Point[2])
        • Then - Actions
        • Else - Actions
      • -------- Removes leaks --------
      • Custom script: call RemoveLocation(udg_Point[1])
      • Custom script: call RemoveLocation(udg_Point[2])
 
Level 4
Joined
Oct 1, 2010
Messages
89
okay, thanks for the replies guys (hehe, that rhymes). anyway, posted this at 04:30 this morning (local time) and went to bed after....


I actually think he is talking about players, ;)

@ Vizel and mckill2009:
Indeed, players it is. AI can just be programmed, as mckill2009 said, so that is not to difficult... I realize you can just run to the gate first, just thought it would be cool if you can click on different levels and units then know how to get there on their own. (on second thought, looking at that trigger Ghost posted this might not happen...:vw_wtf:)



@ GhostThruster:
sorry mate, i'm quite new to all this... you care to elaborate a bit?

Anyway, I'm guessing you just add the rally points in as the 'Else Actions'..? (in your example). However, the city has more than one level. So how do you account for that? Will this trigger not just test for level differences between the last two points (the unit position and 'move to' location.). If so, then how do you set up the Then and Else actions for the If Condition?

I am looking for something that can 'measure' the the cliff height, so units know if they are going up or down. This is important as it needs to be the event of a trigger that will determine the action (of that trigger) that determines the new rally points given to moved unit. (i.e. unit is on level three now. To go to level 2 run to point X first, then to click position. To go to level 4, run to point Z first, then to click position)




  • TEST the order
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Set UNITLocation = (Position of (Triggering unit))
      • Set UNITMoveOrder = (Target point of issued order)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain cliff level at UNITLocation) Equal to (Terrain cliff level at UNITMoveOrder)
        • Then - Actions
        • Else - Actions
          • Unit - Set Rally-Point for (Triggering unit) to (Center of Gate1 <gen>)
          • Unit - Order (Triggering unit) to Attack-Move To UNITMoveOrder
      • Custom script: call RemoveLocation(udg_UNITLocation)
      • Custom script: call RemoveLocation(udg_UNITMoveOrder)

Problems with this:

Units only run to the gate and do not continue onwards to the UNITMoveOrder position. I have tried using rally points too and the 'Target point of issued order'...
I think it is because when the second move order is activated, the whole thing starts again and they just run to the gate. (not infinite loop, coz no game crash..??!) I tried switching the trigger on and off too (before and after the second move order)

Also, I haven't found a way to 'measure cliff heights' yet.....

I'll gladly upload a test map if anyone is interested



If I have interpreted any of this wrong or if i'm horribly over thinking this, please let me know. Also if this will require JASS knowledge, tell me, so I can give up now....
 
Last edited:
Level 12
Joined
Jan 30, 2009
Messages
1,067
you could use a simple formula to test cliffheight. a condition.

If difference between Point[1] terrain height and Point [2] terrain height is greater than 0 then...

Not sure if you can actually easily do that since this laptop doesnt have wc3 installed

if it is greaater than 0 he'll be moving up, if its negative number, he is going down
 
Level 4
Joined
Oct 1, 2010
Messages
89
you could use a simple formula to test cliffheight. a condition.

if it is greaater than 0 he'll be moving up, if its negative number, he is going down

it sound plausible, the 'actions' are still a problem though...

if you can determine up and down, the units must still realize what level it is on in order to run to the right gate...



If on level 3 now and moving up. The 'formula' can determine up/down and then the trigger actions can send the unit to the gate between level 3 and 4.

If the unit on level 2 and moving up. The 'formula' can determine up/down and then the trigger actions will still send the unit to the gate between level 3 and 4.

That is why knowing what level you are on is important, so you run to the right gate...



Actually just thought of something... Surely can you incorporate a 'base value' into this formula. Set base value as 'ground/sea level' (i.e cliff = 1/0). Label this as a point (point 0), then work out the 'current position of the unit' (point 1) and the 'target point of the order' (point 2) by using the differences between the respected values.

For example:
Unit on city level number = difference between 'current position of the unit' (point 1) and 'ground level' (point 0).

Order issued to city level number = difference between 'movement order issued to' (point 2) and 'ground level' (point 0)

then subtract the two to get up/down (as Vizel suggested)

after that, use the first one (unit on city level number) to determine what level the unit is on and then set up Multiple If functions to run through all the possible gates that it can go to...


I don't know if this will work though, intuitively it should, but finding the relevant triggers is another story!

anyway, can't fool around with it now though, going out for dinner.... will see what I can do when I get back!



EDIT:

let me make a sample map for you, just wait...

Thanks dude! I'll check it when I get back!
 
Level 4
Joined
Oct 1, 2010
Messages
89
@ Vizel - thanks of the effort, much appreciated... lol! I used that tut, but it creates random variables. tried adapting it to my situation, didn't work out... then tried Ghost's but then that is where I got stuck on actions...

(you seen the movie Beerfest? when they are 'training' and the one guy irritates the other with Popo (the wooden doll)? well, this is "frustrating"...)


@ mckill2009 - yeah, that's what i'm trying to accomplish, more or less... however region triggers won't work as the city is semi-circular. you are either gonna have to develop new software to make regions round (i hear they can't be changed from rect.), or you are gonna have to lay down a shit-load of regions! I also wanted to do it like that, but in this map, it's just not plausible.

I changed the terrain on your map, and re-uploaded, to give you a better idea of what is happening. Kael (now on the middle level) must be able to run up and down...



197497-albums4020-picture37751.jpg





Meanwhile I'll continue my search for conditions and actions related to Vizel's function trigger... I think i have the math all figured out, now to just get this damned PC to understand what i'm trying to tell it! AARGH!
 

Attachments

  • Cliff Order - Augmented.w3x
    20.7 KB · Views: 48
Last edited:
Level 12
Joined
Jan 30, 2009
Messages
1,067
Pic doesn't show, :D

EDIT: Maybe this will be of some help to you. I was experimenting, trying to get it to work. This is what I came up with.

Yes, I used the same map as before with the gates, figured it would be more "complete" that way, ;)

SO! If anyone can do what he's trying to do, please feel free to use this map as a template since it already has the terrain and the gates how he wants em, :D

EDIT2: As for the regions, you'd need a lot (And yes, I know what the city looks like, I own the trilogy, and love the movies), you'd be able to do it with OR conditions when referring to a cliff level region like how I have in the attached map. You'd have something like OR: Point in cliff0 Region1, Point inf cliff1 Region2, etc. till you cover them all. it would be annoying, but it would work in that regard. I've done it before (It's TERRIBLY annoying!), and it does work to cover a whole non-rectangular area.
 

Attachments

  • Gate test.w3x
    27.6 KB · Views: 51
Level 4
Joined
Oct 1, 2010
Messages
89
okay, this is my latest attempt. it does not work... the game just crashes when you move to a different cliff height. I'm guessing it has leaks, but i donno how to fix it. (how to take out variable integer? don't even know if i'm using it right...)

the actions are not done yet, thats what i'm doing so long... (also just put in the 'do nothings' for ease of reference)




  • TEST
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Set UNITLocation = (Position of (Triggering unit))
      • Set UNITLocationNR = (Terrain cliff level at (Position of (Triggering unit)))
      • Set UNITMoveOrder = (Target point of issued order)
      • Set UNITMoveOrderNR = (Terrain cliff level at (Target point of issued order))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain cliff level at UNITLocation) Equal to (Terrain cliff level at UNITMoveOrder)
        • Then - Actions
          • Do nothing
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UNITLocationNR Less than UNITMoveOrderNR
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • UNITLocationNR Greater than or equal to 0
                  • UNITLocationNR Less than 3
                • Then - Actions
                  • Unit - Order (Triggering unit) to Move To (Position of Gate (Horizontal) 0000 <gen>)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • UNITLocationNR Greater than or equal to 3
                      • UNITLocationNR Less than 5
                    • Then - Actions
                      • Unit - Order (Triggering unit) to Move To (Position of Gate (Vertical) 0003 <gen>)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • UNITLocationNR Greater than or equal to 5
                        • Then - Actions
                          • Do nothing
                        • Else - Actions
                          • Wait 2.00 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • UNITLocationNR Greater than UNITMoveOrderNR
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • UNITLocationNR Greater than or equal to 0
                      • UNITLocationNR Less than 3
                    • Then - Actions
                      • Do nothing
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • UNITLocationNR Greater than or equal to 3
                          • UNITLocationNR Less than 5
                        • Then - Actions
                          • Unit - Order (Triggering unit) to Move To (Position of Gate (Horizontal) 0000 <gen>)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • UNITLocationNR Greater than or equal to 5
                            • Then - Actions
                              • Unit - Order (Triggering unit) to Move To (Position of Gate (Vertical) 0003 <gen>)
                            • Else - Actions
                              • Do nothing
                • Else - Actions
                  • Do nothing
      • Custom script: call RemoveLocation(udg_UNITLocation)
      • Custom script: call RemoveLocation(udg_UNITMoveOrder)

Explanation of my thought process:

1) set up variables (point and integer) for unit and move order location

2) check if unit and order point on same level:
if so - do nothing
if not - check if order issued up/down

3) check if up/down:
if up - run level calc.
if down - run level calc.

3) level calc:
- multiple IF's to determine levels by using ranges (0 < x < 3) of the integer variables set up in step 1

- issue orders accordingly

- there are gonna be more checks in the actual map as there are more than 3 levels...

[Note: the 2 sec wait is also just a 'place-keeper' for the time being]




EDIT: Added my test map...




I know what the city looks like, I own the trilogy, and love the movies
hehe, lol! really? shit dude, what did you pay to own the trilogy??! :goblin_jawdrop:
 

Attachments

  • Cliff-Gate Order System.w3x
    18.7 KB · Views: 50
Last edited:
Level 12
Joined
Jan 30, 2009
Messages
1,067
As for the crashing, I'm not sure. However, in your variables here:
  • current
    • Set UNITLocation = (Position of (Triggering unit))
    • Set UNITLocationNR = (Terrain cliff level at (Position of (Triggering unit)))
    • Set UNITMoveOrder = (Target point of issued order)
    • Set UNITMoveOrderNR = (Terrain cliff level at (Target point of issued order))
You leak since you're using position of triggering unit instead of the variable you just defined, :D

  • changes
  • Set UNITLovationNR = Terrain cliff level at UNITLocation
  • Set UNITMoveOrderNR = Terrain cliff level at UNITMoveOrder
OT:
My mom mailed the DVDs down for my birthday. She got BluRay set, so she doesn't need the DVDs anymore, xD
It didn't cost me a thing. My mom also burnt copies of em and sent em to me like 8 months back, those are going to go to my buddy and his family, xD
 
Level 4
Joined
Oct 1, 2010
Messages
89
So you are saying that i must remove the point variables completely and just use integers for the whole setup..?

i'll go try that so long...
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
No. I'm not saying that. I'm just saying that you can set it using the other variables so that you don't leak. If you were going to set them like that, what's the point of setting point variables to begin with, since you'll leak anyway?

If you set the position and point stuff with the other variables, you'll be able to avoid the leaks. that's what I'm saying.

I know "Position of (Triggering unt)" leaks, which is why you set up the point variable and set it to that to begin with. So why would you not use that variable to describe "position of (Triggering unit)" after setting it? Just makes more logical sense to me.

EDIT: oh, I see, now.

I only posted the two that needed changing, I think that's where the confusion came from. Everything else can stay the same, except those nasty Do nothings. Don't forget to get rid of those awful things, :p
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
I thought that might be it, xD

Your crash is probably caused by the unit trying to execute two simultaneous orders. That was crashing it for me. So...I'm not sure how to check if an order has been completed, -.-

EDIT: I like what you've done with the city. Looks great. Where's the tree, I didn't see it, :(

Only thing I dislike are those ugly ass blizzard cliffs in back with the caves and the beacon on it. Eww.

Anyway, you could very easily cover that in regions for the way I was trying to do. It would be time consuming and annoying, but easily done.
 
Level 4
Joined
Oct 1, 2010
Messages
89
i changed like you recomended, thanks. does make sense... also developed a new way to recognize the level units are on. place a region on each level and use that as a height comparative. easy actually

now i'm just stuck at the actions bit.... trying to sort out this 'simultaneous' order vibe... anyway will keep you updated as to proceedings.




RE: The City: lol, that pic was taken ages ago... it's changed allot since. still need to sort out the spammed doodad thing and also build the whole top level. fuk, this might take a while...

been working on rooms mostly lately. deleted the mountains a while ago, still need to figure out how exactly to do the Pippin 'quest'... somehow climb up something maybe, but I'll see later.

197497-albums4020-picture37760.jpg


 
Status
Not open for further replies.
Top