Needed: a new building-blocking method

Needed: a new building-blocking method

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Needed: a new building-blocking method

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Post by knorke »

the opposite should also be possible, think old c&c style building or protoss pylons.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Yup. And DoW-style building zones around points, etc., etc.

I just need a way to do this.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post 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).
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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?
Post Reply

Return to “Lua Scripts”