Jump to content

Stupid Enemy AI !!!


Tiger

Recommended Posts

After playing with the map editor for some time now, I've created some cool levels. ( I'l post some pics soon if anyone's interested?)

 

After positioning some enemy soldiers in the base and in the bunkers, I decided to test the level with my squad.

Allthough the enemy soldiers are dug in nicely in defencive positions they all come running out from the cover of the bunkers and from inside the heavily fortified base... which they wouldn't do !!!

Even the snipers that have been strategicly placed in watchtowers all seem to make a decent to my approaching squad !

 

Is there any way I can stop them from leaving their cover and to stay in the buildings.

 

(Ive noticed that when I double click on an enemy in the editor I get some sort of table of parameters, but it doesn't seem very user friendly.)

 

Thanks

 

Tiger

Link to comment
Share on other sites

*Quietly closes the door to the AI torture chamber*

Yes AI can sometimes be incredibly stupid....Maybe you need to tweak the parameters for their behaviour....

And please do post some screenshots of your cool levels so we all can enjoy them.

Link to comment
Share on other sites

Ive noticed that when I double click on an enemy in the editor I get some sort of table of parameters, but it doesn't seem very user friendly.

Find property with name 'Logic'. Set it to 'Guard'. Now units will be guard it's place (they will be attack enemies if they see it only). Also you may set property RoamingRadius to something >0 - this is a radius of units move from guarded place.

Edited by Novik
Link to comment
Share on other sites

.

Find property with name 'Logic'. Set it to 'Guard'. Now units will be guard it's place (they will be attack enemies if they see it only). Also you may set property RoamingRadius to something >0 - this is a radius of units move from guarded place.

 

 

Cool, thanks Novik :eh:

 

If I set them to "Guard" does this mean they will still all run out, but only when they have spotted me?

If possible I would like to keep them inside the bunkers to defend them.

Can I restrict their movement to inside the bunker only?.. even when they spot my squad?

 

Thanks

 

Tiger

Link to comment
Share on other sites

If I set them to "Guard" does this mean they will still all run out, but only when they have spotted me?

Unit with this logic will shoot when *this* unit will see you. With logic "Sentry" shoot, run etc. - when *his allies* will see you. Simple try this method - are you units will leave bunker with this logic?

Can I restrict their movement to inside the bunker only?.. even when they spot my squad?

If method, which i describe above doesn't work, you can

1) full replace AI logic from script, with combination of UnitSetScriptLogic and OnUnitNeedCommand. But this method is not very easy.

2) run background thread, and restrict moving of units in this thread. Some like this:

function unitInBunker( unit )
local ret = (UnitInArea(unit,"bunker1","bunker2") and (UnitGetFloor(unit)==0))
return(ret)
end

function unitsControl()
local enemies = PlayerGetUnits(1)
while(1) do
	for i = 0, GroupGetSize( enemies ) - 1 do
		local unit = GroupGetUnit( enemies, i )
		if(UnitCanFight(unit) and (not unitInBunker( unit ))) then
			UnitMoveToWaypoint( unit, "bunkerCenter"..random(1,5))
		end
	end
	Sleep(40)
end	
end

StartThread(unitsControl)

Edited by Novik
Link to comment
Share on other sites

  • 2 weeks later...

Thanks Novik. :P

 

Looks a little tricky for a noobie like me.

I'll try the easy way first.

 

OK, as promised, a little piccy of my bunkers ( not finished yet )

Hope you like em....any pointers or suggestions from other designers would be greatly accepted. :P

 

 

 

Tiger

bunkers.bmp

Link to comment
Share on other sites

Thanks Novik. :P

 

Looks a little tricky for a noobie like me.

I'll try the easy way first.

 

OK, as promised, a little piccy of my bunkers ( not finished yet )

Hope you like em....any pointers or suggestions from other designers would be greatly accepted. :P

 

 

 

Tiger

 

 

Look good. Hope to see them in some downloadable map some time soon :P

Link to comment
Share on other sites

any pointers or suggestions from other designers would be greatly accepted. :P

Nice ones, I think. Reminds of german city bunker designing.

 

One thing, you could use ConstructionParts>walls>generalwalls>borders>low_const (or something) to make 20cms borders to roofs - between wall and roof floor. Maybe it makes unpassable roofs (can be fixed by ladders if wish) but it also make a flat roof building better looking and give it more strenght... under THE heavy fire. :P

 

I have been there...

post-3446-1148030608_thumb.jpg

 

Good bunkering. Keep up. :P

Link to comment
Share on other sites

any pointers or suggestions from other designers would be greatly accepted. :P

Nice ones, I think. Reminds of german city bunker designing.

 

One thing, you could use ConstructionParts>walls>generalwalls>borders>low_const (or something) to make 20cms borders to roofs - between wall and roof floor. Maybe it makes unpassable roofs (can be fixed by ladders if wish) but it also make a flat roof building better looking and give it more strenght... under THE heavy fire. :P

 

I have been there...

post-3446-1148030608_thumb.jpg

 

Good bunkering. Keep up. ;)

 

 

Thanks KoMik,

 

Your bunker looked awesome !

 

Using that small border wall made a lot of difference...looks much better now thanks.

 

Now I'm trying to raise the Heightmap layer to tuck my bunkers into the hilside :P , but with no luck !

In the editor it looks great, but when I Run the level to test it, my bunker is floating on level 1 and I can't work this out ?!

The hills look good but my guys can walk under the bunker....even though in editor mode it's on ground level 0 ........Help !!!

 

Tiger

Link to comment
Share on other sites

There is some different ways to 'dig' buildings under the surface.

 

1. Use BMP files

You know how to use .BMP files? If not then: Open photoprogram and create a new index colored .BMP file. File's grid should be 1 pixel wider than your current map template (f.e. 64x64 --> 65x65). Now you may paint the file with grayscale colors. White is the higher point and black is the lowest. The file can be imported to your template from Map>Import height map.

 

If you paint (white/gray) boxes to the file, them work as 'floor plans' or 'basal areas', so templates over this basal area will rise. You may specify how much them will rise from Height map layer's properties (max/min). For common houses I may recomed max 0.5 and for bunkers (half over the surface) 1.25.

 

2. Cellar layer

Ground under buildings or from basements can be 'erased': Select Cellar layer and use gray box-pointer. !!BTW!!, you must lift the ground (min) over 2.5 if passable underground floors are needed. If you have two underground floors then min must be over 5 and so on.

 

3. Higher floors

Sometimes it's useful to build floors to one floor higher. I mean, build basement to floor 0 and surface floor to 1. Then use .BMP files (basal areas as above) to lift the 0 floor to floor 1 (min), erase the ground (cellar layer) under the building and now in game your building's 'underground' will be viewed with ground (not just a room in black empty space... as you may see in my bunker picture attachment). You can also lower/lift your templates easily: Change the DeltaZ (-2.5=-1floor) value in template's properties slot.

 

4. Terrain holes (edit: later add 220506)

Terrain holes (which actually means 'Terrain trenchs') works as Cellar but there is a bottom. With them you may specify how deep and how many 'corners'. Very useful when making trenches round ya bunkers!

 

Hopefully you understood at least something :P. Try it out and if not succees then ask.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...