Page 1 of 1

Quick 'is it possible with lua (or otherwise)' Question

Posted: 02 Jun 2007, 13:05
by Warlord Zsinj
Okay, so, I have a very important building. Let's call it building X. ;)

Building X is a very complicated and essential part of my design. It needs to look big and evil, so I want to position a bunch of guards around the building, which don't only look cool, but also act as a defensive mechanism when it comes under attack.

Now, I could just make these infantry models child pieces of the building X model, and then mount them as turrets.

However, I would prefer if these units were actually spawned units, because:
- They have individual health, and can be killed individually
- They can be respawned individually
- They don't eat up UVmap space for texturing Building X
- Numerous advantages by having an actual unit be present with it's own personal AI and weapon ID's rather then just being a faked unit that is really a turret attached to a building

The problem with this is that it is essential that these guards:
1) Stand guard at designated positions around the building. Like, two outside doors, etc. This is more complicated then it seems; they need to stand straight at attention, and be facing the right direction.
2) When the building comes under attack, they need to move to designated areas on the model (eg: sandbagged areas), from where they can fire at the enemy. Preferably I'd want them to occupy these positions, though simply keeping them rooted where they are is an acceptable alternative which I can design around.
3) If the building is no longer under attack, the units need to move back to their original positions in number 1)
4) When a unit is killed, and the building respawns him (probably on say, a 45 second timer), that new unit needs to move to an unoccupied position (ie: the position of the previously killed unit), not to a position that is random or already taken.

Most of the numbered points I can accomplish through a complex animation sequence (except for the killing/replacing of units, which would take a zwzsg-esque script), but this removes all the advantages I noted in the dashed points, which are really cool, and allow me a lot more flexibility in the design.

The infantry units are not standard infantry troops employed in regular use, and can have their own private scripts attached that don't need to work for general combat-unit usage.

... So, scripting gurus, can the dashed points and the numbered points be resolved to accomplish what I need through LUA?

Presume (more or less correctly) that I have no foreknowledge of LUA methods or implications.

Other ideas as to how I might resolve this concept in a similar way to what I need are always welcome.

Posted: 03 Jun 2007, 07:10
by Dragon45
WZ, I'm inclined to say yes, because LUA pretty much owns at this point in time in terms of implementation.

And if you're talking about implementing this for the IMP HQ, i hope to god this is last on the list of stuff to do. It'll tie a perfectly good scripter up for a week or two...

Posted: 03 Jun 2007, 09:36
by Warlord Zsinj
I pretty much need a yes or no answer from someone who knows how LUA works, because I need to commit to a certain design now, rather then later when I have the potential to waste time on something that cannot work.

And I said it was building X ;)

Posted: 03 Jun 2007, 14:45
by quantum
I think it's possible thanks to the GiveOrderToUnit, CreateUnit, and RemoveUnitCmdDesc LuaRules commands. Only trepan, however, can give you the final answer, I'm definitely not a Lua Guru.

The good news is that once you know how to use LuaRules, I think your plans are quick and easy to implement. The bad news is that there is no documentation yet.

Posted: 03 Jun 2007, 17:13
by SinbadEV
And the other good news is that when you figure out how to do this we can steal it and use the same principles to make functional carriers (either StarCraftian or Just Aircraft Carriers)

Posted: 03 Jun 2007, 17:56
by Warlord Zsinj
Could I perhaps then encourage us to get together and pull the code together mutually, which would then be released freely for everyone to use (ie: no GPL etc)?

Otherwise I'm going to have to try and hunt out a talented scriptor, or hope that one of the bos scripters I have on-hand can work it out, and that might unfortunately mean waiting for the documentation to appear...

Looking forward to hearing from trepan about this too.

Posted: 03 Jun 2007, 18:22
by Lippy
Warlord Zsinj wrote:Could I perhaps then encourage us to get together and pull the code together mutually, which would then be released freely for everyone to use (ie: no GPL etc)?
GNU GPL stands for General Public Licence; I think you wanted to say "i.e. like GPL"

Posted: 03 Jun 2007, 18:35
by SinbadEV
GPL is different from "Public Domain" which is what he wants.

Posted: 04 Jun 2007, 01:12
by smoth
creative commons eats your petty gpl.

Posted: 04 Jun 2007, 04:51
by Warlord Zsinj
Arr, the point being that I need to get this done, and I'd love some help in this regard, which would not only be fairly attributed in the credits of SWS (uh... not that it's for SWS... >_> <_< ), but also be released freely for any mod to use, so that it's a collective effort to improve a number of mods through this lua stuff. Essentially, we're all pretty new here, and don't know what we're doing, so I think it'd be a useful thing to work through some of the stuff together.

It doesn't really have to building X either, it could be an aircraft carrier, like sinbad says. The point is that we get our feet wet with this lua stuff together, rather then on our own, so that all of our mods can benefit.

Posted: 04 Jun 2007, 08:13
by quantum
quantum wrote:I think it's possible thanks to the GiveOrderToUnit, CreateUnit, and RemoveUnitCmdDesc LuaRules commands.
I missed the "SetUnitNoSelect" command which might be used instead of "RemoveUnitCmdDesc".

#lua is probably the best place to find help.

Posted: 04 Jun 2007, 15:10
by Warlord Zsinj
For some reason, quakenet keeps telling me I have been klined from the server, though I've never tried to join it before...

Posted: 04 Jun 2007, 15:48
by quantum
Oh, I forgot to mention I'm talking about #lua in the lobby.

Posted: 04 Jun 2007, 16:48
by Warlord Zsinj
ah, thanks, I'll check that out.

Still though, timezones being what they are, some discussion in here would be nice. Having the permanent record is good too. I'll have to see if any of SWS's scripters want to get the ball rolling...

Posted: 04 Jun 2007, 18:02
by rattle
Warlord Zsinj wrote:For some reason, quakenet keeps telling me I have been klined from the server, though I've never tried to join it before...
What's your ISP?

Posted: 05 Jun 2007, 00:32
by Warlord Zsinj
optusnet.