Patches for Stratagus 2.2.7

Got resources you'd like to share? Want to request some help with scripting or graphic creation? Then this is the place to be.
Post Reply
User avatar
Mikko Merikivi
Posts: 18
Joined: Fri Sep 13, 2013 9:04 pm

Patches for Stratagus 2.2.7

Post by Mikko Merikivi »

Use these as you like. I'm not confident enough in my programming abilities to commit them to Stratagus so I'll spam the forums instead.


Patch name: checkdependencies.txt

Description:
Check if dependencies are met. Returns true if they are and false if not.

Usage:
CheckDependency(player, object)

Example:
CheckDependency(AiPlayer(), "upgrade-dwarves-level2")


Patch name: formations.txt

Description:
The functionality to change what commands do, a.k.a. the formation system. I've included a full example of its usage in the documentation. Also includes the function GetSelection() which creates a table with the ID's of units we have selected. For multiple formations, you are also going to need the patch buttonluacall.txt.

Usage:
See the documentation.

Example:
See the documentation.


Patch name: buttonluacall.txt

Description:
Call a LUA function when a button is pressed.

Usage:
In DefineButton,
Action = "call-function", Value = "LuaFunctionToBeCalled",

Example:
function FormationBoxFormation ()
formation = 1
end

DefineButton( { Pos = 11, Level = 0, Icon = "boxformation",
Action = "call-function", Value = "FormationBoxFormation",
Key = "c", Hint = _("BOX FORMATION"),
ForUnit = {"*"} } )
Attachments
checkdependencies.txt
Check if dependencies are met. Returns true if they are and false if not.
(2.47 KiB) Downloaded 548 times
formations.txt
The formations patch for Stratagus 2.2.7
(19.48 KiB) Downloaded 508 times
buttonluacall.txt
Call a LUA function when a button is pressed.
(3.15 KiB) Downloaded 515 times
Last edited by Mikko Merikivi on Sat Oct 19, 2013 4:42 pm, edited 4 times in total.
User avatar
jarod42
Posts: 101
Joined: Fri Jan 20, 2012 7:43 pm

Re: Patches for Stratagus 2.2.7

Post by jarod42 »

applied (with some modification) the dependencies patch in rev.8832

You better to add them into launchpad next time, they risk to be lost in the forum...

thanks, by the way
User avatar
Mikko Merikivi
Posts: 18
Joined: Fri Sep 13, 2013 9:04 pm

Re: Patches for Stratagus 2.2.7

Post by Mikko Merikivi »

jarod42 wrote:applied (with some modification) the dependencies patch in rev.8832

You better to add them into launchpad next time, they risk to be lost in the forum...

thanks, by the way
Is there a "patches" tab somewhere or are you suggesting I commit them directly to the version control system? Because I wouldn't trust my code to be any good.


Also, the buttonluacall patch was added. It's hastily coded since as was told in the Customizable button functions thread, a functionality to do so already exists in the trunk version of Stratagus. However, in my opinion the solution sounded like a very convoluted way of calling a function when a button is pressed so I made this patch nevertheless. If it becomes redundant in the future versions of Stratagus, it won't be a big deal to me that way.
User avatar
Kyran
Posts: 499
Joined: Sat Dec 31, 2011 5:19 pm
Location: Australia
Contact:

Re: Patches for Stratagus 2.2.7

Post by Kyran »

Have faith, Jarod!
04:27 jim4 why haven't you added wc1 support? this project sucks. i'm only going to use freecraft
05:06 jim4 finished wc1 support yet? i've been waiting for 6 years
05:10 jim4 new things scare me
Jhenry
Posts: 1
Joined: Thu Apr 23, 2015 8:29 pm

Re: Patches for Stratagus 2.2.7

Post by Jhenry »

The functionality to change what commands do, a.k.a. the formation system. I've included a full example of its usage in the documentation. Also includes the function GetSelection() which creates a table with the ID's of units we have selected. For multiple formations, you are also going to need the patch buttonluacall.txt.
Post Reply