Page 1 of 1

another lame lua question

Posted: 26 Jan 2008, 23:12
by bobthedinosaur
i was wondering if any one has been working on lua concepts that would allow for multiple model or multiple units stacked to work?
ie: a soldier unit with no weapons who can pick up an assortment of weapons to use. just one example i can think of...

Re: another lame lua question

Posted: 27 Jan 2008, 10:24
by KDR_11k
That would still be limited by the actual weapon code, you can draw a gun but you can't add an actual gun.

Re: another lame lua question

Posted: 27 Jan 2008, 10:39
by lurker
But if you want him to pick up a gun, you're better off making the gun a unit already.

Re: another lame lua question

Posted: 27 Jan 2008, 15:52
by Argh
Probably the easiest way to do this would be to model the gun, have the soldier have all possible models of gun built into its model, then have the soldier's LUA interact with the gun Unit, thereby activating that gun, then use BOS to activate or deactivate said gun. If all weapon calls went to a common call-script with branches for the specifics of aiming, it'd even run pretty fast.

The big problem then would be the weird movement behaviors that would result from the Unit logic. Unless PressureLine's attempt to fuse .S3Os eventually reaches fruition, that's probably the single fastest way to go here.

Hmm. Can we rewrite OnlyTargetCategory on the fly, or is that strictly read-only? That'd take care of quite a lot of bork, in that area...

Re: another lame lua question

Posted: 27 Jan 2008, 17:53
by KDR_11k
It'd be better to have one unit per weapon and just "morph".

Re: another lame lua question

Posted: 28 Jan 2008, 03:26
by bobthedinosaur
i think kdr has the best idea, now what about making pilot units jump in a vehicle and maybe able to dismount/ eject?

Re: another lame lua question

Posted: 28 Jan 2008, 03:44
by trepan
fwiw, LuaRules/unsynced can easily swap out model
piece display lists using the UnitRendering interface ;-)

Re: another lame lua question

Posted: 28 Jan 2008, 03:46
by bobthedinosaur
im thinking of a mod thats based around the infantry concept, and is more about modding the regular infantry guy with what ever weapons/ vehicles are for the mission design. how ever spring is kind of a tank big robot and bombe type platform, maybe i should look at another engine?

Re: another lame lua question

Posted: 28 Jan 2008, 07:35
by KDR_11k
trepan wrote:fwiw, LuaRules/unsynced can easily swap out model
piece display lists using the UnitRendering interface ;-)
Yeah but not the weapon or the unit's behaviour (e.g. moving in range).

Re: another lame lua question

Posted: 28 Jan 2008, 08:01
by Argh
fwiw, LuaRules/unsynced can easily swap out model
piece display lists using the UnitRendering interface

Can you, maybe, write an example, showing a one-time swap? I'd very, very gladly use this for a few things, it'd save a lot of trouble for a few things I'd like to try out.

Re: another lame lua question

Posted: 28 Jan 2008, 17:30
by bobthedinosaur
ideas for making a weapon pick up? maybe have empty base soldiers be a transport and pick up a weapon which depending on the type morphs it into that "soldier with that weapon" and could possibly drop them to go back to base soldier, how ever, while morphing how does one go about transferring the health of the old unit to the new one?

Re: another lame lua question

Posted: 28 Jan 2008, 18:52
by KDR_11k
Transferring health is easy, just use SetUnitHealth. Transporting stuff would be more problematic because the soldiers wouldn't know they're armed.

Re: another lame lua question

Posted: 28 Jan 2008, 19:08
by bobthedinosaur
hmm so detection radius?