Well... I'm back in need of some more answers and guidance in general, but hopefully slightly less noobish this time. (I hid the long intro, but it might help you with any advice you'd be willing to give me)
I'll start by saying the reason I started modding was because of all the great campaign maps (Operation Ferret Master, Rebel Ops, Forcemaster's TCW Recreations etc.) and from the beginning I've always intended to learn how to make maps like those I just mentioned.
What this boils down to is I decided once I had basic skills in ZE and some baseline understanding how the different aspects of modding work I MUST learn how to use the LUA to make something different from your average map. I was hoping I could begin learning on my own and not have to bother all you kind-folks here with such a seemingly complicated subject, but I've had trouble getting started. For one thing I'm not very good in the first place at learning off of writing alone, I'm much more of a visual learner.
That leads me to the second thing, I CAN learn fairly well off of writing, but the information out there on LUA scripting is so vast that I can't find a place to start, and when I do find something that I'm looking for by the time I finish what I was reading I can't remember most of it (for the record, I don't have a learning disability, and I am also a decently speedy reader) so I thought it was time to make a thread formally asking for some assistance, to me personally.
If there's a better time (like once you've MASTERED ZE, and GIMP and all that stuff) to learn LUA scripting let me know, Otherwise I'm going to do my best to learn now.
So without further ado than all that, here are my main questions:
1: Is there something you have to do (e.g. make it into a campaign mode somehow) before you can do things like Localized Popups?
2: (I put all my lines under ScriptPoastLoad) If not, why is nothing I am trying to get popups to show working (OnRegionEnter, OnFirstSpawn, etc.) I'm pretty sure I'm localizing correctly, I do it in the fashion the stock campaign messages are done, I munged localize and all that, also I've tryed different types of code,(replacing the localize tool's level.ABC.message for my own) cutting out parts of the stock code that didn't apply, to code cut from threads here on gametoast that other users said was working for them. Nothing happens. No munge error, no debug log error, nothing. nothing happens when I test my map out either. One last note, I replace the stock units on the side I'm using with the stock Pilot Luke (if that makes a difference)
Sorry for the massive amount of writing and perhaps meaningless details, I currently don't have access to my PC with the LUA on it and as such felt I should be as detailed as possible. As always I appreciate any and all help/advice you can give, thank you for your time.
And my advice: start small. Don't make a campaign map. Script an elevator or a health regen (see Mav's Kolto Tank assets for an idea on how), script whatever takes less than fifty lines of code.
Yes, I spent quite a bit of time looking over those before I thought about posting this thread (thanks for posting just the same) and was overwhelmed by all the different information floating around, I was having a rather hard time singling out where to start, which is why fiodis also helped me greatly with such a simple post (as usual) thanks guys
Re: I wish to learn the ways of the LUA
Posted: Sun Apr 11, 2010 10:33 am
by Master_Ben
The thing is, a lot of the things in the FAQ are way too specific to learn off of.
I learned LUA (and I feel fairly comfortable in the environment, give me almost anything possible to script and I could do it) by first reading through the shipped docs. The one called bf2_scripting_system I read later on in my learnings, you won't really understand a lot of it when starting off, but I read the other two much sooner. It might even help to print them out and read them, I did for at least one of them.
Once you read these things over, study scripts that you see around you and try to figure out what they mean. I suggest using the mission scripter and create a few, really simple objectives (really simple, just to see what they mean), and then export the script, read it, and trying to figure out what it actually means (if you put it ingame, be sure to fix the layer load typo it makes, that killed me for ages).
Next, try to script something simple from scratch, like Fiodis said, and try to make something already out there. Complete, bit by bit, bigger and bigger challenges, up until you try to script, say, a game mode that's already been made with its source script released. Once you feel you're approaching something big like that, be sure to read bf2_scripting_system at some point. If you get stuck, look back to the script that was released and see what's going on wrong with you.
A lot of scripting can be simple copy-pasting and editing when you start off. That's okay. Just keep at it and you'll get to typing it all yourself.
Eventually you'll get to a chance to script something big, I'd suggest a simple game mode. Try making a basic wave mode, or invent something new. Before you know it, you'll find you understand many things, and you'll be able to do more and more things.
Hope this is clear, I got very little sleep last night.
Re: I wish to learn the ways of the LUA
Posted: Sun Apr 11, 2010 10:53 am
by AgentSmith_#27
Hidden/Spoiler:
[quote="Master_Ben"]The thing is, a lot of the things in the FAQ are way too specific to learn off of.
I learned LUA (and I feel fairly comfortable in the environment, give me almost anything possible to script and I could do it) by first reading through the shipped docs. The one called bf2_scripting_system I read later on in my learnings, you won't really understand a lot of it when starting off, but I read the other two much sooner. It might even help to print them out and read them, I did for at least one of them.
Once you read these things over, study scripts that you see around you and try to figure out what they mean. I suggest using the mission scripter and create a few, really simple objectives (really simple, just to see what they mean), and then export the script, read it, and trying to figure out what it actually means (if you put it ingame, be sure to fix the layer load typo it makes, that killed me for ages).
Next, try to script something simple from scratch, like Fiodis said, and try to make something already out there. Complete, bit by bit, bigger and bigger challenges, up until you try to script, say, a game mode that's already been made with its source script released. Once you feel you're approaching something big like that, be sure to read bf2_scripting_system at some point. If you get stuck, look back to the script that was released and see what's going on wrong with you.
A lot of scripting can be simple copy-pasting and editing when you start off. That's okay. Just keep at it and you'll get to typing it all yourself.
Eventually you'll get to a chance to script something big, I'd suggest a simple game mode. Try making a basic wave mode, or invent something new. Before you know it, you'll find you understand many things, and you'll be able to do more and more things.
Hope this is clear, I got very little sleep last night. [/quote]
Thank you very much, this is very helpful, (that was my problem with the FAQ) I will follow yours (and fiodis') advice, as it is very clear (to me anyway)
Re: I wish to learn the ways of the LUA
Posted: Sun Apr 11, 2010 11:51 am
by Eggman
The scripts from the shipped maps are a great reference source. I learned the basics essentially by opening up the scripts in the assets alongside whatever script I was working on at the time and using them as a guide for where everything needed to go. If you were to look at my scripts for the Aldura Campaign missions, you would find that they organized in almost the exact same way as the shipped campaign scripts (especially the earlier renditions, such as the original Beachhead map).
When you do get started on objectives, I recommend starting with a "Goto" objective (entering a region placed in ZE). These are absolutely the easiest objectives to script and you can find examples in pretty much every shipped campaign mission.
Personally, I'd advise against using the Mission Scripter. You'll probably learn better if you just dive in and do everything on your own from the beginning. Also, you don't have to worry about errors made by the tool itself.
If you find yourself wallowing in confusion for a while, don't worry, I'm sure it happens to pretty much everyone when they first try working with the .lua files for this game. It might take some time to get the basics down, but once you do you'll be able to throw together scripts in no time at all.
Re: I wish to learn the ways of the LUA
Posted: Sun Apr 11, 2010 9:22 pm
by Master_Ben
Eggman wrote:Personally, I'd advise against using the Mission Scripter. You'll probably learn better if you just dive in and do everything on your own from the beginning. Also, you don't have to worry about errors made by the tool itself.
I suggest using it myself, but only to observe how everything works. I certainly don't use it anymore, now that I've gotten into different levels.
Re: I wish to learn the ways of the LUA
Posted: Sun Apr 11, 2010 9:53 pm
by AgentSmith_#27
I'm thinking I'll play/look through the campaigns in game/scripts again at some point, and observe what the codes actually do in game, and probably mess around in Mission Scripter, creating objectives just to see how the different lines of code work together to create an objective, but never to actually setup an objective unless I'm absolutely helpless. My overall goal is
It might take some time to get the basics down, but once you do you'll be able to throw together scripts in no time at all.
and I'd wager if I follow your advice properly, and apply myself I'll be able to accomplish just that
Re: I wish to learn the ways of the LUA
Posted: Sun Apr 11, 2010 10:30 pm
by lucasfart
Also, if you try scripting a campaign, munge and try it after every objective. that way, if you make a mistake, you know where to look instead of having to check the whole thing through...
Re: I wish to learn the ways of the LUA
Posted: Mon Apr 12, 2010 4:04 am
by [RDH]Zerted
AgentSmith_#27 wrote:...I was having a rather hard time singling out where to start...
You start with all the documentation from the mod tools. If you don't understand programming concepts such as functions and if statements, then you also need to read Lua's general programming tutorials (You should read them anyway. You really understand everything better if you know what you're looking at.) Then you go back and reread the mod tool documentation in the areas you're interested in (I still reference those docs). Then you move onto Fred's site and all of his documentation and forums. Afterwards, you can start going through Gametoast's tutorials and posts. Just about everything has been asked and answered on here before. I rarely see new questions being asked. Even the recent 'how randomly change XXXX' questions have mostly been answered before.
If you want to see how something was done, you look through the code and find it. Read through the game's scripts and assets. Walk through how it does something then copy that code and get it working. Next, make the code better and just keep the parts you need for your mod. All of the game's scripts are public, almost all of my stuff is online, and there are many more resources online too.
Make things. But when you do, do it in small steps. Even one objective at a time can be too big. You don't want to have to play through all your past objectives to test the new one. Get each objective working by itself just as code, then start to link and put them together into a campaign (if that's what you're trying to make)
Yes, all that takes time. And if you do take the time, it pays off.