Page 1 of 1

How to control Static detail model from LUA

Posted: 2011-02-05, 17:02
by bigjj13
Hi,

Id like to start/ stop animation, set frame number, set Animation sequence,... in a model with Lua comands. Are there any to control a Static detail model?

Thanks

Re: How to control Static detail model from LUA

Posted: 2011-02-05, 18:12
by volto
Hi bigjj13,
which model you will change within the lua config?
the Model of the Avatar or the models of boxes or Creatures?

MfG
volto

Re: How to control Static detail model from LUA

Posted: 2011-02-05, 18:22
by bigjj13
Hi,

I'd like to controle this one:
stargate.zip
(218.36KiB)Downloaded 451 times
It is in my map and I'd like to controle it with my map Lua file.

MfG

Re: How to control Static detail model from LUA

Posted: 2011-02-05, 18:45
by volto
Yes the Object models can controlled used via lua, but with the information i have collected till this day. You must make a Sequence for each Event like the Motion from the Avatar and then the Events can played from a trigger. This is Information based on the Forum threads, how too use it is current Carsten the better source of information.

MfG
volto

Re: How to control Static detail model from LUA

Posted: 2011-02-06, 13:13
by Carsten
Hi BigJJ,
bigjj13 wrote:Id like to start/ stop animation, set frame number, set Animation sequence,... in a model with Lua comands. Are there any to control a Static detail model?
You're right, that feature should be there but is still missing.
I'll look into it, but possibly cannot finish it today.
Can you please file a ticket for this issue?

Re: How to control Static detail model from LUA

Posted: 2011-02-10, 01:24
by Carsten
Ok, I'm happy to report that I just implemented this. :cheesy:

Changes are in r252 and r253.
I've also added a tiny example map script that demonstrates the use of three of the six script methods in map Kidney, using two newly inserted models, see Kidney.lua for just the script.

Please let me know if you need help using the new script methods -- I just realized (with some horror) that we have no map scripting documentation at all, and when implementing the above changes, that the C++ code for the game system needs a good overhaul (e.g. we can get rid of awkward struct EntityStateT, but the required changes are highly nontrivial). I've also created tickets (#67 and #68) for both points, but unfortunately hardly the time to implement them right now.

Alas, does the new code help you?

Re: How to control Static detail model from LUA

Posted: 2011-02-12, 13:26
by bigjj13
Carsten wrote:Alas, does the new code help you?
Thanks a lot, this works greate!! :cheesy:

I have some ideas for some new lua funktions:

GetFrameNumber() : Get the number of the current frame

SetFrameNumber(Framenumber) : Go to frame x

PlayFromTo(FirstFrame, Lastframe) : Play animation from frame a to frame b and than stop the animaton

Somthing like that would be greate!

Thanks

Re: How to control Static detail model from LUA

Posted: 2011-02-15, 16:33
by Carsten
bigjj13 wrote:I have some ideas for some new lua funktions:

GetFrameNumber() : Get the number of the current frame

SetFrameNumber(Framenumber) : Go to frame x

PlayFromTo(FirstFrame, Lastframe) : Play animation from frame a to frame b and than stop the animaton

Somthing like that would be greate!
Well, yes, I see. The general problem is that the state of an entity must be sync'ed over the network, and/or it must carefully be considered what portion of the state is sync'ed and what portion isn't.

If the current scripting API is sufficient to solve your problem at hand, then I'd prefer to defer the implementation of these additional methods until ticket #68 is at least partially implemented.

(If however there is a problem that cannot be solved with the existing methods, please let me know, so that we can take action sooner.)