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

[Solved] Question about Terrain

Status
Not open for further replies.
Level 5
Joined
Apr 11, 2011
Messages
107
is there a way to make a unit walk from region x to region y and only walk on a specific terrain type?

example. i want a villager to walk from the lower right corner to the upper right and follow the winding cobble path ive made.

how would i do this?if its a trigger, can you give me a test map with it?
 
Level 5
Joined
Apr 11, 2011
Messages
107
Sorry, but I'm still lost. How does checking the terrain make the unit stay in the terrain.?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Yep. I think that while setting moveing path it will be best to set it as sum of regions.

I'd just use the fact that center of tiles are separated by 128 distance units.

Place the first region over the starting point, center it on the tile. Then use a loop, check all the terrain types of the surrounding tiles. If one of the surrounding tiles is of correct type, order the unit to go there.

set point = position of unit
set angle = 0
loop
set point2 = point offset by 128 towards angle
if terrain at point2 = path then
order unit to go there
skip remaining actions
endif
exitwhen angle == 315
set angle = angle + 45
endloop

This is a very crude method and can result in the unit going back an forth two squares. But it is a starting point.

You should have a buffer of points to move to. It is not a good idea to give the unit move orders too often.

For example if the path is straight, order the unit to move to the tile that is farthest straigh ahead. When the unit reaches it, only then give it another order.
 
Level 5
Joined
Apr 11, 2011
Messages
107
The way the map works is:

There are 2 bandit factions
They capture towns to gain food/supplies
Randomly moving(following the various cobble paths around the map) trade caravans can be robbed to provide additional supplies

So I think ill just have various regions around the paths and at the crossroads ill have it choose another random region for the unit to move to


+rep to all of you, thanks for the help :)
 
Last edited:
Status
Not open for further replies.
Top