Lua mission builder

Lua mission builder

Various things about Spring that do not fit in any of the other forums listed below, including forum rules.

Moderator: Moderators

User avatar
mecha
Posts: 98
Joined: 30 Sep 2005, 09:53

Lua mission builder

Post by mecha »

Can someone please direct me to a tutorial on building singleplayer missions using either the lua mission builder in .73b1 or using the script template included in the install.

I have read through the example script and can see how everything is set up (units & buildings added etc) but cannot fathom how these are assigned a behaviour (ie what makes the factory keep making groups of units and sending them at you and what makes the builders keep building mexs and solars (is there a handover of all units at startup to a builtin version of AAI of NTAI?)

A pointer on using the lua mission builder in spring would be awesome too. I have combed through the wiki trying to find something and have searched previous posts with out much luck.

Cheers
User avatar
Felix the Cat
Posts: 2383
Joined: 15 Jun 2005, 17:30

Post by Felix the Cat »

As far as I can tell there is no tutorial - I've tried looking for some guidance on how to build scenarios before, to no avail.

Last time I asked about it, I was told that the Lua interface was barely functional... I don't know if it's changed since then (it's been a few versions), hopefully it has...
User avatar
hrmph
Posts: 1054
Joined: 12 May 2005, 20:08

Post by hrmph »

Hopefully in the future missions/campaigns will be a way to draw in more people to try out different mods. *Thinks about how cool an E&E campaign would be* *drool*
User avatar
diggz2k
Posts: 208
Joined: 04 Mar 2005, 06:34

Post by diggz2k »

I think we should add easy to use and versatile mission scripting to the mtr
Also add a campaign builder program.

These are two things that need to be on our most wanted list.
User avatar
Felix the Cat
Posts: 2383
Joined: 15 Jun 2005, 17:30

Post by Felix the Cat »

diggz2k wrote:I think we should add easy to use and versatile mission scripting to the mtr
Also add a campaign builder program.

These are two things that need to be on our most wanted list.
Generalize it and say more content creation tools. (i.e. map editor etc.)
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

The current campaign design system in LUA is buggy and broken. Maelstorm can provide details.
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Ahmm.. I think a "Assault the '88 guns!" Mission would be better (For Spring: 1944)
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

http://taspring.clan-sy.com/phpbb/viewt ... 8680#98680

Basically, the basic functionality is there, but not enough to make a propper mission. Or maybe the extra stuff IS there, we just dont know about it, cause there is NO documentation at all :(

If a kind dev/source-code-monekey would check out the LUA binding and at least tell us what functions are avaliable to us it would be MUCH apreciated.
User avatar
mecha
Posts: 98
Joined: 30 Sep 2005, 09:53

Post by mecha »

cheers for the advice.

Found out where the old testscript was broken too... rather than "loadunit" it should read. "units.load", easy enough to fix doing a "find and replace" type operation.

Maelstrom, if you know it, can you post the syntax for getting a factory to build a unit and how to return a pointer to that unit (ie so that it can be added to a list object for giving orders easily)

I was thinking of writing a kill the gate (or blow up the supply tunnel for the '44 enthusiast) mission. Kinda similar to the random spawn scripts (along with the progressing difficulty) except you've got a base to get through to get to the gate.

I reckon it'd be almost possible to set up a gaia player this way as well, I'm going to eperiment with setting up two ai teams with prebuilt bases which just throw units at each other (and yes you guessed it -from gates :-) )

I presume that by not setting the singleplayer only tab and setting the gaia team numbers as say 7 or 8 I will also be able run lan games along side the gaia teams.

EDIT: perhaps somebody knows the syntax for assigning a unit one of the ai's as well? ie the economy ai
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

I dont know how, i dont know if its even possible, all any of us has to work with is the testscript.lua. As I said, if any code monkeys wants to go diving in the source and tell us what functions are avaliable to us, it would be very appreciated.
tombom
Posts: 1933
Joined: 18 Dec 2005, 20:21

Post by tombom »

The only functions are

Code: Select all

namespace luafunctions 
{
	void EndGame();
	void UnitGiveCommand(CObject_pointer<CUnit>* u, Command* c);
	CObject_pointer<CUnit>* UnitGetTransporter(CObject_pointer<CUnit>* u);
	void CommandAddParam(Command* c, float p);
	CObject_pointer<CUnit>* UnitLoaderLoadUnit(std::string name, float3 pos, int team, bool buil);
	int GetNumUnitsAt(const float3& pos, float radius);
	luabind::object GetUnitsAt(lua_State* L, const float3& pos, float radius);
	std::string MapGetTDFName();
	luabind::object GetSelectedUnits(lua_State* L, int player);
	void SendSelectedUnits();
};
from rts\system\script
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

The lua bindings themselves are over here
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Post by PauloMorfeo »

diggz2k wrote:I think we should add easy to use and versatile mission scripting to the mtr
...
These are two things that need to be on our most wanted list.
I concur.

Anything, and i mean anything, that allows for the computer to have a big base for us to blow the crap out of it, or better, would be quite worth it. Even for non-newbies, as i, often, want to just pound the PC a little.
User avatar
mecha
Posts: 98
Joined: 30 Sep 2005, 09:53

Post by mecha »

Cheers for the link nimbus.

Any idea on what the parameters are to queue commands (ie sending units via a particular route like the current waypoint system) or to set the parameters for the area commands?

ie if I spawn a whole bunch of units in an area, how do I call the area load command for a transport to pick them all up? does this have to be done "the hard way" (scripting in individual locations and then waiting for these actions to be done before entering in new script commands)?

I also need to know how to set allies between different teams through the script? -Both of my gaia players are hostile :cry:

I have got a working two base system going with units being spawned near to gates (the idea is kill the gate and the units stop coming kind of thing).

Unfortunately at this point I am completely limited to scriptable actions so untill I get the nukes working it will be a bit predictable.

It may be interesting to do a sort of squad training thing... force people to micro a small amount of units around existing bases eg warcraft 3, with another squad being spawned in when the originals have all been destroyed
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

I've tried to do some of that stuff myself.
Setting teams as allies doesn't seem to be possible. In fact, Spring crashes if you try to assign units to a team other than 0 or 1. This is something I'd seriously like to see fixed/implemented.
The atlas behaviour you mention could probably be implemented by doing a slow update with units.GetAt(float3,radius), and giving the atlas load/unload orders as long as there are units in the table. But I do agree having every command available would be very, very handy indeed.
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

Bumpitydo.
Messing around with the luabinder code, I've managed to set the two teams as allies through the script. The problem is, vision is shared, but radar isn't. The ally doesn't show up on the minimap either.

Adding to the lua interface doesn't seem to difficult. Adding it decently is another matter.
User avatar
mecha
Posts: 98
Joined: 30 Sep 2005, 09:53

Post by mecha »

Thats no problem, I don't suppose its something like... actually I don't have a clue what the syntax for it would be, You'll be a legend if you can post that code up.

My two team thing is a bit boring at the moment, need to add more smarts.
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Post by Nemo »

Bumpish. If anyone gets this working, would they mind posting their code? This feature could be a lot of fun if its used well. Although crafting an entire campaign would be a bit much, a handful of linked missions for various mods (EE, Gundam, SWS, and 1944 stand out as mods that would be easy to tie to an interesting story and objective oriented missions)

I'm really looking forward to when full blown mission building becomes more popular - in some game communities I've seen, it rivals mapping in popularity.
User avatar
mecha
Posts: 98
Joined: 30 Sep 2005, 09:53

Post by mecha »

Here is my WIP so far

http://www.fileuniverse.com/?p=showitem&ID=3983

todo:
-get nimbuses code to set allies off him somehow!

-workout how to get the mission builder to include nonselectable items such as dragons teeth (thats why my base looks so weird... it had some fairly impressive fortification patterns when I started.

-incorporate the gates and build in the behaviour "if gate dies units stop coming"

-work out how to spawn a true ai player such as AAI into the game.

-work out how to code in waypoints... may have to just check if units are at a way point then send them off to the next one.

Please do not think that this is complete by any means. I am posting this as a draft so that the more experienced coders out there can help me with the issues I have described above
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Post by Michilus_nimbus »

-get nimbuses code to set allies off him somehow!
Well, I did it by modifying the lua interface, so you won't be able to just get it working on your side.
I can send you a modified spring.exe, but since I can only compile it with mingw, I don't think dumping it in your spring folder would work, so you'd probably have to download one of those auto builds to make it work. Anyhow, I'll post it today.

I basically added a gs.SetAlly(teamA,teamB,true/false) function, and also a stats.UnitsKilled(team nr)/stats.UnitsLost(team nr) function. I don't think it's properly implemented though. Spring likes crashing if you don't put SetAlly in the class constructor, and the stats functions like to ruin the party too sometimes.
Post Reply

Return to “General Discussion”