Welcome Guest ( Log In / Register ) |
Quick Lists Top RatedTutorials Living World Map G… Ultimate beginner'… Arrow scaling bug… Raising Heroes max… Proper Fire Arrow… Creating an asset.… Simple Structure B… Making a simple Ma… Quick and easy sno… Making patrols nea… Mods The Dwarf Holds The Peloponnesian… RJ - RotWK The Elven Alliance… Helm's Deep Last H… The Elven Alliance Special Extended E… Kings of the West… RC Mod The Wars of Arda Downloads BFME1 1.06 Widescr… Enhanced W3D Impor… Fudge's Map Pack LotR/BfME HD Logos Osgiliath Shellmap Crystals Of Ancien… 2v1 Wold The forests of Dru… Converted BFME2 an… ROTWK animations f… |
|||||||||||||||||||||||
Register and log in to move these advertisements down Advanced LUA: Helper Functions
Table of Contents: Page 1: Introduction Page 2: A Hide Subobject Function Page 3: A Randomize Subobject Function Page 4: Storing things for easy access Introduction First I'll note: this stuff will likely apply to BFME2 as well, however it's untested in that environment (lua did change some, so it might not work). This tutorial is for the BFME user who already understands the basic use of lua, and wants to learn a bit more about ways of streamlining workflow. Actually writing these helper functions does require some proper scripting experience, so beware! In some ways this is more of a resource than a tutorial - anyone can use these script functions if they like. They deal with ways to automate tedious repetitive code writing or copy-pasting in this domain - in particular the primary use of lua code in BFME - randomizing weapons/accessories on a model. First, a little about the functions defined in scripts.lua. If you don't know where/what this file is, you should probably take a look at some other tutorials on lua in BFME first.
These are important in 3 ways: the first because it's good to know, the third because it's important to know when you've made a syntax error, and the second because it's the focus of this tutorial. I'm going to talk about how you can use other functions in the file in a 'primary' function - say, a hypothetical thing like
On to the article! CommentsDisplay order: Newest first Nertea (Team Chamber Member) - Tuesday December 22, 2009 - 9:25 lua tables aren't really pure arrays because of their interesting key/record system. I'm not really a programmer, but my experience with actual programming languages has shown that lua tables don't behave the same way, so I guess it's ok for them to call them something else. Kinda like python's lists really. Bart (Administrator) - Friday December 18, 2009 - 4:47 Nice tutorial. I wonder why LUA calls arrays tables though. Nertea (Team Chamber Member) - Saturday November 21, 2009 - 12:42 Glad it's a bit helpful. I do want to know if anybody uses this, and with what degree of success, partially for interest's sake and partially to see if it's worth writing up stuff about other lua script tricks that I've developed/am developing. Rob38 (Team Chamber Member) - Thursday November 19, 2009 - 17:29 Interesting. I also use lots of random stuff for my models so this can be very helpful. Sulherokhh (Team Chamber Member) - Wednesday November 18, 2009 - 5:39 Yippee! I love tuts like that, easily accessible and immediately useful. |
|||||||||||||||||||||||
"One site to rule them all, one site to find them, © All Rights Reserved Eric Edwards ©2013. |