Jump to content
Sign in to follow this  
LLv34_Untamo

Lua scripting, how is it done?

Recommended Posts

S!

 

So, anyone know how? Any help would be welcome. Mission files contain pointers to lua script files (like: "LuaScripts\WorldObjects\Airfields\fakefield.txt") but if I look for that file in the Luascripts folder in game data folder, they aren't there :huh:

 

What can I do with Lua, how is it used in missions, etc. As said, any info is welcome.

 

Clarification: I am not looking for a Lua tutorial, just how to use it with BoS :)

Share this post


Link to post
Share on other sites

in short:

Lua is not supported by game engine. LuaScripts is legacy name of folder.

 

a bit longer:

During development RoF had several game engines. One of those engines supported lua scripting for some game objects.

Later several engines merged, some features were gained, some modules were lost due differences in engine design, etc.

Lua supporting module was one of those lost modules.

BoS uses modified RoF's engine, thus it got the same directory structure as RoF and the same legacy naming.

Share this post


Link to post
Share on other sites

S!

 

Okay, thanks for the answer. A follow up question would be, is there any kind of scripting support?

 

The problem is, that I (and I would assume others as well) find the tools we have in the editor a bit lacking.

 

Let's take the counter for example, it is great if you only have to count upwards. But what if I want to count backwards also, or plus and minus things together. Well, that I could do by making a complex combination of counters, timers, activators etc. But then, what if I want it so, that the counter doesn't reset when hitting the limit (it must, if I want to use the decrement operation, I basically loop the counter over the limit and to a value one less than the original) AND I want it to trigger also when coming downwards through the limit. As you see, this gets a bit complex to do with all those timers, counters etc. Scripting would be nice :)

 

EDIT:

I will tell exactly what I dream of doing:

There was a dogfight server in old IL-2 called the Warbirds-FH. It basically recreated the Warbirds / Aces High arena system. The map was filled with airfields, half blue, half red. You pick a field and a plane, and go attack the other side's field. When you have destroyed 90% of the fields objects, it goes "closed", no one can take off from that field when it is closed. When it is closed, if someone ferries in paratroops with a Ju-52, the field is conquered, and changes sides. The tricky part is to close the field fast enough and bring the troops in, as the objects each have a respawn timer. And if enough objects respawn, the field now has less than 90% objects destroyed, and it opens again. I basically would want to recreate this :) .. Of course I would have to make some other system to replace the currently non-human Ju-52s :)

 

So, I would need that counter to count the destroyed/alive objects as the get destroyed and respawn. With scripted logic, this would be easy to do. A simple if-statement structure would do.

Edited by LLv34_Untamo

Share this post


Link to post
Share on other sites

That is doable in the game without scripting...I have a counter in my missions on the AAA that will count up and down based on any trigger, in my case a zone counting up when aircraft enters (spawning AAA) and counting down when aircraft leaves or gets shot down (deactivating AAA).

 

You can change this counter's INC trigger to an "onKilled" event for your airfield objects and link the object's respawn to the DEC trigger or tweak it however you need. I'd link you the group file for the counter, but I'm in the process of moving and my computer is packed up. Alternatively, you can join the Eagle's Nest server and download the mission automatically, open it with the editor, and find the AAA groups within Russian/German airfields groups.

 

Your only challenge is finding a way for airifeld objects to respawn...it does not work in any iteration I've tried so far.

Share this post


Link to post
Share on other sites

S!

 

Thanks for the feedback! I will look into that Eagle's Nest server. Is the .mission -file saved in the Multiplayer folder automatically, or do I have to do something special?

Share this post


Link to post
Share on other sites

Only the msnbin is saved. You can use this in the editor by opening the editor, go to file, open, then start typing the filename of the msnbin file (TWB...) and it will show up in the list. Click it and click open and it should open up just like any .mission file.

 

All of the counters are attached to the AAA groups. You'll need to delete the complex triggers (named German/Russian aircraft enter) they're attached to and apply your own event/trigger if you want to.

 

On the counter itself (huge mass of timers/activate/deactivate triggers), each timer in the top row signifies the amount of the counts (they're numbered). If you want something to trigger on the 10th increase, link it to the 10th timer marked "10" on the top...if you want something triggered on a decrease do the same on the bottom row of numbered timers. Link your events to be counted to the object's on top and bottom..."INC" to increase count "DEC" to decrease count.

You'll probably have questions so I'll keep checking this thread, or just send me a PM.

Share this post


Link to post
Share on other sites

S!

 

Ok, thanks for the tip. I thought I needed the .mission file to open it in editor. Have to head for bed, will get that mission tomorrow.

Share this post


Link to post
Share on other sites

Just to reiterate, I imagine you'll be using buildings and static aircraft from the "blocks" section of the mission editor to count bases as destroyed, but you cannot, as far as I can tell, respawn those objects. This makes it so once a base is destroyed, it is destroyed for good...unless you use AAA or vehicles to be the trigger that counts for base destruction.

Share this post


Link to post
Share on other sites

S!

 

Just opened the file... bl**dy h*ll :D .. My editor's refresh rate isn't in FPS, it's in SPF :D .. Quite unresponsive too, I try to move and click around, nothing happens for a while :O

 

I don't know where to begin, or what to ask ... It's a bit overwhelming :)

 

Edit:

A guess, it's the "Team Objectives" group?

 

Edit2:

Oh boy, I really do wish the devs would give us either more tools / more versatile tools / scripting :) ... This is just messy. And that can't be very efficient to run on the server... Well, we must do with what were given.

Edited by LLv34_Untamo

Share this post


Link to post
Share on other sites

Click the little box up on the top left to enable the map GUI mode. It's a button next to the arrow pointing down toward a squiggly line. That will solve the fps issue.

 

Look in Airfields, Russian airfields, Verknaya Akhtbua (right click it and set as working group). Expand Verknaya Akhtbua and scroll down to Verknaya Akhtbua AAA (right click and set as working). From there you'll be able to find it on the map (or double click it in the list to move the camera to it) and manipulate the AAA system and copy/paste the counter system. Alternatively you can highlight the counters, right click, and save to selection to make a group file of it for later use.

Edited by AbortedMan

Share this post


Link to post
Share on other sites

I know it's not really what you are asking, but let me suggest an alternative approach, which also a bit more immersive.

 

Spawn a few tanks 5 minutes away from the airfield. Between the airfield and the tanks, put a handful of AT guns. Between the AT guns and the airfield, put a handful or high-calibre AA guns (flak38 and 61k, I think they are called). Then add a few flak37/58K flag cannons for good measure.

 

Let the tanks drive towards the airfield (after a preset time, or after x minutes after the AT gun is destroyed, or when all AT guns are destroyed, or let the attacking side start the ground attack by spawning into a specially-named plane), and let the airfield switch sides when the tanks reach their final waypoint.

 

In practice, this means that in order to capture the airfield, you have to destroy all/most of the flak38/61k guns, then destroy all AT guns. The success of the tanks is entirely tied to the destruction of all AT guns. If they are destroyed, the tanks will capture the airfield. If they are not destroyed, they should easily kill all the tanks.

 

This is an alternative way to achieve what you want to do, relying on battle mechanics instead of complex logic.

  • Upvote 1

Share this post


Link to post
Share on other sites

Click the little box up on the top left to enable the map GUI mode. It's a button next to the arrow pointing down toward a squiggly line. That will solve the fps issue.

Thanks, that did the trick :)

 

... From there you'll be able to find it on the map (or double click it in the list to move the camera to it) and manipulate the AAA system and copy/paste the counter system. Alternatively you can highlight the counters, right click, and save to selection to make a group file of it for later use.

Found it, but I have no idea how it works, or how to set the trigger limit to it :) ... There's 50 timers, 25 activator/deactivator pairs... Does that define the limit?

 

 

... This is an alternative way to achieve what you want to do, relying on battle mechanics instead of complex logic.

A nice scenario, but nah, I will try to do the thing I described :) .. I might replace the conquering with Ju-52 with what you described though as the Ju-52 isn't flyable... yet :)

Edited by LLv34_Untamo

Share this post


Link to post
Share on other sites

The timers are the triggers that define the limit. Top row is "onIncrease" event trigger, and a result of a signal to the "INC" counter...this would be tied to your objects "onKilled" event. Linking the trigger for airfield becoming disabled would be linked to timer 22 on the top if you want it available at 90% of 25 things destroyed.

 

Your objects' respawn trigger should be also linked to "DEC" to count things coming back. Be sure that you're using a separate timer and respawn/repair trigger for each object. Link the trigger for the airfield coming back up to timer 3 on the bottom if you want it available at 90% operational objects.

 

If you set it up like the way I'm describing, you're using the counter to count things destroyed on top, and things repaired on bottom. You can add more rows so it can count past 25, you just need to copy the counter's object structure to the right side and extend it as much as you need.

Share this post


Link to post
Share on other sites

S!

 

Okay, thanks for the explanation. I will try to digest its inner workings later. Tonight I had baby watch.. Damn offspring keeping us from the "important" stuff ;)

Share this post


Link to post
Share on other sites

Keep in mind this will be sooo much easier to explain when I get my computer and Internet up and running, if you don't understand what I'm trying to say right now don't worry...I'm doing this all from memory so I may be at fault.

Share this post


Link to post
Share on other sites

S!

 

@AbortedMan:

When do you get your compy running again? :) ... I need some help with your counter. I tried it, set up a ticker to call INC and a slower ticker to call the DEC. I set subtitle prints to inc and dec, and to the two what I think are the outputs. It seems that the counter triggers from first call to INC or DEC. What do I do wrong? :O

 

Counter

Share this post


Link to post
Share on other sites

I'm waiting for the Comcast guy right now to get my Internet running, he was supposed to be here yesterday but he secretly rescheduled for today with a 12 hour window of 8am to 8pm. So I took a day off of work and I'm twiddling my thumbs waiting.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...