AmenMoses and 3com,
Dear fellows of this community,
I hope that you have a good sense of humor when you'll watch this movie "The Two Guards, Two Doors Riddle" on YouTube :
But, first of all, I want to apologize for having posted my previous script containing that awful "mish-mash" without any clear explanation of its content.
This is the revisited code taking into consideration AmenMoses and 3com comments.
I want to thank each of them for their willingness to assist me on my uneasy way to the knowledge of Lua scripting.
(this script was successfully tested --> however when I click a second time on the same key of the numeric keypad - for instance the key "2" - then the animation clip of the entity "Goblin" cannot be repeated. That animation clip is reactived if I select another animation clip of that entity. That problem doesn't occur for the entity "#1 movex10m" probably because it contains only one animation clip -> to meditate ... )
Explanation of the purpose of my script (the revisited one) :
1) screen capture showing the entities present in the scene :
Using my terminology :
The Family ( or Class or Object ) "Goblin" contains two members identified by :
- their Family name in the "Object Properties Panel"
- a "identifying number #n". "#n" being an integer automatically defined by GameGuru MAX when the entity was introduced in the scene.
When I studied a little bit the instructions (commands) contained in the LUA scripts of GameGuru MAX, I noticed the use of (e) to anonymously designate an entity.
That (e) may be replaced by the "identifying number #n" to apply a command to a specific entity of the scene.
Example in that scene :
- I want to animate the second animation's clip (of a serie of six) of the entity "Goblin" having the identifying number "6".
- For that purpose, I want to remember the names of the animation's clips that I attributed to that entity when I imported it into GameGuru MAX (in my custom assets folder).
- In this case, I attributed the name "a2" to the second animation's clip of the entity "Goblin".
- My behavior sends this "message" to the main program of GameGuru MAX :
SetAnimationName(6,anim) ---> where "6" is the entity "#6 Goblin" in the scene, and "anim" is the animation clip "a2" of that entity.
PlayAnimation(6) ---> the animation clip "a2" of the entity "#6 Goblin" is played once each time I click on the key "2" of
the numeric pad of my keyboard.
3) The script inside that behavior is indeed a "mish-mash" because it contains the commands to activate animations clips OR a motion for three distinctive entities. That's not a good way to write a script that could be readily understood by any programmer (beginner or not).
- In order to write LUA scripts for GameGuru MAX, the programmer needs to learn the basic concepts of LUA (found in Lua 5.2 Reference Manual, as kindly mentioned by AmenMoses).
- But the knowledge of the instructions specific to the main program of GameGuru MAX with which the Lua scripts can interfere ( I could say in my own terminology : "can find the connections to establish a dialogue") is also a requirement.
To conclude :
- I want to confirm my assumption : the physic engine ("Physics on" activated in the "Object Properties Panel") cannot detect the position of an entity if this one was moved by an animation clip. How could it detect that ? In that experimental project, the entity "movex10m" is an imported animated mesh moving 10 meters forward. I think that the physics engine ignores that parameter stored in the .DBO file of the animated entity.
- All of us (the early adopters of GameGuru MAX) are testing alpha versions of that new game engine. There are bugs (unresolved old ones and probably new ones will appear) that could lead to misinterpretations.
Thank you very much for reading this long comment.