<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://springrts-wiki.p2004a.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aiphee</id>
	<title>Spring - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://springrts-wiki.p2004a.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aiphee"/>
	<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/wiki/Special:Contributions/Aiphee"/>
	<updated>2026-11-08T19:12:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Animation-LuaScripting&amp;diff=2096</id>
		<title>Animation-LuaScripting</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Animation-LuaScripting&amp;diff=2096"/>
		<updated>2013-07-30T19:14:44Z</updated>

		<summary type="html">&lt;p&gt;Aiphee: Added some info how to edit and use.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Getting started ==&lt;br /&gt;
&lt;br /&gt;
=== Setup ===&lt;br /&gt;
&lt;br /&gt;
Lua unit animation is implemented partially in the engine, and partially in a Lua gadget which is shipped with Spring in springcontent.sdz. By default, gadget is not loaded, so a bit of setup is required to enable Lua unit scripts. (In some games, gadget is alredy activated, for example in Zero:k)&lt;br /&gt;
&lt;br /&gt;
To enable Lua unit scripts, create a file &#039;&#039;LuaRules/Gadgets/unit_script.lua&#039;&#039;, and paste the following into it:&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;4&amp;quot;&lt;br /&gt;
|style=&amp;quot;background: #41545c; border: 1px #aaa solid;&amp;quot;|&lt;br /&gt;
&amp;lt;small&amp;gt;&lt;br /&gt;
 -- Enables Lua unit scripts by including the gadget from springcontent.sdz&lt;br /&gt;
 &lt;br /&gt;
 -- Uncomment to override the directory which is scanned for *.lua unit scripts.&lt;br /&gt;
 --UNITSCRIPT_DIR = &amp;quot;scripts/&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 return include(&amp;quot;LuaGadgets/Gadgets/unit_script.lua&amp;quot;)&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Also, do check whether your [http://github.com/spring/spring/blob/master/installer/builddata/springcontent/LuaGadgets/system.lua &#039;&#039;LuaRules/system.lua&#039;&#039;] is up to date, if you copied this verbatim into your game. (Must be from a later date than 5 september 2009)&lt;br /&gt;
&lt;br /&gt;
Now this is done, you can start putting *.lua files in your &#039;&#039;scripts/&#039;&#039; folder.&lt;br /&gt;
&lt;br /&gt;
=== Workflow ===&lt;br /&gt;
&lt;br /&gt;
Lua has the major advantage over BOS/COB that you do not need to compile it, which can reduce the time to develop scripts quite a bit.&lt;br /&gt;
&lt;br /&gt;
To save further time, do not restart Spring for each small change. Simply run Spring in an window so you can easily switch between your editor and Spring, and use &#039;&#039;/cheat&#039;&#039; and &#039;&#039;/luarules reload&#039;&#039; to reload all Lua unit scripts.&lt;br /&gt;
&lt;br /&gt;
To be able to use commands above, unzip your game into directory named &amp;quot;myGame.sdd&amp;quot;, then you can directly change lua scripts (animations etc.) and reload.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Further reading ==&lt;br /&gt;
* [http://tvo.github.com/spring/2010/04/19/lus-stumpy.html Stumpy tutorial]&lt;br /&gt;
* [http://tvo.github.com/spring/2010/04/26/lus-stumpy-2.html Polishing the stumpy]&lt;br /&gt;
* [[Animation-LuaCallins]]&lt;br /&gt;
* [[Animation-LuaCallouts]]&lt;br /&gt;
* [[Animation-CobLuaDifferences | comparing Lua and COB unit scripts]]&lt;br /&gt;
* [[SpringTutorialGame]] contains simple  examples unit scripts&lt;br /&gt;
* [[SpringRtsTutorialAnimDef]] examples animation scripts&lt;br /&gt;
&lt;br /&gt;
== TODO ==&lt;br /&gt;
&lt;br /&gt;
* Conversion tool&lt;br /&gt;
* Performance measurements&lt;br /&gt;
* Link to article in piro&#039;s magazine&lt;br /&gt;
* Coordinate system (axis, direction of rotation, picture)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Animation]]&lt;/div&gt;</summary>
		<author><name>Aiphee</name></author>
	</entry>
</feed>