[H5] Restricting AI Player from passing Gates?

Maps and the art of mapmaking.
bread smith
Leprechaun
Leprechaun
Posts: 5
Joined: 01 Jul 2009

[H5] Restricting AI Player from passing Gates?

Unread postby bread smith » 02 Jul 2009, 12:45

On my current map project (my first one) I have a huge swamp where I would like to place an AI Player who actually cannot leave the swamps. There is only one Gate leading to that area.

Now I'm thinking about a way to restrict the AI to pass that gate. Like you can ban a race from towns perhaps...?

Is this possible without scripting? I'm new on the H5 Editor and didn't engage in scripting, yet...

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 02 Jul 2009, 15:08

You have to use regions for this. Just make a region over a place you what your "gate", name it something like "aiblock", then add the following line to the map script:
SetRegionBlocked("aiblock",not nil, PLAYER_2)
(assuming you want to block the blue player). Heroes of the blue player won't be able to pass through the blocked region.
To unblock region, use SetRegionBlocked("aiblock",nil, PLAYER_2)

bread smith
Leprechaun
Leprechaun
Posts: 5
Joined: 01 Jul 2009

Unread postby bread smith » 02 Jul 2009, 18:09

very nice - and easy! Thanks alot for your help!

Anyway, I think I'll have to dig in the whole scripting thing soon...

User avatar
Warmonger
Pixie
Pixie
Posts: 125
Joined: 15 Dec 2007
Contact:

Unread postby Warmonger » 03 Jul 2009, 09:59

Big thanks for this tip, I was trying to do this with SetObjectEnabled but did not suceed.
VCMI : the future of Heroes 3!
People just don't care.

Sarvi
Leprechaun
Leprechaun
Posts: 46
Joined: 29 Sep 2006

gates that restrict

Unread postby Sarvi » 10 Oct 2009, 02:46

I've done something similar without scripting regions (i.e. in multiplayer maps):
You set up garrison gates passable only by a certain player (and his allies) simply by making it owned by that player and stacking it with huge armies, e.g. 10000 titans or something.
Only the player who owns the gate can get through!
Ach wie schoen das niemand weiss....

love2winalot
Leprechaun
Leprechaun
Posts: 9
Joined: 20 Feb 2006

Unread postby love2winalot » 10 Oct 2009, 15:12

Hail: Without scripting there are other ways also. First off, the teleport spell on the main map the heroe can only go 8 tiles. So, set up a border guard, and on the other side just use blocking objects, rocks, trees ect, and have a path 8 tiles long with gold, gems, ect on it. Now he can not hop over, as there is no place to land within his range.

This is easy to do to keep a heroe in his part of the dungeon. On top, just make the area only have 1 or 2 places to land a boat, or a teleporter with 8 blocked grids behind it, and a border guard in front of it.

This method adds one more element to the game, that being, at the end fight, you really need to Win, otherwise, not only did you lose your best heroe, but you just picked up the gems, ect, and now the enemy has a way out of his area.

Franzy
War Dancer
War Dancer
Posts: 362
Joined: 07 Sep 2007
Location: Moscow, Russia
Contact:

Unread postby Franzy » 11 Oct 2009, 05:59

Oh my, this is so *oldskul*. You think in Heroes3 categories. Scripts make it a lot easier and simplier. And scripts do work in multiplayer. So I personally would go with SetRegionBlocked...


Return to “Mapmaking Guild”

Who is online

Users browsing this forum: No registered users and 0 guests