Jump to content

Leadwerks Soldier Entity- and 3rd-Person Game Scripts


Masterxilo
 Share

Recommended Posts

I finally did something interesting with the soldier model. And learned lua!

I wrote an entity script for the model, that loads all the animations for it, creates a character controller, and lets you control it through simple messages

(which will also make the animations change).

The only thing left to do is controlling it with an AI script or through keyboard commands in a game script.

 

I did the latter and wrote another (3rd person) game mode for Editor that features the LE Mascot.

Here's what I came up with (soldier entity script & game script):

 

Files

For simplicity, I packed up only the required and converted files + my scripts of the soldier model and uploaded them again:

http://leadwerks.com/werkspace/index.php?/files/file/141-leadwerks-soldier-animated-entity-game-script-3rd-person-cam/

Simply unpack the zip in your model folder, open LE Editor and a map in there, set your game script to "soldierGame.lua" and hit Ctrl+G to run around in your own map with the model!

 

Since I'm still working on the scripts (and since they contain some additional descriptive text on the subject), I'll post them here too:

 

Scripts

Entity scripts

<removed it, too long, see "soldier.lua" in the zip>

 

Game script

<removed it, too long, see "soldierGame.lua" in the zip>

 

Images

post-150-12717075835254_thumb.jpg

post-150-12717075933983_thumb.jpg

post-150-12717076015622_thumb.jpg

post-150-1271707610432_thumb.jpg

 

Feel free to use the scripts as you like.

I just thought I'd share because I think I found good ways of handling (any amount of!) animations in lua and also a good way of controlling characters over messages.

And because another game mode is always fun to test maps.

 

---

Btw.

This model can be used as a game character just the way it is in any non-lua language easily, due to it's message based control system.

Here's what I'm working on:

post-150-12717076359593_thumb.jpg

...

 

- Paul

  • Upvote 1
Link to comment
Share on other sites

Works very well Paul, nicely done :) thanks for the share.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Having tried it out I'm really quite impressed. The model and animations are of a nice quality; so thanks to Josh for providing these and also to both the original modeller and subsequent animator. Thanks to Masterxilo too for sorting out the animation issue, the gmf conversion, providing the nice demo script and packaging it all up ... much appreciated.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

Maybe you've fallen through the ground? When you run the script and the camera is positioned close to the terrain it can drop through.

 

It's a great script, quite complex. I just added a third person cam to my game and using a place-holder but I might try using this with the soldier for now.

 

I notice that LODs in Leadwerks don't like animating in LUA, I suspect you have to interrogate the currently used LOD level and animate that mesh instead.

 

You can try it yourself by commenting out the call to the 3rdPersonCam function and move the character away. I have the same behaviour in static vehicles/objects that rotate child entities (tank turrets and such).

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

when you say the recent version is that the 2.32 beta or the normal 2.31

if beta then i would say it could be a bug and you should not use till it released

 

if 2.31 not sure lol

Asus ROG STRIX B350-F GAMMING

AMD Ryzen 7 1700x

32 gb ddr4

15 TB raid 5 HD

Nvidia EVGA 1060GTX

Win10 64bit

Link to comment
Share on other sites

  • 4 months later...

Has anyone else had any problems getting this to work in LE 2.40? I'm having no luck at all getting the model to animate, the 3rd person cam works fine and the character model loads, but no animations.

I confirm, got the same problem here with 2.4, the soldier moves but the animations don't play.

But the code is really interresting, thank you for sharing masterxilo, i'll try to learn something

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

The soldier.lua file is using

function object:Render()

This has been replaced in 2.32 to use

function object:Draw()

Thank you mack, it works now after replacer render by draw. :D

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...