How to control Static detail model from LUA

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
User avatar
bigjj13
Posts: 68
Joined: 2010-04-04, 19:16
Location: Germany
Contact:

How to control Static detail model from LUA

Post by bigjj13 » 2011-02-05, 17:02

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
BigJJ -- SG-O
Image
volto
Posts: 12
Joined: 2011-01-19, 19:06
Location: Germany (NDS)

Re: How to control Static detail model from LUA

Post by volto » 2011-02-05, 18:12

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
User avatar
bigjj13
Posts: 68
Joined: 2010-04-04, 19:16
Location: Germany
Contact:

Re: How to control Static detail model from LUA

Post by bigjj13 » 2011-02-05, 18:22

Hi,

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

MfG
BigJJ -- SG-O
Image
volto
Posts: 12
Joined: 2011-01-19, 19:06
Location: Germany (NDS)

Re: How to control Static detail model from LUA

Post by volto » 2011-02-05, 18:45

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
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: How to control Static detail model from LUA

Post by Carsten » 2011-02-06, 13:13

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?
Best regards,
Carsten
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: How to control Static detail model from LUA

Post by Carsten » 2011-02-10, 01:24

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?
Best regards,
Carsten
User avatar
bigjj13
Posts: 68
Joined: 2010-04-04, 19:16
Location: Germany
Contact:

Re: How to control Static detail model from LUA

Post by bigjj13 » 2011-02-12, 13:26

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
BigJJ -- SG-O
Image
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: How to control Static detail model from LUA

Post by Carsten » 2011-02-15, 16:33

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.)
Best regards,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests