Page 1 of 1

Needed: a new building-blocking method

Posted: 29 Jun 2007, 02:41
by Argh
Very simply, I need a new method to block when a building can be built within an area, implemented via LUA.

How would this work?

1. User places a building of type X, Y or Z.

2. If User attempts to place the building within X radius of an existing building of type X, Y or Z, then the LUA rules should prevent this from happening, while also giving feedback to the user.

3. Friendly buildings with this type of blocking should show the area blocked, if they are selected, as a shaded circle, to aid users in placing their buildings. Hostile buildings would just return a console message, i.e. "enemy building is too close", etc.

Ideally, this set of rules could be made flexible, per building- some should block a larger area than others.

Posted: 01 Jul 2007, 14:56
by knorke
the opposite should also be possible, think old c&c style building or protoss pylons.

Posted: 01 Jul 2007, 19:06
by Argh
Yup. And DoW-style building zones around points, etc., etc.

I just need a way to do this.

Posted: 02 Jul 2007, 00:05
by trepan
LuaRules, it would be a simple gadget.

Spring.GetUnitsInCylinder()
Spring.GetUnitsInSphere()
Spring.GetUnitsInRectangle()
AllowCommand() call-in
AllowUnitCreation() call-in

Use the FBI [CUSTOMPARAMS] section to configure units if
you like FBIs, otherwise use a lua config file (folks who know a
little lua would probably prefer using a lua file, it's a better format).

Posted: 02 Jul 2007, 00:16
by Argh
So, this is pretty easy? Wonderful! How do I sort out what the units are, within the circle? Like, if you cannot have more than one Unit X within radius Y, how would I search that Spring.GetUnitsInCylinder?