<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.sandboxgamemaker.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hirato</id>
		<title>Platinum Arts Sandbox Free 3D Game Maker - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.sandboxgamemaker.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hirato"/>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Special:Contributions/Hirato"/>
		<updated>2026-05-02T22:25:23Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender4.jpg&amp;diff=1940</id>
		<title>File:Pas to blender4.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender4.jpg&amp;diff=1940"/>
				<updated>2012-11-18T00:02:18Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender3.jpg&amp;diff=1939</id>
		<title>File:Pas to blender3.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender3.jpg&amp;diff=1939"/>
				<updated>2012-11-18T00:00:41Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender2.jpg&amp;diff=1938</id>
		<title>File:Pas to blender2.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender2.jpg&amp;diff=1938"/>
				<updated>2012-11-17T23:59:44Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender1.jpg&amp;diff=1936</id>
		<title>File:Pas to blender1.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender1.jpg&amp;diff=1936"/>
				<updated>2012-11-17T23:58:38Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: moved File:Blender to pas1.jpg to File:Pas to blender1.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=File:Blender_to_pas1.jpg&amp;diff=1937</id>
		<title>File:Blender to pas1.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=File:Blender_to_pas1.jpg&amp;diff=1937"/>
				<updated>2012-11-17T23:58:38Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: moved File:Blender to pas1.jpg to File:Pas to blender1.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[File:Pas to blender1.jpg]]&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender1.jpg&amp;diff=1935</id>
		<title>File:Pas to blender1.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=File:Pas_to_blender1.jpg&amp;diff=1935"/>
				<updated>2012-11-17T23:57:22Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Soundtrack&amp;diff=1873</id>
		<title>Soundtrack</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Soundtrack&amp;diff=1873"/>
				<updated>2012-08-26T16:46:33Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A list of songs used in Platinum Arts Sandbox. From 2.7.1 and on, Sandbox uses music from Cork279, a forum member. Feel free to add more information and improve the page&lt;br /&gt;
&lt;br /&gt;
=From 2.7 and Before=&lt;br /&gt;
*This list is found in PlatinumArtsSandbox2.7/packages/music/License&lt;br /&gt;
&lt;br /&gt;
==Artificial-World.ogg==&lt;br /&gt;
*Composed by mindthings&lt;br /&gt;
*Downloaded from http://www.newgrounds.com/audio/listen/119771&lt;br /&gt;
*license CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==Home.ogg==&lt;br /&gt;
*Composed by Farmin&lt;br /&gt;
*Downloaded from http://www.newgrounds.com/audio/listen/102106&lt;br /&gt;
*license CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==Last-Flight.ogg==&lt;br /&gt;
*Composed by Reasoner&lt;br /&gt;
*Downloaded from http://www.newgrounds.com/audio/listen/131755&lt;br /&gt;
*License CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==Sense-of-Happiness.ogg==&lt;br /&gt;
*Composed by Developer&lt;br /&gt;
*Downloaded from http://www.newgrounds.com/audio/listen/123025&lt;br /&gt;
*License CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==Transition.ogg==&lt;br /&gt;
*Composed by Puggin&lt;br /&gt;
*Downloaded from http://www.newgrounds.com/audio/listen/136436&lt;br /&gt;
*License CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==traveling_minstrels.ogg==&lt;br /&gt;
*Composed by Mattias Westlund&lt;br /&gt;
*Taken from the Battle For Wesnoth Soundtrack&lt;br /&gt;
&lt;br /&gt;
==Rusted-Toys.ogg==&lt;br /&gt;
*Composed by Mo-Tech&lt;br /&gt;
*Downloaded from http://www.newgrounds.com/audio/listen/96193&lt;br /&gt;
*License CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==Island-Shores-at-Night.ogg==&lt;br /&gt;
*Composed by SBB&lt;br /&gt;
*Downloaded from http://www.newgrounds.com/audio/listen/79665&lt;br /&gt;
*License CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==Silent-Tears.ogg==&lt;br /&gt;
*Composer: Calvin Briggs (Dj-Flux)&lt;br /&gt;
*Download location: http://www.newgrounds.com/audio/listen/186589&lt;br /&gt;
*license CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==Valley_of_the_Wind.ogg==&lt;br /&gt;
*Composer (DJ) Bjra&lt;br /&gt;
*Download Location: http://www.newgrounds.com/audio/listen/251469&lt;br /&gt;
*license: CC-BY-NC-SA&lt;br /&gt;
&lt;br /&gt;
==losingyourlogic.ogg==&lt;br /&gt;
*Composer: Howard Lockward&lt;br /&gt;
*Download Location: http://www.newgrounds.com/audio/listen/293208&lt;br /&gt;
*license: CC-BY-NC-SA&lt;br /&gt;
**Not used in any versions, but included in 2.7. Information found under PlatinumArtsSandbox2.7/packages/music/Song License.txt&lt;br /&gt;
&lt;br /&gt;
=From 2.7.1 and On=&lt;br /&gt;
*All music was created by Cork279, aka &amp;quot;R-Y-S-E&amp;quot;. See more of his work on [http://soundcloud.com/r-y-s-e Soundcloud].&lt;br /&gt;
*All music is released under a CC-BY license.&lt;br /&gt;
==Agent.ogg==&lt;br /&gt;
==Blue.ogg==&lt;br /&gt;
==Brilliance.ogg==&lt;br /&gt;
==Jingle.ogg==&lt;br /&gt;
&lt;br /&gt;
==Secrets.ogg==&lt;br /&gt;
==Taunt.ogg==&lt;br /&gt;
==Truth.ogg==&lt;br /&gt;
==Wild.ogg==&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Cubescript&amp;diff=1869</id>
		<title>Cubescript</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Cubescript&amp;diff=1869"/>
				<updated>2012-08-06T13:15:32Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: delayed evaluation and early termination of logical statements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cubescript is the scripting language utilised within the sauerbraten/cube2 engine. it is used to set aliases, variables, create binds and generate the menu.&lt;br /&gt;
&lt;br /&gt;
=Writing in Cubescript=&lt;br /&gt;
&lt;br /&gt;
==Aliases==&lt;br /&gt;
&lt;br /&gt;
The brunt of cubescript is concerned with Aliases. Aliases have 3 basic uses.&lt;br /&gt;
* store lists and values for extended periods of time&lt;br /&gt;
* store temporary lists and values&lt;br /&gt;
* grouping a set of commands which are useful when combined&lt;br /&gt;
&lt;br /&gt;
There are two ways to declare an alias. You can do it via infix notation, or by using the alias command. It should be noted that aliases are the exception to the rule, infix notation is only available for creating aliases.&lt;br /&gt;
&lt;br /&gt;
A VERY important note, alias specific operations are available to aliases only. this means builtin variables can&amp;#039;t be set or overridden through alias, =, pop and push (among others).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //command&lt;br /&gt;
  alias myalias [1]&lt;br /&gt;
  &lt;br /&gt;
  //infix variant&lt;br /&gt;
  myalias = [1]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===executing aliases===&lt;br /&gt;
&lt;br /&gt;
To execute an alias, you execute it like any other command. if I had an alias named &amp;#039;&amp;#039;&amp;#039;myalias&amp;#039;&amp;#039;&amp;#039;, I would simply invoke &amp;#039;&amp;#039;&amp;#039;&amp;#039;/myalias&amp;#039;&amp;#039;&amp;#039; to execute it.&lt;br /&gt;
&lt;br /&gt;
These aliases also have access to a class of special aliases. Those are the temporaries in which arguments are stored. There&amp;#039;s also a useful variable named &amp;#039;numargs&amp;#039; which tell you how many arguments were provided. The aliases containing the arguments are named arg. they are numbered and enumerated, starting from 1, so you&amp;#039;d use $arg1 to access the first argument. This does not start at 0, since arg0 is the command&amp;#039;s name (arg0 is also not defined.. ever, nor included in numargs).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //prints all arguments to screen, one by one&lt;br /&gt;
  //see the other comments for an explanation&lt;br /&gt;
  &lt;br /&gt;
  print = [                                    //declares an alias named print&lt;br /&gt;
    loop i $numargs [                          //loops $numargs times, setting i to the current iteration&lt;br /&gt;
      echo (getalias (concatword arg (+ $i 1)) //gets the value of the arguments, by accessing $arg1 $arg2 $arg3....&lt;br /&gt;
    ]                                          //close loop&lt;br /&gt;
  ]                                            //close print alias&lt;br /&gt;
  print I like unicorns                        //should print I like unicorns on 3 separate lines&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===push and pop===&lt;br /&gt;
&lt;br /&gt;
Push and pop used to be two separate instructions, but since the advent of the new Cubescrpt interpreter/compiler (2.6.1), they have been merged into a single instruction. The syntax for this singular stack manipulation command is as follows.&lt;br /&gt;
&lt;br /&gt;
push variable value body&lt;br /&gt;
&lt;br /&gt;
The stack is automatically popped after execution&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;candy&amp;quot;&lt;br /&gt;
  push myalias &amp;quot;lollipops&amp;quot; [&lt;br /&gt;
    echo $myalias&lt;br /&gt;
  ]&lt;br /&gt;
  echo $myalias&lt;br /&gt;
  &lt;br /&gt;
  //expected output&lt;br /&gt;
  //lollipops&lt;br /&gt;
  //candy&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&lt;br /&gt;
Cubescript is not your typical scripting language. Cubescript is not the most flexible, or the best language, but it more than adequate for our needs and purposes. Cubescript draws its main inspiration from quakescript and from Lisp. It is therefor said that Cubescript contains many &amp;quot;Lispisms&amp;quot;. Below is a summary of notable features/quirks.&lt;br /&gt;
&lt;br /&gt;
* comments are denoted by //&lt;br /&gt;
* both newlines and ; denote the end of a call.&lt;br /&gt;
* newlines will automatically close of any strings you may have forgotten to. (you should not rely on this)&lt;br /&gt;
* substitutions are done through the use of $ and @ tokens, (See below)&lt;br /&gt;
* everything is a function which may take arguments. With the exception of setting an alias, infix notation does not exist&lt;br /&gt;
* there are no arrays or vectors, only lists.&lt;br /&gt;
* most implementations have a 25 word limit. This means commands can be invoked with up to 24 arguments&lt;br /&gt;
&lt;br /&gt;
one liner example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias hi [say &amp;quot;hi&amp;quot;; sleep 5000 [say &amp;quot;Hi again&amp;quot;]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
multi liner example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias hi [&lt;br /&gt;
    say &amp;quot;hi&amp;quot;&lt;br /&gt;
    sleep 5000 [&lt;br /&gt;
      say &amp;quot;Hi again&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it&amp;#039;s obvious what the above code does, it&amp;#039;ll make your character say hi, and wait 5 seconds before saying hi again.&lt;br /&gt;
&lt;br /&gt;
indenting is done in levels, the Tabulator (TAB) key is usually used to indent the text. while not necessary, it tends to make it bigger, and more legible as seen in the above example (when you get to big stuff, you&amp;#039;ll thank yourself for indenting it.&lt;br /&gt;
&lt;br /&gt;
As a rule of thumb, pretty much only [ increases the indentation level. Also note, &amp;quot;, ] and ) can close each other, so make sure you close them off properly&lt;br /&gt;
&lt;br /&gt;
==containers==&lt;br /&gt;
&lt;br /&gt;
Containers in cubescript are of 3 specific types, &amp;quot;&amp;quot;, () and [] - all of these have significant differences in operation and use&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;&amp;quot; container===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot; containers are used to store things EXACTLY as they are written, with a few small exceptions - in-text commands which are denoted by a preceding ^. They are as follows&lt;br /&gt;
&lt;br /&gt;
* ^f#&lt;br /&gt;
** ^f# is used to colour text. # must be replaced by either a number or a capital letter (A-Z). r and s are special control characters which will restore and save the text&amp;#039;s current colour respectively. &lt;br /&gt;
* ^n&lt;br /&gt;
** insert a &amp;#039;\n&amp;#039; character (newline/linefeed)&lt;br /&gt;
* ^t&lt;br /&gt;
** inserts a &amp;#039;\t&amp;#039; character (tabulator)&lt;br /&gt;
* ^&amp;quot;&lt;br /&gt;
** inserts a quote (&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
===() container===&lt;br /&gt;
&lt;br /&gt;
() containers are used mainly for logic/arithmetic operations. They are usually nested inside [] blocks, and unless they are nested inside []&amp;#039;s they&amp;#039;re permanently substituted with their results.&lt;br /&gt;
&lt;br /&gt;
For example - the following will turn into an infinite loop. The condition is initially evaluated and substituted with one and since 1 can never = 0, it&amp;#039;s true forever more&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  i = 0&lt;br /&gt;
  while (= $i 0) [i = (+ $i 1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the following code on the otherhand is devoid of such issues. Being nested inside the [] means it&amp;#039;s not substituted and evaluated each cycle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  i = 0&lt;br /&gt;
  while [= $i 0] [i = (+ $i 1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[] container===&lt;br /&gt;
&lt;br /&gt;
This container is used for nesting, deferring execution of it&amp;#039;s contents, deferring calculations and substitutions of () containers, and substitutions of aliases/variables written with a @ prefix (note several levels are needed to achieve this). [] containers are also the ONLY container capable of spanning multiple lines.&lt;br /&gt;
&lt;br /&gt;
This is the most used container and due to it&amp;#039;s properties, is ideal for creating aliases.&lt;br /&gt;
&lt;br /&gt;
generally statements in cubescript can&amp;#039;t span multiple lines. If you should use this container and occupy several, the execution of the prior command continues exactly where this container finished off. This can be demonstrated with an if statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  if 1 [&lt;br /&gt;
    do&lt;br /&gt;
    stuff&lt;br /&gt;
  ] [&lt;br /&gt;
    do&lt;br /&gt;
    other&lt;br /&gt;
    stuff&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also on the subject of if statements, logical operators like &amp;amp;&amp;amp; and || in fact execute its arguments iteratively. This allows us to make use of [] to delay evaluation of conditionals. As we learned in the () section, when an instance is encountered it is immediately executed and substituted with its result. This method also allows us to terminate these logical checks early if some exit condition is met (ie, a false result is encountered with &amp;amp;&amp;amp;) without evaluating all the conditions)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 var1 = 2&lt;br /&gt;
 var2 = 3&lt;br /&gt;
 var3 = 10&lt;br /&gt;
 &lt;br /&gt;
 //a traditional if with multiple conditions&lt;br /&gt;
 if (&amp;amp;&amp;amp; (= $var1 2) (&amp;gt;= $var2 4) (&amp;amp; $var3 2)) [] []&lt;br /&gt;
 &lt;br /&gt;
 //This is in fact interpreted as follows; since () denotes immediate substitution&lt;br /&gt;
 //While early termination does work, all of the conditionals are evaluated, rendering it somewhat moot.&lt;br /&gt;
 if (&amp;amp;&amp;amp; 1 0 2) [] []&lt;br /&gt;
 &lt;br /&gt;
 //We can rewrite this to make proper use of delayed evaluation and early termination as follows&lt;br /&gt;
 //While this example doesn&amp;#039;t show it, like C this is very useful if you need an earlier condition to be true&lt;br /&gt;
 //for subsequent conditions; ie C: if(ptr &amp;amp;&amp;amp; ptr-&amp;gt;val) {} which terminates early if ptr is NULL.&lt;br /&gt;
 if (&amp;amp;&amp;amp; [= $var1 2] [&amp;gt;= $var2 4] [&amp;amp; $var3 2]) [] []&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==substitution==&lt;br /&gt;
&lt;br /&gt;
there are two principle ways of substituting values in cubescript, the first is through the use of $ tokens, the second is through the use of @ tokens.&lt;br /&gt;
&lt;br /&gt;
a very simple example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = 5&lt;br /&gt;
  echo $myalias&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
myalias is substituted into the echo statement, so you should see 5 printed to the top-left of the screen&lt;br /&gt;
&lt;br /&gt;
using the @ token would have also resulted in the same behaviour&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = 5&lt;br /&gt;
  echo @myalias&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There&amp;#039;s a big difference between the two, the @ token can be used to concatenate stuff together, $ can&amp;#039;t. @ is also substituted immediately up to the first level of nesting. (this can be incremented by using additional @ tokens, ie @@ for 2 levels of nesting). Do take note that too few @ tokens may cause a substitution to happen too late, and too many may likewise cause it to happen too early or cause other weird and subtle issues.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;An example of use in a level 1 nest&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;I am awesome&amp;quot;&lt;br /&gt;
  mymenu = [guitext @myalias]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
if you were to type /echo $mymenu, it should read: guitext &amp;quot;I am awesome&amp;quot;; using the $ token on the other hand&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;I am awesome&amp;quot;&lt;br /&gt;
  mymenu = [guitext $myalias]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
typing /echo $mymenu should produce: guitext $myalias&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;An example of concatenation&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
as i mentioned, @ also allows you to concatenate stuff together, which could result in shorter and simpler scripts. It should be noted that this can also result in extreme obfuscation&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias0 = 5&lt;br /&gt;
  myalias1 = 3.1415&lt;br /&gt;
  myalias2 = 2.481&lt;br /&gt;
  &lt;br /&gt;
  loop i 3 [ do [&lt;br /&gt;
    echo $myalias@i&lt;br /&gt;
  ]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
this should print 5, 3.1415 and 2.481 respectively&lt;br /&gt;
&lt;br /&gt;
the purely $ token equivalent&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias0 = 5&lt;br /&gt;
  myalias1 = 3.1415&lt;br /&gt;
  myalias2 = 2.481&lt;br /&gt;
  &lt;br /&gt;
  loop i 3 [&lt;br /&gt;
    echo (getalias (concatword myalias $i))&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Lookup of a Lookup&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are two ways to look up multiple things; the first is by encasing it inside &amp;#039;getalias&amp;#039;, the second involves using multiple lookup tokens. There is a caveat with the second method, while it works on more types, it&amp;#039;s only available in sandbox as of 2.6.1.&lt;br /&gt;
&lt;br /&gt;
All 3 of the below examples should print &amp;quot;victory!&amp;quot;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias1 = &amp;quot;alias2&amp;quot;&lt;br /&gt;
  alias2 = &amp;quot;alias3&amp;quot;&lt;br /&gt;
  alias3 = &amp;quot;victory!&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //the first method&lt;br /&gt;
  echo (getalias (getalias $alias1))&lt;br /&gt;
  &lt;br /&gt;
  //the second method; 2.6.1&lt;br /&gt;
  echo $$$alias1&lt;br /&gt;
  &lt;br /&gt;
  //to show compatibility with @&lt;br /&gt;
  do [&lt;br /&gt;
    echo $$@alias1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Branching/Decisions==&lt;br /&gt;
&lt;br /&gt;
Decisions are based on 6 key commands, &amp;#039;&amp;#039;&amp;#039;if&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;cond&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;case&amp;#039;&amp;#039;&amp;#039; (integer), &amp;#039;&amp;#039;&amp;#039;casef&amp;#039;&amp;#039;&amp;#039; (float) and &amp;#039;&amp;#039;&amp;#039;cases&amp;#039;&amp;#039;&amp;#039; (string). There are also other ways to do this. For example you might be able to easily query something about an object, where it&amp;#039;s obviously unique. You would then execute an alias whose name has this unique bit attached onto the end. This is an advanced method and is generally not recommended. &lt;br /&gt;
&lt;br /&gt;
===if and ?===&lt;br /&gt;
&lt;br /&gt;
Arguments: Cond True False&lt;br /&gt;
&lt;br /&gt;
Unlike most other languages, cubescript&amp;#039;s &amp;#039;&amp;#039;&amp;#039;if&amp;#039;&amp;#039;&amp;#039; contains an implicit else, in short we do not have an else statement. The provided condition is true if it ends up as a series of alpha numerics, or in the case of a number, as a value other than 0. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias1 = 5&lt;br /&gt;
  myalias2 = &amp;quot;woot&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //if else-if else&lt;br /&gt;
  if $myalias1 [&lt;br /&gt;
    echo &amp;quot;myalias1 is true&amp;quot;&lt;br /&gt;
  ] [&lt;br /&gt;
    //this shows the alpha numerics case&lt;br /&gt;
    if $myalias2 [&lt;br /&gt;
      echo &amp;quot;myalias1 is false and myalias2 is true&amp;quot;&lt;br /&gt;
    ] [&lt;br /&gt;
      echo &amp;quot;myalias1 is false and myalias2 is false&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039; acts exactly the same way, but there&amp;#039;s one HUGE difference. &amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039; does not execute the chosen result.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //an example of where ? can be used where if would fail&lt;br /&gt;
  items = 1&lt;br /&gt;
  echo (format &amp;quot;You are carrying %1 item%2.&amp;quot; $items (? (= $items 1) &amp;quot;&amp;quot; &amp;quot;s&amp;quot;))&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===cond===&lt;br /&gt;
&lt;br /&gt;
basically you provided a several pairs of arguments, the first half of the pair is the condition, and the second is the result. To put it in a programming perspective, this is like creating a long line of if else&amp;#039;s together. Execution stops when the first condition is matched. Should you place several conditions where more than one may be true at any one time, only the first will be executed. &lt;br /&gt;
&lt;br /&gt;
The following example assumes you have a light entity selected&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  lightstrength = [&lt;br /&gt;
    cond [&amp;lt; (ea 0) 0] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s like a black hole!&amp;quot;&lt;br /&gt;
    ] [= (ea 0) 0] [&lt;br /&gt;
      echo &amp;quot;Blindlier than science!&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 8] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s weaker than Billy&amp;#039;s night light!&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 32] [&lt;br /&gt;
      echo &amp;quot;Nice night light you got there&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 96] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s like a lamp, but it&amp;#039;s not a lamp&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 512] [&lt;br /&gt;
      echo &amp;quot;By Jove! I can actually see the ground!&amp;quot;&lt;br /&gt;
    ] [&amp;gt;= (ea 0) 512] [&lt;br /&gt;
      echo &amp;quot;Dark places are icky, don&amp;#039;t you agree?&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===case===&lt;br /&gt;
&lt;br /&gt;
This works similar to switches in most programming languages. The biggest difference is that you can&amp;#039;t break out, nor evaluate multiple cases (aka, fallthroughs).&lt;br /&gt;
&lt;br /&gt;
The first argument tells it which variable to use. The following arguments are given in pairs, the first half is the state, the second is the result.&lt;br /&gt;
If the state is a null type, it is considered the default case. The easiest way to generate a null type is to use ()&lt;br /&gt;
&lt;br /&gt;
The following example requires a particles entity to be selected, it will print out what type it is. Do note that this example exceeds the 25 word limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  parttype = [&lt;br /&gt;
    pname = &amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    case (ea 0) 0 [&lt;br /&gt;
      pname = &amp;quot;Fire and Smoke&amp;quot;&lt;br /&gt;
    ] 1 [&lt;br /&gt;
      pname = &amp;quot;Fire&amp;quot;&lt;br /&gt;
    ] 2 [&lt;br /&gt;
      pname = &amp;quot;Smoke Plume&amp;quot;&lt;br /&gt;
    ] 3 [&lt;br /&gt;
      pname = &amp;quot;Smoke&amp;quot;&lt;br /&gt;
    ] 4 [&lt;br /&gt;
      pname = &amp;quot;Fountain&amp;quot;&lt;br /&gt;
    ] 5 [&lt;br /&gt;
      pname = &amp;quot;Explosion&amp;quot;&lt;br /&gt;
    ] 6 [&lt;br /&gt;
      pname = &amp;quot;Meter&amp;quot;&lt;br /&gt;
    ] 7 [&lt;br /&gt;
      pname = &amp;quot;Vs Meter&amp;quot;&lt;br /&gt;
    ] 8 [&lt;br /&gt;
      pname = &amp;quot;Text&amp;quot;&lt;br /&gt;
    ] 9 [&lt;br /&gt;
      pname = &amp;quot;Flare&amp;quot;&lt;br /&gt;
    ] 10 [&lt;br /&gt;
      pname = &amp;quot;Lightning&amp;quot;&lt;br /&gt;
    ] 11 [&lt;br /&gt;
      pname = &amp;quot;Fire&amp;quot;&lt;br /&gt;
    ] 12 [&lt;br /&gt;
      pname = &amp;quot;Smoke&amp;quot;&lt;br /&gt;
    ] 13 [&lt;br /&gt;
      pname = &amp;quot;Water&amp;quot;&lt;br /&gt;
    ] 14 [&lt;br /&gt;
      pname = &amp;quot;Snow&amp;quot;&lt;br /&gt;
    ] 15 [&lt;br /&gt;
      pname = &amp;quot;Leaves&amp;quot;&lt;br /&gt;
    ] 32 [&lt;br /&gt;
      pname = &amp;quot;Lens Flare&amp;quot;&lt;br /&gt;
    ] 33 [&lt;br /&gt;
      pname = &amp;quot;Fixed Size Lens Flare&amp;quot;&lt;br /&gt;
    ] 34 [&lt;br /&gt;
      pname = &amp;quot;Sparkly Lens Flare&amp;quot;&lt;br /&gt;
    ] 35 [&lt;br /&gt;
      pname = &amp;quot;Sparkly Fixed Size Lens Flare&amp;quot;&lt;br /&gt;
    ] () [ //default&lt;br /&gt;
      pname = &amp;quot;A very pretty albeit unsupported particle&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  &lt;br /&gt;
    echo The particle you have selected is of type: $pname&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Naming===&lt;br /&gt;
&lt;br /&gt;
another way of doing decisions/branches is to use paths with different names. This has limited usage though. in short it requires you to query some information to concatenate onto another word, which you would then execute. There are exceptions. Other than the number of results you can query, there is no limit here. A handy trick is to have several results execute the same alias, though this requires that they differ only slightly at most in operation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //This example demonstrates the exception&lt;br /&gt;
  //it requires you to have an entity selected&lt;br /&gt;
  //This will conflict with showquickgui&lt;br /&gt;
  newgui &amp;quot;particles&amp;quot; [guitext &amp;quot;It&amp;#039;s like a random series of nothing&amp;quot;]&lt;br /&gt;
  newgui &amp;quot;light&amp;quot; [guitext &amp;quot;SHINY!!!!&amp;quot;]&lt;br /&gt;
  newgui &amp;quot;jumppad&amp;quot; [guitext &amp;quot;boing!&amp;quot;]&lt;br /&gt;
  &lt;br /&gt;
  identify = [showgui (et)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //shows a more standard example, at present this is exclusively used by edithud (see stdedit.cfg)&lt;br /&gt;
  //this also requires you to have an entity selected.&lt;br /&gt;
  identlight = [echo &amp;quot;it&amp;#039;s so bright...&amp;quot;]&lt;br /&gt;
  identdynlight = [identlight] // to demonstrate how different results can execute the same script&lt;br /&gt;
  identjumppad = [echo &amp;quot;boing? boing!&amp;quot;]&lt;br /&gt;
  identparticles = [echo &amp;quot;Please don&amp;#039;t change it to a lens flare!&amp;quot;]&lt;br /&gt;
  &lt;br /&gt;
  identify = [ if (enthavesel) [ident@(et)] [echo Select an entity first!]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Lists==&lt;br /&gt;
&lt;br /&gt;
Ordered lists are the closest cubescript has to the likes of arrays. Their declaration is identical to any alias, as they are simply items in a string separated by white space. Using [] is recommended as the container of choice, since it allows you to use &amp;quot;&amp;quot; to include multi-word items in a list as a single unit as well as define the list over multiple lines. &amp;quot;&amp;quot; can also be used to define lists. An example can be inspected below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //declares 2 equivalent lists of 3 elements&lt;br /&gt;
  mylist1 = [one two &amp;quot;three four&amp;quot;]&lt;br /&gt;
  mylist2 = &amp;quot;one two ^&amp;quot;three four^&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //prints the 3rd element&lt;br /&gt;
  echo (at $mylist 2)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;loops&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are at least 2 ways to loop through a list. The first method involves the use of looplist to iterate over it and the second the use of listlen to determine the list&amp;#039;s length. The difference between using looplist and listlen is that you will not have a reliable way of determining an element&amp;#039;s index and won&amp;#039;t have to manually fetch the element from the list. Basically looplist is faster at the cost of some information and should be used in all cases where the index does not need to be known.&lt;br /&gt;
An example can be inspected below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [&lt;br /&gt;
    0&lt;br /&gt;
    1&lt;br /&gt;
    3.14159265359&lt;br /&gt;
    2.71828182845&lt;br /&gt;
    sqrt(-1)&lt;br /&gt;
    1 //to demonstrate that the index cannot be determined reliably with looplist&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //demonstrates looplist&lt;br /&gt;
  looplist var $mylist [&lt;br /&gt;
    echo number (listfind item $mylist [strcmp $var $item]) : $var&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //demonstrates a loop + listlen combo&lt;br /&gt;
  loop i (listlen $mylist) [&lt;br /&gt;
    echo number $i : (at $mylist $i)&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;concatenation&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Concatenation is pretty simple, albeit not very efficient. It is basically, setting the list to itself plus the additional item. This is of course best achieved through the concat commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [1 2 3 4 5 6 7 8 9 10]&lt;br /&gt;
  &lt;br /&gt;
  //using concatword&lt;br /&gt;
  mylist = (concatword $mylist &amp;quot; &amp;quot; 11)&lt;br /&gt;
  &lt;br /&gt;
  //using format&lt;br /&gt;
  mylist = (format &amp;quot;%1 %2&amp;quot; $mylist 12)&lt;br /&gt;
  &lt;br /&gt;
  //using concat - we&amp;#039;re also preparing it for pretty list&lt;br /&gt;
  mylist = (concat $mylist 14)&lt;br /&gt;
  &lt;br /&gt;
  //pretty list does add an item onto the list, but it changes the format dramatically and the new item is placed before the end&lt;br /&gt;
  //it is ideal more so for making things pretty for presentation than concatenation&lt;br /&gt;
  mylist = (prettylist $mylist 13)&lt;br /&gt;
  &lt;br /&gt;
  //should print 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 14&lt;br /&gt;
  echo mylist is $mylist&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
concat returns everything given to it as a singular item, spaces and all. Concatword ignores spaces and &amp;quot;&amp;quot;&amp;#039;s must be explicitly provided. Concat is therefor ideal to add lists together. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist1 = [1 2 3 4 5]&lt;br /&gt;
  mylist2 = [6 7 8 9 10]&lt;br /&gt;
  mylist3 = [11 12 13 14 15]&lt;br /&gt;
  mylist4 = [16 17 18 19 20]&lt;br /&gt;
  mylist5 = [21 22 23 24 25]&lt;br /&gt;
  mylist6 = [26 27 28 29 30]&lt;br /&gt;
  finallist = &amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //how concatword merged three lists&lt;br /&gt;
  finallist = (concatword $mylist1 &amp;quot; &amp;quot; $mylist2 &amp;quot; &amp;quot; $mylist3)&lt;br /&gt;
  &lt;br /&gt;
  //concat unlike the above does not require&lt;br /&gt;
  finallist = (concat $finallist $mylist4 $mylist5 $mylist6)&lt;br /&gt;
  &lt;br /&gt;
  echo (prettylist $finallist)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;finding&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
there are two ways to find things, the first is to use listfind, and the second is to loop through the list. Both are demonstrated in the example below&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [&lt;br /&gt;
    &amp;quot;Jack&amp;quot;&lt;br /&gt;
    &amp;quot;Jane&amp;quot;&lt;br /&gt;
    &amp;quot;Joseph&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //This is an example of looking for a single element, note that this variant of...&lt;br /&gt;
  //strcmp unlike its C counterpart returns 1 when strings are equal&lt;br /&gt;
  //in this example, a 0 should be printed at the top of your screen - listfind returns the index&lt;br /&gt;
  echo (listfind f $mylist [strcmp $f &amp;quot;Jack&amp;quot;])&lt;br /&gt;
  &lt;br /&gt;
  //In this example, -1, as Jill is not in the list&lt;br /&gt;
  echo (listfind f $mylist [strcmp $f &amp;quot;Jill&amp;quot;])&lt;br /&gt;
  &lt;br /&gt;
  //in this example, we want to find anything which contains an e and add it into a list&lt;br /&gt;
  results = &amp;quot;&amp;quot;&lt;br /&gt;
  looplist var $mylist [&lt;br /&gt;
    if (&amp;gt;= (strstr $var &amp;quot;e&amp;quot;) 0) [&lt;br /&gt;
      results = (concatword $results &amp;quot;^&amp;quot;&amp;quot; $var &amp;quot; ^&amp;quot;&amp;quot;)&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //this should print: Jane Joseph&lt;br /&gt;
  echo $results&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=List of commands=&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
The following commands are quite often used in a lot of scripts. &lt;br /&gt;
&lt;br /&gt;
* alias N B&lt;br /&gt;
** creates an alias named N with body B, the intext version is denoted as N = B (equivalent to alias N B)&lt;br /&gt;
* at S I&lt;br /&gt;
** returns the Ith element in string S, note that counting starts from 0. If it&amp;#039;s out of range, &amp;quot;&amp;quot; is returned&lt;br /&gt;
* getalias A&lt;br /&gt;
** returns the value of A. this also does not produce a warning should an alias be undeclared, nor complains when fetching built in variables.&lt;br /&gt;
* if C T F (F is optional)&lt;br /&gt;
** if condition C is true, execute T, otherwise F is executed &lt;br /&gt;
* listlen S&lt;br /&gt;
** returns the amount of elements in list S&lt;br /&gt;
* loop V N B&lt;br /&gt;
** loops N times, and aliases the current iteration to V; B is executed every iteration.&lt;br /&gt;
* result S&lt;br /&gt;
** returns the string, useful when aliases need to be executed&lt;br /&gt;
* rnd N L&lt;br /&gt;
** chooses a random number between 0 and N-1 (inclusive). L sets the lower limit. eg rnd 12 7 will return either 7 8 9 10 or 11&lt;br /&gt;
* sleep N B&lt;br /&gt;
** executes B after a delay of N milliseconds. NOTE: even if N is &amp;lt;= 0, it&amp;#039;ll still wait till the next frame before executing it&lt;br /&gt;
* while C B&lt;br /&gt;
** executed B while C is true. NOTE: surround C in a [] container, or you risk an infinite loop due to the condition not being reevaluated.&lt;br /&gt;
&lt;br /&gt;
==Map Configuration==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;ONLY APPLIES TO FPSGAME&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The following commands are useful in level only aliases&lt;br /&gt;
&lt;br /&gt;
*triggerstate&lt;br /&gt;
*level_trigger&lt;br /&gt;
**level trigger is invoked as level_trigger_1 = [] as an example, the end number is the 4th number in the mapmodel&amp;#039;s strings&lt;br /&gt;
*level_base&lt;br /&gt;
**Used to give bases names in capture mode. This is unfortunately unused in PAS&lt;br /&gt;
&lt;br /&gt;
==Binds==&lt;br /&gt;
&lt;br /&gt;
The following commands are useful in binds.&lt;br /&gt;
&lt;br /&gt;
*onrelease&lt;br /&gt;
&lt;br /&gt;
==Gui Creation==&lt;br /&gt;
&lt;br /&gt;
For newui, please see [[new menu editing]]&lt;br /&gt;
&lt;br /&gt;
These commands are used to create various menus.&lt;br /&gt;
&lt;br /&gt;
* cleargui&lt;br /&gt;
* guibar&lt;br /&gt;
* guibutton&lt;br /&gt;
* guicheckbox&lt;br /&gt;
* guifield&lt;br /&gt;
* guikeyfield&lt;br /&gt;
* guiimage&lt;br /&gt;
* guilist&lt;br /&gt;
* guirolloveraction&lt;br /&gt;
* guirollovername&lt;br /&gt;
* guislider&lt;br /&gt;
* guilistslider&lt;br /&gt;
* guinameslider&lt;br /&gt;
* guistayopen&lt;br /&gt;
* guitab&lt;br /&gt;
* guitext&lt;br /&gt;
* guititle&lt;br /&gt;
* guistrut&lt;br /&gt;
* newgui&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
&lt;br /&gt;
The functions here can change the values, or return a logical comparison&lt;br /&gt;
for all intents and purposes, the C version of booleans apply here; values not equal to 0 are true - and functions that return true return 1&lt;br /&gt;
&lt;br /&gt;
===Integer Arithmetic===&lt;br /&gt;
&lt;br /&gt;
* + A B&lt;br /&gt;
** returns the value of the numbers added together&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns the result of multiplying A and B&lt;br /&gt;
* - A B&lt;br /&gt;
** returns the value of A - B&lt;br /&gt;
* = A B&lt;br /&gt;
** returns true of the two are equal&lt;br /&gt;
* != A B&lt;br /&gt;
** returns true if the two aren&amp;#039;t equal&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than-or-equal-to B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than-or-equal-to B&lt;br /&gt;
* ! A&lt;br /&gt;
** if the argument is false, it returns true&lt;br /&gt;
* &amp;amp;&amp;amp;&lt;br /&gt;
** returns true if all arguments are true&lt;br /&gt;
* ||&lt;br /&gt;
** returns true it at least one argument is true&lt;br /&gt;
* div A B&lt;br /&gt;
** returns the value of A divided by B&lt;br /&gt;
* mod A B&lt;br /&gt;
** returns the modulus of the two arguments&lt;br /&gt;
* min&lt;br /&gt;
** returns the lowest valued argument of all provided arguments&lt;br /&gt;
* max&lt;br /&gt;
** returns the highest valued argument of all provided arguments&lt;br /&gt;
&lt;br /&gt;
===Bitwise Integer Operations===&lt;br /&gt;
&lt;br /&gt;
* ^ A B&lt;br /&gt;
** returns the value of A xor B ie (^ 8 4) is 12 - (^ 12 4) is 8&lt;br /&gt;
* &amp;amp; A B&lt;br /&gt;
** returns the value of the bits both A and B have&lt;br /&gt;
* | A B&lt;br /&gt;
** returns the value of the bits either A or B have&lt;br /&gt;
* ~ A&lt;br /&gt;
** returns the inverted bitwise version of A ie (&amp;amp; (~ 128) 255) is 127&lt;br /&gt;
* ^~ A B&lt;br /&gt;
** xor;s the arguments after applying an inversion on B&lt;br /&gt;
* &amp;amp;~ A B&lt;br /&gt;
** and&amp;#039;s the arguments after applying an inversion on B&lt;br /&gt;
* |~ A B&lt;br /&gt;
** or&amp;#039;s the arguments after applying an inversion on B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;&amp;lt;/nowiki&amp;gt; A N&lt;br /&gt;
** shifts A N bits&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; A N&lt;br /&gt;
** shifts A -N bits&lt;br /&gt;
&lt;br /&gt;
===Floating Point Arithmetic===&lt;br /&gt;
&lt;br /&gt;
Generally these just have an -f suffix&lt;br /&gt;
&lt;br /&gt;
* +f A B&lt;br /&gt;
** returns the value of the numbers added together&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;*f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns the result of multiplying A and B&lt;br /&gt;
* -f A B&lt;br /&gt;
** returns the value of A - B&lt;br /&gt;
* =f A B&lt;br /&gt;
** returns true of the two are equal&lt;br /&gt;
* !=f A B&lt;br /&gt;
** returns true if the two aren&amp;#039;t equal&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than-or-equal-to B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than-or-equal-to B&lt;br /&gt;
* divf A B&lt;br /&gt;
** returns the value of A divided by B&lt;br /&gt;
* modf A B&lt;br /&gt;
** returns the modulus of the two arguments&lt;br /&gt;
* minf&lt;br /&gt;
** returns the lowest valued argument of all provided arguments&lt;br /&gt;
* maxf&lt;br /&gt;
** returns the highest valued argument of all provided arguments&lt;br /&gt;
&lt;br /&gt;
===Strings===&lt;br /&gt;
&lt;br /&gt;
* =s A B&lt;br /&gt;
** returns 1 if the string matches, 0 otherwise&lt;br /&gt;
* !=s A B&lt;br /&gt;
** returns 0 if the string matches, 1 otherwise&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns less-than 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns greater-than 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns less-than-or-equal-to 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns greater-than-or-equal-to 0&lt;br /&gt;
* strcmp A B&lt;br /&gt;
** returns 1 if the string matches, 0 otherwise (unlike the C version with returns the disparity)&lt;br /&gt;
* strstr H N&lt;br /&gt;
** returns the position of N in H - otherwise -1 is returned&lt;br /&gt;
* strlen S&lt;br /&gt;
** returns the length of the string&lt;br /&gt;
* strreplace S O N&lt;br /&gt;
** replaces all instances of O inside string S with N&lt;br /&gt;
&lt;br /&gt;
==String/text formatting==&lt;br /&gt;
&lt;br /&gt;
These commands are used to format aliases which are normally huge bits of text&lt;br /&gt;
&lt;br /&gt;
* concat C&lt;br /&gt;
** everything you type after will be returned; with expressions and substitutions performed&lt;br /&gt;
* concatword C&lt;br /&gt;
** the next 25 arguments will be executed and subsequently concatenated without any spaces between them&lt;br /&gt;
* format F S1 S2 S3 S4 S5 S6 S7 S8 S9&lt;br /&gt;
** F is a string containing %# tokens, format substitutes the arguments with their respective %# tokens (ie: S5 will replace %5)&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
*[[map_config|Map Configuration]]&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_cutscene&amp;diff=1840</id>
		<title>RPG cutscene</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_cutscene&amp;diff=1840"/>
				<updated>2012-07-03T05:25:54Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;font color=#ff0000&amp;gt;This doucmentation is outdated and does not apply to the current version of sandbox!!!&amp;lt;/font&amp;gt;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Intro=&lt;br /&gt;
&lt;br /&gt;
Cutscenes are defined much like everything else, and generally also during the configuration phase. Cutscenes consist of multiple directives which may or may not be nested. All the directives can create additional ones. Note that the cutscenes only allow control of the camera, entities and creates are to be moved via script. See the scripting page.&lt;br /&gt;
&lt;br /&gt;
The following command is used to create a new one...&amp;lt;br&amp;gt;&lt;br /&gt;
r_new_cutscene ACTIONS POST&amp;lt;br&amp;gt;&lt;br /&gt;
the POST argument is generally used to set variables (ie, don&amp;#039;t play this cutscene again), and prepare the map should the player choose to skip it.&lt;br /&gt;
&lt;br /&gt;
an example of a simple cutscene is as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_new_cutscene [&lt;br /&gt;
    r_cutscene_viewspin 180 0 0 5000&lt;br /&gt;
  ] [&lt;br /&gt;
    echo &amp;quot;cutscene done playing&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To start a cutscene, you must invoke: r_start_cutscene INDEX; To start the above, you&amp;#039;d use&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_start_cutscene 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=General Directives=&lt;br /&gt;
==Action/Delay==&lt;br /&gt;
Introduce a delay in a cutscene before performing an action:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_delay DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* DELAY: delay in milliseconds before to perform action&lt;br /&gt;
* ACTION: action block&lt;br /&gt;
&lt;br /&gt;
Many cutscenes command have DELAY and ACTION as their two last parameters, which allows to chain to the next action after the delay has expired.&lt;br /&gt;
&lt;br /&gt;
==Cond==&lt;br /&gt;
&lt;br /&gt;
==Iterate/Loop==&lt;br /&gt;
&lt;br /&gt;
==Signal==&lt;br /&gt;
&lt;br /&gt;
==Subtitle==&lt;br /&gt;
Displays a subtitle with the given color.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_subtitle TEXT R G B DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* TEXT: text to display&lt;br /&gt;
* R, G, B: red, green and blue values for the text color&lt;br /&gt;
* DELAY: delay during which the text remains displayed&lt;br /&gt;
* ACTION: action to perform after the delay&lt;br /&gt;
&lt;br /&gt;
=Camera movement=&lt;br /&gt;
==Move camera==&lt;br /&gt;
Move the camera to the position of a given camera tag:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_movecamera TAG DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_moveaccelcamera TAG DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* TAG: camera tag&lt;br /&gt;
* DELAY: delay during which the camera will move to the target (use 0 for immediate)&lt;br /&gt;
* ACTION: action to perform after the delay&lt;br /&gt;
&lt;br /&gt;
The first command will move the camera in a linear way to reach the target camera tag. The second one will do the same in an accelerated way.&lt;br /&gt;
&lt;br /&gt;
==Move camera to a specific position==&lt;br /&gt;
Move the camera to a specific position:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_movespecific X Y Z DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_moveaccelspecific X Y Z DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* X, Y, Z: absolute coordinates to where the camera must move&lt;br /&gt;
* DELAY: delay during which the camera will move to the target (use 0 for immediate)&lt;br /&gt;
* ACTION: action to perform after the delay&lt;br /&gt;
&lt;br /&gt;
The first command will move the camera in a linear way to reach the given position.&lt;br /&gt;
The second will do the same in an accelerated way.&lt;br /&gt;
&lt;br /&gt;
==Change Camera View Angle==&lt;br /&gt;
Change the camera&amp;#039;s view angle to match a camera tag&amp;#039;s view angle.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_viewcamera TAG DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_viewaccelcamera TAG DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* TAG: camera tag from which to use the view angle&lt;br /&gt;
* DELAY: delay during which the camera&amp;#039;s angle will be modified&lt;br /&gt;
* ACTION: action to perform after the delay&lt;br /&gt;
&lt;br /&gt;
The first command will change the camera&amp;#039;s view angle in a linear way to reach the target angle.&lt;br /&gt;
The second command will do the same in an accelerated way.&lt;br /&gt;
&lt;br /&gt;
==Change Camera View Angle using specific values==&lt;br /&gt;
Change the camera&amp;#039;s view angle to match the given angle values.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_viewspecific YAW PITCH ROLL DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_cutscene_viewaccelspecific YAW PITCH ROLL DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* YAW, PITCH, ROLL: target angle&lt;br /&gt;
* DELAY: delay during which the camera&amp;#039;s angle will be modified&lt;br /&gt;
* ACTION: action to perform after the delay&lt;br /&gt;
&lt;br /&gt;
The first command will change the camera&amp;#039;s view angle in a linear way to reach the target angle.&lt;br /&gt;
The second command will do the same in an accelerated way.&lt;br /&gt;
&lt;br /&gt;
==Viewspin==&lt;br /&gt;
Spins the current view using the given relative angle movements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
   r_cutscene_viewspin YAW PITCH ROLL DELAY ACTION&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* YAW, PITCH, ROLL: relative angle direction in which to spin the current view&amp;#039;s angle&lt;br /&gt;
* DELAY: duration of the movement&lt;br /&gt;
* ACTION: action to perform after the delay&lt;br /&gt;
&lt;br /&gt;
=Other directives=&lt;br /&gt;
==Sound==&lt;br /&gt;
&lt;br /&gt;
==Soundfile==&lt;br /&gt;
&lt;br /&gt;
==Overlay==&lt;br /&gt;
&lt;br /&gt;
==Solid==&lt;br /&gt;
&lt;br /&gt;
==Viewport==&lt;br /&gt;
&lt;br /&gt;
==Focus==&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1824</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1824"/>
				<updated>2012-06-01T07:32:54Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;I&amp;#039;m a windows&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If windows is your operating system of choice, do yourself a huge favour and at the very least configure windows to display file extensions such as .cfg. This will save you a fair bit of pain&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 // its type is also &amp;quot;magic&amp;quot; which means its efficiency is reduced by magic resisting items.&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need to spawn this in the back of the dedicated room in the dungeon. After that is done, we only need to edit 2 more files, first up, open up variables,cfg.&lt;br /&gt;
&lt;br /&gt;
You use this file to store variables and values you want to persist across sessions. So you want to use these to record the various choices the player has made, the things he has done and the status of all kinds of things in the world.&lt;br /&gt;
&lt;br /&gt;
append this onto the end of variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 bobmcguffin = (r_global_new 0) //bob&amp;#039;s quest to retrieve the mcguffin, 1 - have quest 2 - finished quest&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now only have Bob&amp;#039;s dialogue left to go. We will provide different responses for the various states as well as set any variables that need be and remove any inventory items that need be.&lt;br /&gt;
&lt;br /&gt;
We will need to change a fair bit of his script, So without further ado, open up his script and replace the dialogue with the following.&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
   r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
   case (r_global_get $bobmcguffin) 0 [&lt;br /&gt;
     r_response &amp;quot;Do you have any work for me?&amp;quot; 2&lt;br /&gt;
   ] 1 [&lt;br /&gt;
     if (r_get_amount player 7) [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 4&lt;br /&gt;
     ] [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 6&lt;br /&gt;
     ]&lt;br /&gt;
   ] 2 [&lt;br /&gt;
     r_response &amp;quot;Do you have any more work for me?&amp;quot; 7&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I need someone to go into the cave to the North-West of this valley and retrieve the mcGuffin, can you do that for me?&amp;quot; [ //2&lt;br /&gt;
   r_response &amp;quot;You can count on me!&amp;quot; 3 [ r_global_set $bobmcguffin 1 ]&lt;br /&gt;
   r_response &amp;quot;Maybe some other time&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Great! I&amp;#039;ll be waiting for your return&amp;quot; [ //3&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you for finding it, but I don&amp;#039;t have a reward for you but I&amp;#039;d till very much like the mcGuffin.&amp;quot; [ //4&lt;br /&gt;
   r_response &amp;quot;[Give him the mcGuffin]&amp;quot; 5 [&lt;br /&gt;
     r_remove player 7 1&lt;br /&gt;
     r_givexp player 900&lt;br /&gt;
     r_global_set $bobmcguffin 2&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;I think I&amp;#039;ll hold onto it for now&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you very much, I will never forget this&amp;quot; [ // 5&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Where is it?&amp;quot; [ //6&lt;br /&gt;
   r_response &amp;quot;I must&amp;#039;ve forgotten it in the cave...&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;No, but once again, thank you for getting this for me&amp;quot; [ //7&lt;br /&gt;
   r_response &amp;quot;Farewell&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congrats, you&amp;#039;ve made your first FedEx quest. I hope you&amp;#039;re ashamed of yourself and will take this moment to reflect on your actions and produce quests with multiple paths and solutions that aren&amp;#039;t simply get X of Y or kill X of Y ;)&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global Variable Tips&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are saved with your game and remain in a constant order and are all defined inside variables.cfg and they can only be integers. r_global_new returns the variable&amp;#039;s index (ie, the first will return 0) and you should alias these return values to an easy to remember name that is short and as descriptive as possible. If you need to list more detailed information, do so in comments either before or on the same line.&lt;br /&gt;
&lt;br /&gt;
You will want to increase the game/compat versions when you move/remove/add anything in here, serious breakage can occur&lt;br /&gt;
&lt;br /&gt;
You should keep the names short and easy to type, for example, if we have a quest where you find a someone named Jane a bunch of apples, JaneApples and ApplesForJane would be some of the better names.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Journal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There is no journal at present but there will be in the future, you will want to record rumours, quest notes, deeds, obituaries and all kinds of other things in there. What you can do for now is make a book where the player can access all this information via dialogue.&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic logic puzzle to open a door.&lt;br /&gt;
&lt;br /&gt;
We will create a 10 digit number pad of sorts, the player would need to interact with in a specific order to remove an obstacle we will place in the second area.&lt;br /&gt;
&lt;br /&gt;
Our first order of business will be to define the variables we&amp;#039;ll need to pull this off, we&amp;#039;ll need two for the method we&amp;#039;ll be using.&lt;br /&gt;
&lt;br /&gt;
variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 keyprogress = (r_global_new 0)&lt;br /&gt;
 keytest = (r_global_new -1)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we&amp;#039;ll define the button&amp;#039;s scripts. The scripts will set the keytest variable and will then call the &amp;quot;testkey&amp;quot; signal on the current map and propagate it to the door. We will define the door a bit later.&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 0&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
14.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 1&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
15.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 2&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
16.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 3&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
17.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 4&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
18.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 5&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
19.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 6&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
20.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 7&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
21.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 8&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
22.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 9&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you thought that wasn&amp;#039;t boring enough, we now define the buttons themselves with similarly minor alterations, these should occupy slots 3 to 12 in the triggers directory, feel free to use a more appropriate model if you have one available.&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;0 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 13&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;1 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;2 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 15&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;3 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 16&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;4 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 17&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;5 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 18&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;6 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 19&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;7 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 20&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;8 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;9 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 22&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will not get to the fun part! defining the actual door itself (hooray!). Like in every other instance, we will define the script first. The door&amp;#039;s script will be as follows, it need to test and increment the global variables we&amp;#039;ve defined earlier.&lt;br /&gt;
&lt;br /&gt;
23.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 key = [ 3 1 3 3 7 ] //change as appropriate&lt;br /&gt;
 keylen = (listlen $key)&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal testkey [&lt;br /&gt;
   if (&amp;lt; (r_global_get $keyprogress) @keylen) [&lt;br /&gt;
     if (= (at [@@@key] (r_global_get $keyprogress)) (r_global_get $keytest) [&lt;br /&gt;
       r_global_set $keyprogress (+ (r_global_get $keyprogress) 1)&lt;br /&gt;
     ] [&lt;br /&gt;
       r_global_set $keyprogress 0&lt;br /&gt;
     ]&lt;br /&gt;
     if (= (r_global_get $keyprogress) @@keylen) [&lt;br /&gt;
       r_trigger self&lt;br /&gt;
     ]&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now make the trigger itself, like with the last step, choose a model of appropriate size to block the passage to the mcGuffin&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Heavy door&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_script 23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;a guiding hand&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Depending on the puzzle and its difficulty, you should strive to give the player a few hints to solve it. You should avoid giving the player the answer but you should give the player some audio or visual feedback based on his actions.&lt;br /&gt;
&lt;br /&gt;
Take our above puzzle for example, we have no idea if the combination we have entered is even correct apart from the door opening after interacting with the triggers. In addition, trying every 5 digit combo to get the example combination can take as many as 100000 attempts.&lt;br /&gt;
&lt;br /&gt;
For a puzzle like that, it is unreasonable to just expect the player to figure out the answer himself without a few hints. Short of giving the player the answer, we could perhaps tell him the digits but in a wrong order, or perhaps give him a mnemonic he has to decipher to get the answer.&lt;br /&gt;
&lt;br /&gt;
=Extras=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Broken Link Removed&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_todo&amp;diff=1823</id>
		<title>RPG todo</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_todo&amp;diff=1823"/>
				<updated>2012-05-31T11:56:21Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: updates!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Gameplay=&lt;br /&gt;
* hotkeys&lt;br /&gt;
* special item properties&lt;br /&gt;
** money (constant value for all purposes)&lt;br /&gt;
** cursed status&lt;br /&gt;
** unidentified status&lt;br /&gt;
*** hide true power or make it a lot less useful?&lt;br /&gt;
* (maybe?) character generation&lt;br /&gt;
* sneaking/stealth&lt;br /&gt;
** light and visibility&lt;br /&gt;
** silhouettes and light levels?&lt;br /&gt;
** stealing&lt;br /&gt;
* proper friendly fire protection&lt;br /&gt;
** 0 - no protection (default)&lt;br /&gt;
** 1 - prevents you from hurting yourself&lt;br /&gt;
** 2 - 1 + prevents you from hurting allies&lt;br /&gt;
** 3 - allows injury to hostile characters only&lt;br /&gt;
* spell types&lt;br /&gt;
** movement (paralysis counters)&lt;br /&gt;
** vocal (silence counters)&lt;br /&gt;
&lt;br /&gt;
=Logic=&lt;br /&gt;
* the consume use case for books and potions.&lt;br /&gt;
* statusgroups on items&lt;br /&gt;
** temporary spells that alters the properties of the weapon&lt;br /&gt;
** multiple at once with different targets.&lt;br /&gt;
* temporary spell effects for wielded items, &lt;br /&gt;
** multiple status effects on a single use, separate chargeflags, multiplier, duration and element.&lt;br /&gt;
** make sure to use each for the right purpose&lt;br /&gt;
* Projectiles&lt;br /&gt;
** improve ricochet, gravity related stuff is funky&lt;br /&gt;
* status types&lt;br /&gt;
** dispel - should work on individual effects&lt;br /&gt;
** silence&lt;br /&gt;
** paralysis/stun&lt;br /&gt;
* Expose a tonne of constants to Cubescript for configuration at the game maker&amp;#039;s discretion. These include leveling and power curves&lt;br /&gt;
* arbitrary trigger bounding box scales&lt;br /&gt;
&lt;br /&gt;
=GUI=&lt;br /&gt;
* inventory&lt;br /&gt;
** item examination&lt;br /&gt;
* status effects&lt;br /&gt;
* trade &lt;br /&gt;
* stats&lt;br /&gt;
* crafting&lt;br /&gt;
* journal&lt;br /&gt;
* newui variants&lt;br /&gt;
&lt;br /&gt;
=Recipes=&lt;br /&gt;
* (maybe) allow in game apparatuses to act as a catalyst&lt;br /&gt;
** (maybe) several catalysts and ingredients list? or just duplicate and alter the recipe?&lt;br /&gt;
&lt;br /&gt;
=AI=&lt;br /&gt;
* queued prioritised actions&lt;br /&gt;
** most important done first&lt;br /&gt;
** multitasking&lt;br /&gt;
* waypoints&lt;br /&gt;
** randomness&lt;br /&gt;
** state - don&amp;#039;t favour waypoints which are in use&lt;br /&gt;
* ai tags&lt;br /&gt;
** identify purpose and effect of entities in game world for the AI (parsing the script for these is simply not practical)&lt;br /&gt;
*** alternatively use simpler more specific types, such as &amp;quot;door&amp;quot;, &amp;quot;container&amp;quot;, &amp;quot;portal&amp;quot; and &amp;quot;mover&amp;quot; as opposed to a singular &amp;quot;object&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Cutscenes=&lt;br /&gt;
* some sort of skipping bar (1000 ms?) to prevent accidental skips&lt;br /&gt;
&lt;br /&gt;
=Renderer=&lt;br /&gt;
* particles for active spell effects&lt;br /&gt;
* render attachments/equipment&lt;br /&gt;
* animations for weapons&lt;br /&gt;
** generic animations, unarmed strike, melee strike, bow shoot, gun shoot, etc&lt;br /&gt;
&lt;br /&gt;
=Journal=&lt;br /&gt;
* sorting and filters&lt;br /&gt;
&lt;br /&gt;
=Sound=&lt;br /&gt;
* sounds while charging spells&lt;br /&gt;
* sounds for projectile firing, travel and death&lt;br /&gt;
* sounds for active statusgroups&lt;br /&gt;
* (maybe) voiced dialogue&lt;br /&gt;
&lt;br /&gt;
=I/O=&lt;br /&gt;
* flat file export of current script/data definitions (maybe)&lt;br /&gt;
** couple with ingame menus for realtime modification (maybe)&lt;br /&gt;
* save and restore AI directives&lt;br /&gt;
&lt;br /&gt;
=Particles=&lt;br /&gt;
* set particle effects for entity afflicted status effects&lt;br /&gt;
* vary spawned amount of particles depending on distance (few when close, full amount when far away)&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_editing&amp;diff=1822</id>
		<title>RPG editing</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_editing&amp;diff=1822"/>
				<updated>2012-05-31T11:53:37Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: emphasis!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Adding spawn points =&lt;br /&gt;
&lt;br /&gt;
There are two types of spawn points you can add to the world. The first is the generic kind any entity can spawn at when directed to do so through script. The second is the dedicated kind. Dedicated spawn points are named after the type of entity they will create and will display a preview of the entity in question. The entity is always spawned there when the map is initialised.&lt;br /&gt;
&lt;br /&gt;
We strongly recommend that you save your game and map before you mess with any freshly spawned entities, &amp;#039;&amp;#039;&amp;#039;ESPECIALLY&amp;#039;&amp;#039;&amp;#039; if they&amp;#039;re designed to transfer you to another map.&lt;br /&gt;
&lt;br /&gt;
For example, if we wanted to spawn container #3, we might use the following&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent container 3&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Game state =&lt;br /&gt;
&lt;br /&gt;
All simulation (apart from the player&amp;#039;s movement) is paused during editmode and neither entities or particles are rendered by default. By default the map is also reset when you exit edit mode, sending the &amp;quot;load&amp;quot; signal to the map and respawning everything at the dedicated spawn points.&lt;br /&gt;
&lt;br /&gt;
There are two variables that can be used to tweak this behaviour.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  edittogglereset 0 // turns off the reset after exiting editmode&lt;br /&gt;
  editdrawgame 1 // draws entities and particles in editmode&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Entity Previews =&lt;br /&gt;
&lt;br /&gt;
Dedicated spawn points will draw a transparent version of the entity&amp;#039;s model by default. If you don&amp;#039;t like this or are having graphical issues, you can tweak this through the provided variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  entpreviewalpha .4 // 0 = off, 1 == no transparency&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Reloading definitions =&lt;br /&gt;
&lt;br /&gt;
As of 2.7.0, the RPG has gained a command which will reload all definitions.&lt;br /&gt;
&lt;br /&gt;
Before you execute it, you should take care to &amp;#039;&amp;#039;&amp;#039;save your map and game&amp;#039;&amp;#039;&amp;#039; in case there are any critical errors in the definitions. If there are the RPG will respond in much the same way as it would when you try to start or load such a game, &amp;#039;&amp;#039;&amp;#039;it will abort and return to the main menu.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Once you&amp;#039;re prepared, the following command will reload the definitions. You may need to toggle editmode for some of them to take effect.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_rehash // reloads all game definitions&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Modifying definitions ingame =&lt;br /&gt;
&lt;br /&gt;
For testing purposes, you can select &amp;quot;Browse Definitions&amp;quot; in the menu whilst inside editmode to alter most properties of existing definitions. &amp;#039;&amp;#039;&amp;#039;None of these changes are permanent&amp;#039;&amp;#039;&amp;#039; unless done outside of the game.&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG&amp;diff=1821</id>
		<title>RPG</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG&amp;diff=1821"/>
				<updated>2012-05-31T11:51:28Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Definitions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The RPG is currently still in heavy development with many features still unimplemented. With the advent of the 2.7.0 release it has entered the Alpha stage. It may still change dramatically in the near future, but the various interfaces at this point are more or less stable and should function correctly with future releases.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* [[RPG configuration|Configuration and Definitions]]&lt;br /&gt;
* [[RPG script|Scripting]]&lt;br /&gt;
* [[RPG_cutscene|Cutscenes]]&lt;br /&gt;
* [[RPG gui|GUIs]]&lt;br /&gt;
* [[RPG hud|HUDs]]&lt;br /&gt;
&lt;br /&gt;
=Tutorials=&lt;br /&gt;
* [[RPG editing|Editing tips]]&lt;br /&gt;
* [[RPG tutorial|Tutorial]]&lt;br /&gt;
&lt;br /&gt;
=Misc. pages=&lt;br /&gt;
* [[RPG todo|todo]]&lt;br /&gt;
&lt;br /&gt;
=Internals=&lt;br /&gt;
&lt;br /&gt;
The creator is capable of defining and manipulating a great many facets of his game, and future releases promise to increase these capabilities and freedoms.&lt;br /&gt;
&lt;br /&gt;
== Cutscenes ==&lt;br /&gt;
&lt;br /&gt;
Cutscenes unlike definitions can contain things other than numbers in their names and aren&amp;#039;t loaded into memory until they are needed. Cutscenes &amp;#039;&amp;#039;&amp;#039;can always be skipped&amp;#039;&amp;#039;&amp;#039; and you as the creator should therefor make sure that the post script takes care of any changes of state that need to happen, additionally during cutscenes are the only time the player can be commanded via AI commands.&lt;br /&gt;
&lt;br /&gt;
There are two parts to the cutscene system, the first is directives for the camera and the second are 2D elements to be drawn on screen and their containers.&lt;br /&gt;
&lt;br /&gt;
with respect to the 2D elements, the cutscene system functions like the HUD in this regard, fitting a proportionally scaled 1600x1200 virtual screen into yours and then adjusting the size to cover the entire screen and storing the size in the hud_right and hud_bottom variables.&lt;br /&gt;
&lt;br /&gt;
Containers basically group a series of actions together and influences them in some way (eg, rotates 2D elements). Containers are destroyed when they no longer possess any children. A very handy use for these are to allow layers. For example, you could create a slide container and a subtitle container, this will result in the subtitles always being drawn above the slides.&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
The creator can define just about anything, from creatures, monsters, maps, containers, scripts, dialogue, cutscenes, HUDs, GUIs and particle effects. The definitions are sourced from the game&amp;#039;s data directory and can be changed in real time during the game. It should be noted that unless things use these definitions as a template, any effects from ingame modifications will not persist across sessions. We therefor recommend that you only use those that accept references as any changes to them will persist unless you simply wish to test and fine tine some variables quickly and easily.&lt;br /&gt;
&lt;br /&gt;
Also note that all definitions must be defined in a separate text file named solely by a number with a .cfg extension. Any other .cfg files will throw warnings and the game will abort if there are any gaps. At least that is true for the hard-coded directories - you may add additional ones and use &amp;#039;&amp;#039;&amp;#039;include&amp;#039;&amp;#039;&amp;#039; to include their files in your scripts and definitions.&lt;br /&gt;
&lt;br /&gt;
For example, there is a definition for a bear creature with 40 strength. I might increase this to 90 in game, but any existing bears will still have 40 strength. Likewise I could create a few new bears which would then have 90 strength. if I was to save and reload my game, any new bears will have 40 strength but those spawned with 90 strength will still exist and walk about.&lt;br /&gt;
&lt;br /&gt;
== Game state ==&lt;br /&gt;
&lt;br /&gt;
All map related information, short of the map&amp;#039;s entities, waypoints and geometry are stored in a hashtable. This hashtable includes the properties of the map, the script, the name and the entities currently present as well as any queued actions that are awaiting the player&amp;#039;s arrival.&lt;br /&gt;
&lt;br /&gt;
Generally speaking, any map besides the current map isn&amp;#039;t updated and is in a state of limbo until the player goes there.&lt;br /&gt;
&lt;br /&gt;
== GUIs ==&lt;br /&gt;
&lt;br /&gt;
The RPG defines a series of commands to facilitate the creation of custom GUIs, unlike previous iterations the GUI isn&amp;#039;t hard coded although it depends on a few hard coded names.&lt;br /&gt;
&lt;br /&gt;
Essentially all the RPG does in relation to this is to force the talk GUI open during conversations and to pause the game while a GUI is open. newui currently isn&amp;#039;t properly supported.&lt;br /&gt;
&lt;br /&gt;
== HUDs ==&lt;br /&gt;
&lt;br /&gt;
The placement of all HUD entities are defined entirely through script, the script itself is evaluated once every update and can be redefined at any part of the game using a r_hud invocation.&lt;br /&gt;
&lt;br /&gt;
The HUD pretends to be a 1600x1200 screen scaled to fit inside your screen and then has its dimensions adjusted, these dimensions are stored in the variables, hud_right and hud_bottom which you should query when you draw items offset from the bottom or the right. The only benefit of using such a size is that it&amp;#039;s far easier to get a sense of scale and to understand in general than a 0.f to 1.f range.&lt;br /&gt;
&lt;br /&gt;
In case you&amp;#039;re wondering why there is a hud_bottom and not a hud_up, the reason is that the screen coordinates are flipped and that the top left is therefor (0, 0), not the bottom left.&lt;br /&gt;
&lt;br /&gt;
== Multiplayer ==&lt;br /&gt;
&lt;br /&gt;
The RPG wasn&amp;#039;t designed to accommodate multiplayer. We may consider NWN style coop sometime in the distant future but the RPG simply lacks any multiplayer capability what so ever.&lt;br /&gt;
&lt;br /&gt;
In other words, this module is presently single player only and will likely remain so.&lt;br /&gt;
&lt;br /&gt;
== Savegames ==&lt;br /&gt;
&lt;br /&gt;
Savegames store the game state and the game definition source. Definitions and the AI&amp;#039;s state isn&amp;#039;t stored, the one exception is recipes in which a portion of the flags slot is saved. specifically the portion that tells us if the player knows the recipe.&lt;br /&gt;
&lt;br /&gt;
Otherwise, everything is saved in a compressed archive, from maps and their contents, to the various properties of each and every existing entity to the whole reference table.&lt;br /&gt;
&lt;br /&gt;
It should be noted that you cannot save at certain points, specifically during dialogue, cutscenes, in editmode and on maps with the F_NOSAVE flag set.&lt;br /&gt;
&lt;br /&gt;
== Scripts ==&lt;br /&gt;
&lt;br /&gt;
Scripts are signal based, you define a signal to listen for and a set of actions to execute when that signal is received. There are several types, those the game sends on every update, those the game sends under certain conditions and those the creator manually sends himself via r_signal.&lt;br /&gt;
&lt;br /&gt;
The second and probably the most important facet of scripting is the use of references. The reference system is type safe, prone to whining (the solution is to fix what it&amp;#039;s complaining about, not ignore it) and is implemented as a layer utilising cubescript as opposed to being a part of it. &lt;br /&gt;
&lt;br /&gt;
The reference system is implemented as an array of hashtables, which introduces the concept of scope and shadowing and there are also some hard-coded reserved references. At present these are specifically, &amp;quot;player&amp;quot;, &amp;quot;curmap&amp;quot;, &amp;quot;talker&amp;quot;, &amp;quot;self&amp;quot; and &amp;quot;actor&amp;quot;, you should not change them and they will likely be read only in the near future. In addition there are also temporary references, these aren&amp;#039;t saved in the save game and are cleared at the end of the update cycle. Some of the destinations may persist for a long time but there is no such guarantee.&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1578</id>
		<title>Platinum Arts Sandbox Free 3D Game Maker:Community Portal</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1578"/>
				<updated>2011-12-22T06:12:55Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: Reverted edits by Zilking75 (Talk) to last revision by Hirato&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Possible upcoming events.  Please contact us if you are interested!&lt;br /&gt;
&lt;br /&gt;
* Kid friendly RPG&lt;br /&gt;
* Water Waters - DM type game with water guns and water balloon bazookas!&lt;br /&gt;
* Kart mode into an actual racing game.&lt;br /&gt;
Also Sandbox is being used in more and more schools!  The goal is to try to get Sandbox into as many schools as we can, and the more schools and kids using it the better!  Any help that you can give us is much appreciated!&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Cooperative_Editing_2&amp;diff=1577</id>
		<title>Cooperative Editing 2</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Cooperative_Editing_2&amp;diff=1577"/>
				<updated>2011-12-22T06:12:11Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: Undo revision 1575 by RenéFriedman (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OK so you can&amp;#039;t port-forward, Then this tutorial is for you.&lt;br /&gt;
First make sure you have Hamachi ( http://hamachi.en.softonic.com/ ), It is free.&lt;br /&gt;
&lt;br /&gt;
Ok first run the program after you install.&lt;br /&gt;
&lt;br /&gt;
Then you go to network and name a ID and pass.&lt;br /&gt;
&lt;br /&gt;
Then u tell the person you want to Co-op with, to get Hamachi.&lt;br /&gt;
&lt;br /&gt;
Then tell him to join your network on hamachi with same id and pass as you used.&lt;br /&gt;
&lt;br /&gt;
Now the person who is going to host it has to run server.bat and give your friend the IP that&amp;#039;s under your name name in big letters.&lt;br /&gt;
&lt;br /&gt;
Now go into sandbox and type in /connect IP&lt;br /&gt;
and your friend has to also do the same thing.&lt;br /&gt;
&lt;br /&gt;
COOP Commands&lt;br /&gt;
/map &amp;quot;allows you to vote on a map&amp;quot;&lt;br /&gt;
T Button allow&amp;#039;s you to talk!&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox&amp;diff=1576</id>
		<title>Platinum Arts Sandbox</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox&amp;diff=1576"/>
				<updated>2011-12-22T06:12:03Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: Undo revision 1574 by RenéFriedman (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;About Platinum Arts Sandbox Free 3D Game Maker:&lt;br /&gt;
&lt;br /&gt;
Platinum Arts Sandbox Free 3D Game Maker is an open source game design program for kids and adults.  Through the ingame and cooperative editing and focus on ease of use the program is easy enough for kids to use but powerful enough for full game projects.  Sandbox includes Save The Princess Gameplay, an RPG Maker, a Sidescoller maker, a Movie Maker aka Machinima, Save The Banana Base Capture, and more!  Sandbox is already being used in many schools and colleges throughout the world and included in game design contests.&lt;br /&gt;
&lt;br /&gt;
Platinum Arts Sandbox will be easy enough for kids to use but also powerful enough for full game projects.&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Contributing&amp;diff=1569</id>
		<title>Contributing</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Contributing&amp;diff=1569"/>
				<updated>2011-12-13T05:45:36Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Style */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Code=&lt;br /&gt;
&lt;br /&gt;
examples of code contributions&lt;br /&gt;
* bug fixes&lt;br /&gt;
* additional features&lt;br /&gt;
* cleanups&lt;br /&gt;
&lt;br /&gt;
if you&amp;#039;ve any of the above, send them to Hirato, the code will be included if he approves. He can be contacted through the [http://forum.sandboxgamemaker.com forums] (the PM system) or via [irc://irc.oftc.net/sandbox IRC] (the latter is recommended).&amp;lt;br&amp;gt;&lt;br /&gt;
If you desire any feedback on your code, post it in the &amp;quot;Show of Your Work in Progress&amp;quot; forum, and tag it with [patch] - eg &amp;quot;[patch]continuous jumping&amp;quot;, for a patch that makes you jump nonstop.&lt;br /&gt;
&lt;br /&gt;
If you lack any ideas of what to implement, should you wish to contribute in this way, there are various todo lists that should help you out&lt;br /&gt;
* http://www.svn.kids.platinumarts.net/32pas32/trunk/sandboxtodo.txt&lt;br /&gt;
* http://www.svn.kids.platinumarts.net/32pas32/trunk/src/rpggame/rpgtodo.txt&lt;br /&gt;
* http://www.svn.kids.platinumarts.net/32pas32/trunk/src/sspgame/ssptodo.txt&lt;br /&gt;
&lt;br /&gt;
Making several good patches, which are accepted, is a good way of convincing us you have what it takes to be on the development team.&lt;br /&gt;
&lt;br /&gt;
==Style==&lt;br /&gt;
The files in the engine and the respective game modules use slightly differing styles... The easiest way is simply to remain consistent with the style present in the file.&lt;br /&gt;
&lt;br /&gt;
For more detailed information, see [[Coding Style]]&lt;br /&gt;
&lt;br /&gt;
==licensing==&lt;br /&gt;
&lt;br /&gt;
By sending in your code, YOU give US permission to relicense the code under the zlib/libpng license and include it as part of our source distribution(s), irregardless of the code&amp;#039;s original license. By extension, this means you&amp;#039;re NOT PERMITTED to REVOKE permission for us to use the code, should you decide you no longer wish for your code to be inside sandbox&lt;br /&gt;
&lt;br /&gt;
=Art=&lt;br /&gt;
&lt;br /&gt;
This category includes custom maps, models and textures. Just send them in, if they&amp;#039;re of acceptable quality, and of an acceptable license, we&amp;#039;ll add them right in.&amp;lt;br&amp;gt;&lt;br /&gt;
You can also post them on the forums, we tend to look there occasionally, and the community would doubtlessly be excited to see what people are making/working on for sandbox&lt;br /&gt;
&lt;br /&gt;
==licenses==&lt;br /&gt;
&lt;br /&gt;
These are a listing of licenses we recommend for art assets included in sandbox.&lt;br /&gt;
&lt;br /&gt;
* Creative Commons - Attribution&lt;br /&gt;
* Creative Commons - Attribution + Share-Alike&lt;br /&gt;
* MIT/X11&lt;br /&gt;
* Public Domain&lt;br /&gt;
&lt;br /&gt;
=Other=&lt;br /&gt;
&lt;br /&gt;
==Testing==&lt;br /&gt;
&lt;br /&gt;
As a rule of thumb, there are &amp;#039;&amp;#039;&amp;#039;ALWAYS&amp;#039;&amp;#039;&amp;#039; bugs, if you&amp;#039;re up to it, just use sandbox as you normally would, and keep an eye out for any oddities, and put extra effort into trying to break things. Should something go wrong, give us the exact steps you took, and we&amp;#039;ll do out best to fix it. We recommend using the [[Development|SVN version]].&lt;br /&gt;
&lt;br /&gt;
See Also&lt;br /&gt;
* [[Development]]&lt;br /&gt;
* [[Bug reports]]&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Coding_Style&amp;diff=1568</id>
		<title>Coding Style</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Coding_Style&amp;diff=1568"/>
				<updated>2011-12-13T05:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: Created page with &amp;#039;= Patches = Patches should be sent using the unified style. These can typically generated through &amp;#039;&amp;#039;&amp;#039;diff -u&amp;#039;&amp;#039;&amp;#039;, svn diff uses this format by default. These patches contain some …&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Patches =&lt;br /&gt;
Patches should be sent using the unified style. These can typically generated through &amp;#039;&amp;#039;&amp;#039;diff -u&amp;#039;&amp;#039;&amp;#039;, svn diff uses this format by default. These patches contain some context information which makes them much easier to apply should there be intermediary changes and generally they are human readable.&lt;br /&gt;
&lt;br /&gt;
= Source Code =&lt;br /&gt;
&lt;br /&gt;
These are just rough guidelines, when it doubt mimic the style of the surrounding code.&lt;br /&gt;
&lt;br /&gt;
When not writing one liners, braces should be placed on their own lines with the programming statements following on a new line. Braces are to maintain the current level of indentation. Should you write a if, else or while statement that only does one thing, braces are optional.&lt;br /&gt;
&lt;br /&gt;
Good&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    int myfunc() { return 4; }&lt;br /&gt;
    &lt;br /&gt;
    if(conditon) { function(); variable++; }&lt;br /&gt;
    else         { function2(); var2++; }&lt;br /&gt;
    &lt;br /&gt;
    int myfunc()&lt;br /&gt;
    {&lt;br /&gt;
        return 4;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    if(condition)&lt;br /&gt;
    {&lt;br /&gt;
        function();&lt;br /&gt;
        variable++;&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        function();&lt;br /&gt;
        variable++;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bad&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    int myfunc() {&lt;br /&gt;
        return 4&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    int myfunc()&lt;br /&gt;
    {   int a = 4;&lt;br /&gt;
        return a;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    int myfunc()&lt;br /&gt;
        {&lt;br /&gt;
            return 4&lt;br /&gt;
        }&lt;br /&gt;
    &lt;br /&gt;
    int myfunc()&lt;br /&gt;
    {&lt;br /&gt;
        if (cond)&lt;br /&gt;
            {&lt;br /&gt;
                return 4;&lt;br /&gt;
            }&lt;br /&gt;
        else&lt;br /&gt;
            {&lt;br /&gt;
                return 2;&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    if(condition) {&lt;br /&gt;
        stuff()&lt;br /&gt;
    } else {&lt;br /&gt;
        dostuff();&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Indentation wise, you will be using either 4 spaces or tabulators. Which depends on the file you modify so keep an eye out. As a general rule the engine stuff and the FPS game uses 4 spaces whilst everything else uses tabs. Tab size should be irrelevant but the best experience should be with a size of 4.&lt;br /&gt;
&lt;br /&gt;
There aren&amp;#039;t many fixed rules and you are allowed some freedom provided they make things more readable, with that said you are encouraged to indent liberally rather than conservatively.&lt;br /&gt;
&lt;br /&gt;
Good&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    switch(var)&lt;br /&gt;
    {&lt;br /&gt;
        case 1:&lt;br /&gt;
            #ifdef A&lt;br /&gt;
            break;&lt;br /&gt;
            #endif&lt;br /&gt;
        case 2:&lt;br /&gt;
        case 3:&lt;br /&gt;
        default:&lt;br /&gt;
            break;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    class A&lt;br /&gt;
    {&lt;br /&gt;
        public:&lt;br /&gt;
            void stuff() {}&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Discouraged&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    {&lt;br /&gt;
        switch(var)&lt;br /&gt;
        {&lt;br /&gt;
        case 1:&lt;br /&gt;
    #ifdef A&lt;br /&gt;
            break;&lt;br /&gt;
    #endif&lt;br /&gt;
        case 2:&lt;br /&gt;
        case 3:&lt;br /&gt;
        default:&lt;br /&gt;
            break;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    class A&lt;br /&gt;
    {&lt;br /&gt;
    public:&lt;br /&gt;
        void stuff() {}&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Subjective&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    glBegin(GL_TRIANGLE_STRIP);&lt;br /&gt;
        glVertex2i(sx, sy);&lt;br /&gt;
        glVertex2i(ex, sy);&lt;br /&gt;
        glVertex2i(sx, ey);&lt;br /&gt;
        glVertex2i(ex, ey);&lt;br /&gt;
    glEnd();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When defining prototypes and variable names, place any special qualifiers (such as * or &amp;amp;) next to the variable name as opposed to the type. This is done mainly due to C/C++ parsing rules and the interest of readability. This also goes for prototypes and their argument lists.&lt;br /&gt;
&lt;br /&gt;
Good&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    const char *A, *B;&lt;br /&gt;
    const char *strstr(const char *haystack, const char *needle);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bad&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    const char* A, B; //note the types are const char*, and const char respectively&lt;br /&gt;
    const char* strstr(const char* haystack, const char* needle);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Variable and function names should be short, succinct and to the point. We should be able to infer from the name alone what the variable&amp;#039;s purpose is. Where possible, use common, accepted names for variables and descriptive verbs for functions. For example i, j, k or n are excellent variable names when you&amp;#039;re counting or checking against some sort of index, and verbs like &amp;quot;destroy&amp;quot; are ideal for functions that are intended to remove something from the game. When it comes to writing the names, the rules as as follows&lt;br /&gt;
&lt;br /&gt;
* Hungarian notation is not allowed, use &amp;#039;&amp;#039;&amp;#039;int num&amp;#039;&amp;#039;&amp;#039; over &amp;#039;&amp;#039;&amp;#039;int iNum&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* CamelCase is discouraged, but is accepted. Note that ThisIsPreferred and that thisIsNotPreferred.&lt;br /&gt;
* constants should always be written in ALL CAPS. macros are also preferred this way but this is not a strict requirement&lt;br /&gt;
&lt;br /&gt;
Good&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    int i, j, count;&lt;br /&gt;
    &lt;br /&gt;
    enum&lt;br /&gt;
    {&lt;br /&gt;
        FIRST = 0,&lt;br /&gt;
        SECOND,&lt;br /&gt;
        THIRD&lt;br /&gt;
    };&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bad&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    int iCount;&lt;br /&gt;
    bool bMerge;&lt;br /&gt;
    &lt;br /&gt;
    enum&lt;br /&gt;
    {&lt;br /&gt;
        First = 0,&lt;br /&gt;
        Second,&lt;br /&gt;
        Third&lt;br /&gt;
    };&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When defining prototypes, especially when doing it as an extern or the like, name all the arguments. C/C++ does allow you to only specify the types, but we will not permit such code. You are welcome to specify defaults where they make sense.&lt;br /&gt;
&lt;br /&gt;
Good&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    void function(int a, int b, float &amp;amp;ref, const char *ptr = NULL);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A crime against humanity&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
    void function(int, int, float&amp;amp;, const char*);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Comment wise, we believe in writing clean, simple, self documenting code. This obviously isn&amp;#039;t always possible and there may be strange quirks, odd preconditions or convoluted logic and it is these cases you must comment. As a rule of thumb if you write something and there&amp;#039;s a chance that you or someone else might trip up if you make further modifications try to use it or simply understand it, make a comment.&lt;br /&gt;
&lt;br /&gt;
= Cubescript =&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Main_Page&amp;diff=1567</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Main_Page&amp;diff=1567"/>
				<updated>2011-12-13T03:45:54Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Platinum Arts Sandbox Free 3D Game Maker&amp;#039;&amp;#039;&amp;#039; is a 3D game maker based on the Cube 2 engine that allows users to quickly and easily create and edit their own worlds in game, even cooperatively. It is free, open-source, and easy to use for Kids and Adults.  Sandbox logo by [http://sashazavisha.deviantart.com/art/young-creator-120946941 sashaZavisha].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:49%;float:left;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
* [[Platinum Arts Sandbox|About Platinum Arts Sandbox]]&lt;br /&gt;
* [http://SandboxGameMaker.com Project homepage]&lt;br /&gt;
* [[FAQ]]&lt;br /&gt;
* [[Contact The Team]]&lt;br /&gt;
* [[cmdline arguments|Command line Arguments]]&lt;br /&gt;
* [[packaging guide|The Packaging Guide]]&lt;br /&gt;
* [[server list|List Of Sandbox Servers]]&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
* [[Installing Platinum Arts Sandbox]]&lt;br /&gt;
* [[Compiling the source code]]&lt;br /&gt;
* [[package managers|Some Notes for package managers]]&lt;br /&gt;
&lt;br /&gt;
== Development ==&lt;br /&gt;
&lt;br /&gt;
* [[bug reports|Bug Reports]]&lt;br /&gt;
* [[Coding Style]]&lt;br /&gt;
* [[Contributing]]&lt;br /&gt;
* [[development|Obtaining the development version]]&lt;br /&gt;
* [[Todo|To do list]]&lt;br /&gt;
* [[content request| Content Request - Help us out!!]]&lt;br /&gt;
&lt;br /&gt;
== Kid Friendly RPG ==&lt;br /&gt;
* [[Concept Document]]&lt;br /&gt;
* [[Brainstorming area]]&lt;br /&gt;
&lt;br /&gt;
== Master Chef Ogro 2 ==&lt;br /&gt;
* [[Brainstorming]]&lt;br /&gt;
&lt;br /&gt;
== Undercover Kids Game ==&lt;br /&gt;
* [[To Do List]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:49%;float:right;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
* [[Map Editing Basics]]&lt;br /&gt;
* [[Mapping Taboos]]&lt;br /&gt;
* [[Beginner&amp;#039;s video tutorials]]&lt;br /&gt;
* [[Good free programs for Sandbox]]&lt;br /&gt;
&lt;br /&gt;
== Advanced topics ==&lt;br /&gt;
&lt;br /&gt;
* [[Cooperative Editing]] (General Server set up)&lt;br /&gt;
* [[Cooperative Editing 2]] (Easier way using Hamachi)&lt;br /&gt;
* [[Adding Models to Sandbox]]&lt;br /&gt;
* [http://sandboxgamemaker.com/platinumartssandboxeditref.html Editing Reference Guide]&lt;br /&gt;
* [http://sauerbraten.org/docs/models.html Model Reference Guide]&lt;br /&gt;
* [[Configuration Reference Guide]]&lt;br /&gt;
* [[Cubescript]]&lt;br /&gt;
* [[Menu Editing]] ([[New menu editing|newui]])&lt;br /&gt;
* [[map_config|Map Configuration]]&lt;br /&gt;
&lt;br /&gt;
== Example Modules ==&lt;br /&gt;
&lt;br /&gt;
* [[FPS|FPS - First Person Shooter (default)]]&lt;br /&gt;
* [[RPG|RPG - Role Playing Game]]&lt;br /&gt;
* [[SSP|SSP - Side Scrolling Platformer]]&lt;br /&gt;
* [[MovieCube|MovieCube - Machinima Tool]]&lt;br /&gt;
* [[Vehicle Simulator]]&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
*[[Tips on Making a Good Map]]&lt;br /&gt;
*[[Tutorials List | Text Tutorials List]]&lt;br /&gt;
*[[Video Tutorials List]]&lt;br /&gt;
*[[Kid Matthew&amp;#039;s RPG Tutorials]]&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Cubescript&amp;diff=1540</id>
		<title>Cubescript</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Cubescript&amp;diff=1540"/>
				<updated>2011-12-04T12:41:00Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* substitution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cubescript is the scripting language utilised within the sauerbraten/cube2 engine. it is used to set aliases, variables, create binds and generate the menu.&lt;br /&gt;
&lt;br /&gt;
=Writing in Cubescript=&lt;br /&gt;
&lt;br /&gt;
==Aliases==&lt;br /&gt;
&lt;br /&gt;
The brunt of cubescript is concerned with Aliases. Aliases have 3 basic uses.&lt;br /&gt;
* store lists and values for extended periods of time&lt;br /&gt;
* store temporary lists and values&lt;br /&gt;
* grouping a set of commands which are useful when combined&lt;br /&gt;
&lt;br /&gt;
There are two ways to declare an alias. You can do it via infix notation, or by using the alias command. It should be noted that aliases are the exception to the rule, infix notation is only available for creating aliases.&lt;br /&gt;
&lt;br /&gt;
A VERY important note, alias specific operations are available to aliases only. this means builtin variables can&amp;#039;t be set or overridden through alias, =, pop and push (among others).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //command&lt;br /&gt;
  alias myalias [1]&lt;br /&gt;
  &lt;br /&gt;
  //infix variant&lt;br /&gt;
  myalias = [1]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===executing aliases===&lt;br /&gt;
&lt;br /&gt;
To execute an alias, you execute it like any other command. if I had an alias named &amp;#039;&amp;#039;&amp;#039;myalias&amp;#039;&amp;#039;&amp;#039;, I would simply invoke &amp;#039;&amp;#039;&amp;#039;&amp;#039;/myalias&amp;#039;&amp;#039;&amp;#039; to execute it.&lt;br /&gt;
&lt;br /&gt;
These aliases also have access to a class of special aliases. Those are the temporaries in which arguments are stored. There&amp;#039;s also a useful variable named &amp;#039;numargs&amp;#039; which tell you how many arguments were provided. The aliases containing the arguments are named arg. they are numbered and enumerated, starting from 1, so you&amp;#039;d use $arg1 to access the first argument. This does not start at 0, since arg0 is the command&amp;#039;s name (arg0 is also not defined.. ever, nor included in numargs).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //prints all arguments to screen, one by one&lt;br /&gt;
  //see the other comments for an explanation&lt;br /&gt;
  &lt;br /&gt;
  print = [                                    //declares an alias named print&lt;br /&gt;
    loop i $numargs [                          //loops $numargs times, setting i to the current iteration&lt;br /&gt;
      echo (getalias (concatword arg (+ $i 1)) //gets the value of the arguments, by accessing $arg1 $arg2 $arg3....&lt;br /&gt;
    ]                                          //close loop&lt;br /&gt;
  ]                                            //close print alias&lt;br /&gt;
  print I like unicorns                        //should print I like unicorns on 3 separate lines&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===push and pop===&lt;br /&gt;
&lt;br /&gt;
Push and pop used to be two separate instructions, but since the advent of the new Cubescrpt interpreter/compiler (2.6.1), they have been merged into a single instruction. The syntax for this singular stack manipulation command is as follows.&lt;br /&gt;
&lt;br /&gt;
push variable value body&lt;br /&gt;
&lt;br /&gt;
The stack is automatically popped after execution&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;candy&amp;quot;&lt;br /&gt;
  push myalias &amp;quot;lollipops&amp;quot; [&lt;br /&gt;
    echo $myalias&lt;br /&gt;
  ]&lt;br /&gt;
  echo $myalias&lt;br /&gt;
  &lt;br /&gt;
  //expected output&lt;br /&gt;
  //lollipops&lt;br /&gt;
  //candy&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&lt;br /&gt;
Cubescript is not your typical scripting language. Cubescript is not the most flexible, or the best language, but it more than adequate for our needs and purposes. Cubescript draws its main inspiration from quakescript and from Lisp. It is therefor said that Cubescript contains many &amp;quot;Lispisms&amp;quot;. Below is a summary of notable features/quirks.&lt;br /&gt;
&lt;br /&gt;
* comments are denoted by //&lt;br /&gt;
* both newlines and ; denote the end of a call.&lt;br /&gt;
* newlines will automatically close of any strings you may have forgotten to. (you should not rely on this)&lt;br /&gt;
* substitutions are done through the use of $ and @ tokens, (See below)&lt;br /&gt;
* everything is a function which may take arguments. With the exception of setting an alias, infix notation does not exist&lt;br /&gt;
* there are no arrays or vectors, only lists.&lt;br /&gt;
* most implementations have a 25 word limit. This means commands can be invoked with up to 24 arguments&lt;br /&gt;
&lt;br /&gt;
one liner example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias hi [say &amp;quot;hi&amp;quot;; sleep 5000 [say &amp;quot;Hi again&amp;quot;]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
multi liner example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias hi [&lt;br /&gt;
    say &amp;quot;hi&amp;quot;&lt;br /&gt;
    sleep 5000 [&lt;br /&gt;
      say &amp;quot;Hi again&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it&amp;#039;s obvious what the above code does, it&amp;#039;ll make your character say hi, and wait 5 seconds before saying hi again.&lt;br /&gt;
&lt;br /&gt;
indenting is done in levels, the Tabulator (TAB) key is usually used to indent the text. while not necessary, it tends to make it bigger, and more legible as seen in the above example (when you get to big stuff, you&amp;#039;ll thank yourself for indenting it.&lt;br /&gt;
&lt;br /&gt;
As a rule of thumb, pretty much only [ increases the indentation level. Also note, &amp;quot;, ] and ) can close each other, so make sure you close them off properly&lt;br /&gt;
&lt;br /&gt;
==containers==&lt;br /&gt;
&lt;br /&gt;
Containers in cubescript are of 3 specific types, &amp;quot;&amp;quot;, () and [] - all of these have significant differences in operation and use&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;&amp;quot; container===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot; containers are used to store things EXACTLY as they are written, with a few small exceptions - in-text commands which are denoted by a preceding ^. They are as follows&lt;br /&gt;
&lt;br /&gt;
* ^f#&lt;br /&gt;
** ^f# is used to colour text. # must be replaced by either a number or a capital letter (A-Z). r and s are special control characters which will restore and save the text&amp;#039;s current colour respectively. &lt;br /&gt;
* ^n&lt;br /&gt;
** insert a &amp;#039;\n&amp;#039; character (newline/linefeed)&lt;br /&gt;
* ^t&lt;br /&gt;
** inserts a &amp;#039;\t&amp;#039; character (tabulator)&lt;br /&gt;
* ^&amp;quot;&lt;br /&gt;
** inserts a quote (&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
===() container===&lt;br /&gt;
&lt;br /&gt;
() containers are used mainly for logic/arithmetic operations. They are usually nested inside [] blocks, and unless they are nested inside []&amp;#039;s they&amp;#039;re permanently substituted with their results.&lt;br /&gt;
&lt;br /&gt;
For example - the following will turn into an infinite loop. The condition is initially evaluated and substituted with one and since 1 can never = 0, it&amp;#039;s true forever more&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  i = 0&lt;br /&gt;
  while (= $i 0) [i = (+ $i 1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the following code on the otherhand is devoid of such issues. Being nested inside the [] means it&amp;#039;s not substituted and evaluated each cycle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  i = 0&lt;br /&gt;
  while [= $i 0] [i = (+ $i 1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[] container===&lt;br /&gt;
&lt;br /&gt;
This container is used for nesting, deferring execution of it&amp;#039;s contents, deferring calculations and substitutions of () containers, and substitutions of aliases/variables written with a @ prefix (note several levels are needed to achieve this). [] containers are also the ONLY container capable of spanning multiple lines.&lt;br /&gt;
&lt;br /&gt;
This is the most used container and due to it&amp;#039;s properties, is ideal for creating aliases.&lt;br /&gt;
&lt;br /&gt;
generally statements in cubescript can&amp;#039;t span multiple lines. If you should use this container and occupy several, the execution of the prior command continues exactly where this container finished off. This can be demonstrated with an if statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  if 1 [&lt;br /&gt;
    do&lt;br /&gt;
    stuff&lt;br /&gt;
  ] [&lt;br /&gt;
    do&lt;br /&gt;
    other&lt;br /&gt;
    stuff&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==substitution==&lt;br /&gt;
&lt;br /&gt;
there are two principle ways of substituting values in cubescript, the first is through the use of $ tokens, the second is through the use of @ tokens.&lt;br /&gt;
&lt;br /&gt;
a very simple example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = 5&lt;br /&gt;
  echo $myalias&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
myalias is substituted into the echo statement, so you should see 5 printed to the top-left of the screen&lt;br /&gt;
&lt;br /&gt;
using the @ token would have also resulted in the same behaviour&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = 5&lt;br /&gt;
  echo @myalias&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There&amp;#039;s a big difference between the two, the @ token can be used to concatenate stuff together, $ can&amp;#039;t. @ is also substituted immediately up to the first level of nesting. (this can be incremented by using additional @ tokens, ie @@ for 2 levels of nesting). Do take note that too few @ tokens may cause a substitution to happen too late, and too many may likewise cause it to happen too early or cause other weird and subtle issues.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;An example of use in a level 1 nest&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;I am awesome&amp;quot;&lt;br /&gt;
  mymenu = [guitext @myalias]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
if you were to type /echo $mymenu, it should read: guitext &amp;quot;I am awesome&amp;quot;; using the $ token on the other hand&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;I am awesome&amp;quot;&lt;br /&gt;
  mymenu = [guitext $myalias]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
typing /echo $mymenu should produce: guitext $myalias&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;An example of concatenation&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
as i mentioned, @ also allows you to concatenate stuff together, which could result in shorter and simpler scripts. It should be noted that this can also result in extreme obfuscation&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias0 = 5&lt;br /&gt;
  myalias1 = 3.1415&lt;br /&gt;
  myalias2 = 2.481&lt;br /&gt;
  &lt;br /&gt;
  loop i 3 [ do [&lt;br /&gt;
    echo $myalias@i&lt;br /&gt;
  ]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
this should print 5, 3.1415 and 2.481 respectively&lt;br /&gt;
&lt;br /&gt;
the purely $ token equivalent&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias0 = 5&lt;br /&gt;
  myalias1 = 3.1415&lt;br /&gt;
  myalias2 = 2.481&lt;br /&gt;
  &lt;br /&gt;
  loop i 3 [&lt;br /&gt;
    echo (getalias (concatword myalias $i))&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Lookup of a Lookup&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are two ways to look up multiple things; the first is by encasing it inside &amp;#039;getalias&amp;#039;, the second involves using multiple lookup tokens. There is a caveat with the second method, while it works on more types, it&amp;#039;s only available in sandbox as of 2.6.1.&lt;br /&gt;
&lt;br /&gt;
All 3 of the below examples should print &amp;quot;victory!&amp;quot;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias1 = &amp;quot;alias2&amp;quot;&lt;br /&gt;
  alias2 = &amp;quot;alias3&amp;quot;&lt;br /&gt;
  alias3 = &amp;quot;victory!&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //the first method&lt;br /&gt;
  echo (getalias (getalias $alias1))&lt;br /&gt;
  &lt;br /&gt;
  //the second method; 2.6.1&lt;br /&gt;
  echo $$$alias1&lt;br /&gt;
  &lt;br /&gt;
  //to show compatibility with @&lt;br /&gt;
  do [&lt;br /&gt;
    echo $$@alias1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Branching/Decisions==&lt;br /&gt;
&lt;br /&gt;
Decisions are based on 6 key commands, &amp;#039;&amp;#039;&amp;#039;if&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;cond&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;case&amp;#039;&amp;#039;&amp;#039; (integer), &amp;#039;&amp;#039;&amp;#039;casef&amp;#039;&amp;#039;&amp;#039; (float) and &amp;#039;&amp;#039;&amp;#039;cases&amp;#039;&amp;#039;&amp;#039; (string). There are also other ways to do this. For example you might be able to easily query something about an object, where it&amp;#039;s obviously unique. You would then execute an alias whose name has this unique bit attached onto the end. This is an advanced method and is generally not recommended. &lt;br /&gt;
&lt;br /&gt;
===if and ?===&lt;br /&gt;
&lt;br /&gt;
Arguments: Cond True False&lt;br /&gt;
&lt;br /&gt;
Unlike most other languages, cubescript&amp;#039;s &amp;#039;&amp;#039;&amp;#039;if&amp;#039;&amp;#039;&amp;#039; contains an implicit else, in short we do not have an else statement. The provided condition is true if it ends up as a series of alpha numerics, or in the case of a number, as a value other than 0. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias1 = 5&lt;br /&gt;
  myalias2 = &amp;quot;woot&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //if else-if else&lt;br /&gt;
  if $myalias1 [&lt;br /&gt;
    echo &amp;quot;myalias1 is true&amp;quot;&lt;br /&gt;
  ] [&lt;br /&gt;
    //this shows the alpha numerics case&lt;br /&gt;
    if $myalias2 [&lt;br /&gt;
      echo &amp;quot;myalias1 is false and myalias2 is true&amp;quot;&lt;br /&gt;
    ] [&lt;br /&gt;
      echo &amp;quot;myalias1 is false and myalias2 is false&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039; acts exactly the same way, but there&amp;#039;s one HUGE difference. &amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039; does not execute the chosen result.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //an example of where ? can be used where if would fail&lt;br /&gt;
  items = 1&lt;br /&gt;
  echo (format &amp;quot;You are carrying %1 item%2.&amp;quot; $items (? (= $items 1) &amp;quot;&amp;quot; &amp;quot;s&amp;quot;))&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===cond===&lt;br /&gt;
&lt;br /&gt;
basically you provided a several pairs of arguments, the first half of the pair is the condition, and the second is the result. To put it in a programming perspective, this is like creating a long line of if else&amp;#039;s together. Execution stops when the first condition is matched. Should you place several conditions where more than one may be true at any one time, only the first will be executed. &lt;br /&gt;
&lt;br /&gt;
The following example assumes you have a light entity selected&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  lightstrength = [&lt;br /&gt;
    cond [&amp;lt; (ea 0) 0] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s like a black hole!&amp;quot;&lt;br /&gt;
    ] [= (ea 0) 0] [&lt;br /&gt;
      echo &amp;quot;Blindlier than science!&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 8] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s weaker than Billy&amp;#039;s night light!&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 32] [&lt;br /&gt;
      echo &amp;quot;Nice night light you got there&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 96] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s like a lamp, but it&amp;#039;s not a lamp&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 512] [&lt;br /&gt;
      echo &amp;quot;By Jove! I can actually see the ground!&amp;quot;&lt;br /&gt;
    ] [&amp;gt;= (ea 0) 512] [&lt;br /&gt;
      echo &amp;quot;Dark places are icky, don&amp;#039;t you agree?&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===case===&lt;br /&gt;
&lt;br /&gt;
This works similar to switches in most programming languages. The biggest difference is that you can&amp;#039;t break out, nor evaluate multiple cases (aka, fallthroughs).&lt;br /&gt;
&lt;br /&gt;
The first argument tells it which variable to use. The following arguments are given in pairs, the first half is the state, the second is the result.&lt;br /&gt;
If the state is a null type, it is considered the default case. The easiest way to generate a null type is to use ()&lt;br /&gt;
&lt;br /&gt;
The following example requires a particles entity to be selected, it will print out what type it is. Do note that this example exceeds the 25 word limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  parttype = [&lt;br /&gt;
    pname = &amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    case (ea 0) 0 [&lt;br /&gt;
      pname = &amp;quot;Fire and Smoke&amp;quot;&lt;br /&gt;
    ] 1 [&lt;br /&gt;
      pname = &amp;quot;Fire&amp;quot;&lt;br /&gt;
    ] 2 [&lt;br /&gt;
      pname = &amp;quot;Smoke Plume&amp;quot;&lt;br /&gt;
    ] 3 [&lt;br /&gt;
      pname = &amp;quot;Smoke&amp;quot;&lt;br /&gt;
    ] 4 [&lt;br /&gt;
      pname = &amp;quot;Fountain&amp;quot;&lt;br /&gt;
    ] 5 [&lt;br /&gt;
      pname = &amp;quot;Explosion&amp;quot;&lt;br /&gt;
    ] 6 [&lt;br /&gt;
      pname = &amp;quot;Meter&amp;quot;&lt;br /&gt;
    ] 7 [&lt;br /&gt;
      pname = &amp;quot;Vs Meter&amp;quot;&lt;br /&gt;
    ] 8 [&lt;br /&gt;
      pname = &amp;quot;Text&amp;quot;&lt;br /&gt;
    ] 9 [&lt;br /&gt;
      pname = &amp;quot;Flare&amp;quot;&lt;br /&gt;
    ] 10 [&lt;br /&gt;
      pname = &amp;quot;Lightning&amp;quot;&lt;br /&gt;
    ] 11 [&lt;br /&gt;
      pname = &amp;quot;Fire&amp;quot;&lt;br /&gt;
    ] 12 [&lt;br /&gt;
      pname = &amp;quot;Smoke&amp;quot;&lt;br /&gt;
    ] 13 [&lt;br /&gt;
      pname = &amp;quot;Water&amp;quot;&lt;br /&gt;
    ] 14 [&lt;br /&gt;
      pname = &amp;quot;Snow&amp;quot;&lt;br /&gt;
    ] 15 [&lt;br /&gt;
      pname = &amp;quot;Leaves&amp;quot;&lt;br /&gt;
    ] 32 [&lt;br /&gt;
      pname = &amp;quot;Lens Flare&amp;quot;&lt;br /&gt;
    ] 33 [&lt;br /&gt;
      pname = &amp;quot;Fixed Size Lens Flare&amp;quot;&lt;br /&gt;
    ] 34 [&lt;br /&gt;
      pname = &amp;quot;Sparkly Lens Flare&amp;quot;&lt;br /&gt;
    ] 35 [&lt;br /&gt;
      pname = &amp;quot;Sparkly Fixed Size Lens Flare&amp;quot;&lt;br /&gt;
    ] () [ //default&lt;br /&gt;
      pname = &amp;quot;A very pretty albeit unsupported particle&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  &lt;br /&gt;
    echo The particle you have selected is of type: $pname&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Naming===&lt;br /&gt;
&lt;br /&gt;
another way of doing decisions/branches is to use paths with different names. This has limited usage though. in short it requires you to query some information to concatenate onto another word, which you would then execute. There are exceptions. Other than the number of results you can query, there is no limit here. A handy trick is to have several results execute the same alias, though this requires that they differ only slightly at most in operation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //This example demonstrates the exception&lt;br /&gt;
  //it requires you to have an entity selected&lt;br /&gt;
  //This will conflict with showquickgui&lt;br /&gt;
  newgui &amp;quot;particles&amp;quot; [guitext &amp;quot;It&amp;#039;s like a random series of nothing&amp;quot;]&lt;br /&gt;
  newgui &amp;quot;light&amp;quot; [guitext &amp;quot;SHINY!!!!&amp;quot;]&lt;br /&gt;
  newgui &amp;quot;jumppad&amp;quot; [guitext &amp;quot;boing!&amp;quot;]&lt;br /&gt;
  &lt;br /&gt;
  identify = [showgui (et)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //shows a more standard example, at present this is exclusively used by edithud (see stdedit.cfg)&lt;br /&gt;
  //this also requires you to have an entity selected.&lt;br /&gt;
  identlight = [echo &amp;quot;it&amp;#039;s so bright...&amp;quot;]&lt;br /&gt;
  identdynlight = [identlight] // to demonstrate how different results can execute the same script&lt;br /&gt;
  identjumppad = [echo &amp;quot;boing? boing!&amp;quot;]&lt;br /&gt;
  identparticles = [echo &amp;quot;Please don&amp;#039;t change it to a lens flare!&amp;quot;]&lt;br /&gt;
  &lt;br /&gt;
  identify = [ if (enthavesel) [ident@(et)] [echo Select an entity first!]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Lists==&lt;br /&gt;
&lt;br /&gt;
Ordered lists are the closest cubescript has to the likes of arrays. Their declaration is identical to any alias, as they are simply items in a string separated by white space. Using [] is recommended as the container of choice, since it allows you to use &amp;quot;&amp;quot; to include multi-word items in a list as a single unit as well as define the list over multiple lines. &amp;quot;&amp;quot; can also be used to define lists. An example can be inspected below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //declares 2 equivalent lists of 3 elements&lt;br /&gt;
  mylist1 = [one two &amp;quot;three four&amp;quot;]&lt;br /&gt;
  mylist2 = &amp;quot;one two ^&amp;quot;three four^&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //prints the 3rd element&lt;br /&gt;
  echo (at $mylist 2)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;loops&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are at least 2 ways to loop through a list. The first method involves the use of looplist to iterate over it and the second the use of listlen to determine the list&amp;#039;s length. The difference between using looplist and listlen is that you will not have a reliable way of determining an element&amp;#039;s index and won&amp;#039;t have to manually fetch the element from the list. Basically looplist is faster at the cost of some information and should be used in all cases where the index does not need to be known.&lt;br /&gt;
An example can be inspected below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [&lt;br /&gt;
    0&lt;br /&gt;
    1&lt;br /&gt;
    3.14159265359&lt;br /&gt;
    2.71828182845&lt;br /&gt;
    sqrt(-1)&lt;br /&gt;
    1 //to demonstrate that the index cannot be determined reliably with looplist&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //demonstrates looplist&lt;br /&gt;
  looplist var $mylist [&lt;br /&gt;
    echo number (listfind item $mylist [strcmp $var $item]) : $var&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //demonstrates a loop + listlen combo&lt;br /&gt;
  loop i (listlen $mylist) [&lt;br /&gt;
    echo number $i : (at $mylist $i)&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;concatenation&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Concatenation is pretty simple, albeit not very efficient. It is basically, setting the list to itself plus the additional item. This is of course best achieved through the concat commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [1 2 3 4 5 6 7 8 9 10]&lt;br /&gt;
  &lt;br /&gt;
  //using concatword&lt;br /&gt;
  mylist = (concatword $mylist &amp;quot; &amp;quot; 11)&lt;br /&gt;
  &lt;br /&gt;
  //using format&lt;br /&gt;
  mylist = (format &amp;quot;%1 %2&amp;quot; $mylist 12)&lt;br /&gt;
  &lt;br /&gt;
  //using concat - we&amp;#039;re also preparing it for pretty list&lt;br /&gt;
  mylist = (concat $mylist 14)&lt;br /&gt;
  &lt;br /&gt;
  //pretty list does add an item onto the list, but it changes the format dramatically and the new item is placed before the end&lt;br /&gt;
  //it is ideal more so for making things pretty for presentation than concatenation&lt;br /&gt;
  mylist = (prettylist $mylist 13)&lt;br /&gt;
  &lt;br /&gt;
  //should print 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 14&lt;br /&gt;
  echo mylist is $mylist&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
concat returns everything given to it as a singular item, spaces and all. Concatword ignores spaces and &amp;quot;&amp;quot;&amp;#039;s must be explicitly provided. Concat is therefor ideal to add lists together. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist1 = [1 2 3 4 5]&lt;br /&gt;
  mylist2 = [6 7 8 9 10]&lt;br /&gt;
  mylist3 = [11 12 13 14 15]&lt;br /&gt;
  mylist4 = [16 17 18 19 20]&lt;br /&gt;
  mylist5 = [21 22 23 24 25]&lt;br /&gt;
  mylist6 = [26 27 28 29 30]&lt;br /&gt;
  finallist = &amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //how concatword merged three lists&lt;br /&gt;
  finallist = (concatword $mylist1 &amp;quot; &amp;quot; $mylist2 &amp;quot; &amp;quot; $mylist3)&lt;br /&gt;
  &lt;br /&gt;
  //concat unlike the above does not require&lt;br /&gt;
  finallist = (concat $finallist $mylist4 $mylist5 $mylist6)&lt;br /&gt;
  &lt;br /&gt;
  echo (prettylist $finallist)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;finding&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
there are two ways to find things, the first is to use listfind, and the second is to loop through the list. Both are demonstrated in the example below&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [&lt;br /&gt;
    &amp;quot;Jack&amp;quot;&lt;br /&gt;
    &amp;quot;Jane&amp;quot;&lt;br /&gt;
    &amp;quot;Joseph&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //This is an example of looking for a single element, note that this variant of...&lt;br /&gt;
  //strcmp unlike its C counterpart returns 1 when strings are equal&lt;br /&gt;
  //in this example, a 0 should be printed at the top of your screen - listfind returns the index&lt;br /&gt;
  echo (listfind f $mylist [strcmp $f &amp;quot;Jack&amp;quot;])&lt;br /&gt;
  &lt;br /&gt;
  //In this example, -1, as Jill is not in the list&lt;br /&gt;
  echo (listfind f $mylist [strcmp $f &amp;quot;Jill&amp;quot;])&lt;br /&gt;
  &lt;br /&gt;
  //in this example, we want to find anything which contains an e and add it into a list&lt;br /&gt;
  results = &amp;quot;&amp;quot;&lt;br /&gt;
  looplist var $mylist [&lt;br /&gt;
    if (&amp;gt;= (strstr $var &amp;quot;e&amp;quot;) 0) [&lt;br /&gt;
      results = (concatword $results &amp;quot;^&amp;quot;&amp;quot; $var &amp;quot; ^&amp;quot;&amp;quot;)&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //this should print: Jane Joseph&lt;br /&gt;
  echo $results&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=List of commands=&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
The following commands are quite often used in a lot of scripts. &lt;br /&gt;
&lt;br /&gt;
* alias N B&lt;br /&gt;
** creates an alias named N with body B, the intext version is denoted as N = B (equivalent to alias N B)&lt;br /&gt;
* at S I&lt;br /&gt;
** returns the Ith element in string S, note that counting starts from 0. If it&amp;#039;s out of range, &amp;quot;&amp;quot; is returned&lt;br /&gt;
* getalias A&lt;br /&gt;
** returns the value of A. this also does not produce a warning should an alias be undeclared, nor complains when fetching built in variables.&lt;br /&gt;
* if C T F (F is optional)&lt;br /&gt;
** if condition C is true, execute T, otherwise F is executed &lt;br /&gt;
* listlen S&lt;br /&gt;
** returns the amount of elements in list S&lt;br /&gt;
* loop V N B&lt;br /&gt;
** loops N times, and aliases the current iteration to V; B is executed every iteration.&lt;br /&gt;
* result S&lt;br /&gt;
** returns the string, useful when aliases need to be executed&lt;br /&gt;
* rnd N L&lt;br /&gt;
** chooses a random number between 0 and N-1 (inclusive). L sets the lower limit. eg rnd 12 7 will return either 7 8 9 10 or 11&lt;br /&gt;
* sleep N B&lt;br /&gt;
** executes B after a delay of N milliseconds. NOTE: even if N is &amp;lt;= 0, it&amp;#039;ll still wait till the next frame before executing it&lt;br /&gt;
* while C B&lt;br /&gt;
** executed B while C is true. NOTE: surround C in a [] container, or you risk an infinite loop due to the condition not being reevaluated.&lt;br /&gt;
&lt;br /&gt;
==Map Configuration==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;ONLY APPLIES TO FPSGAME&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The following commands are useful in level only aliases&lt;br /&gt;
&lt;br /&gt;
*triggerstate&lt;br /&gt;
*level_trigger&lt;br /&gt;
**level trigger is invoked as level_trigger_1 = [] as an example, the end number is the 4th number in the mapmodel&amp;#039;s strings&lt;br /&gt;
*level_base&lt;br /&gt;
**Used to give bases names in capture mode. This is unfortunately unused in PAS&lt;br /&gt;
&lt;br /&gt;
==Binds==&lt;br /&gt;
&lt;br /&gt;
The following commands are useful in binds.&lt;br /&gt;
&lt;br /&gt;
*onrelease&lt;br /&gt;
&lt;br /&gt;
==Gui Creation==&lt;br /&gt;
&lt;br /&gt;
For newui, please see [[new menu editing]]&lt;br /&gt;
&lt;br /&gt;
These commands are used to create various menus.&lt;br /&gt;
&lt;br /&gt;
* cleargui&lt;br /&gt;
* guibar&lt;br /&gt;
* guibutton&lt;br /&gt;
* guicheckbox&lt;br /&gt;
* guifield&lt;br /&gt;
* guikeyfield&lt;br /&gt;
* guiimage&lt;br /&gt;
* guilist&lt;br /&gt;
* guirolloveraction&lt;br /&gt;
* guirollovername&lt;br /&gt;
* guislider&lt;br /&gt;
* guilistslider&lt;br /&gt;
* guinameslider&lt;br /&gt;
* guistayopen&lt;br /&gt;
* guitab&lt;br /&gt;
* guitext&lt;br /&gt;
* guititle&lt;br /&gt;
* guistrut&lt;br /&gt;
* newgui&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
&lt;br /&gt;
The functions here can change the values, or return a logical comparison&lt;br /&gt;
for all intents and purposes, the C version of booleans apply here; values not equal to 0 are true - and functions that return true return 1&lt;br /&gt;
&lt;br /&gt;
===Integer Arithmetic===&lt;br /&gt;
&lt;br /&gt;
* + A B&lt;br /&gt;
** returns the value of the numbers added together&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns the result of multiplying A and B&lt;br /&gt;
* - A B&lt;br /&gt;
** returns the value of A - B&lt;br /&gt;
* = A B&lt;br /&gt;
** returns true of the two are equal&lt;br /&gt;
* != A B&lt;br /&gt;
** returns true if the two aren&amp;#039;t equal&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than-or-equal-to B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than-or-equal-to B&lt;br /&gt;
* ! A&lt;br /&gt;
** if the argument is false, it returns true&lt;br /&gt;
* &amp;amp;&amp;amp;&lt;br /&gt;
** returns true if all arguments are true&lt;br /&gt;
* ||&lt;br /&gt;
** returns true it at least one argument is true&lt;br /&gt;
* div A B&lt;br /&gt;
** returns the value of A divided by B&lt;br /&gt;
* mod A B&lt;br /&gt;
** returns the modulus of the two arguments&lt;br /&gt;
* min&lt;br /&gt;
** returns the lowest valued argument of all provided arguments&lt;br /&gt;
* max&lt;br /&gt;
** returns the highest valued argument of all provided arguments&lt;br /&gt;
&lt;br /&gt;
===Bitwise Integer Operations===&lt;br /&gt;
&lt;br /&gt;
* ^ A B&lt;br /&gt;
** returns the value of A xor B ie (^ 8 4) is 12 - (^ 12 4) is 8&lt;br /&gt;
* &amp;amp; A B&lt;br /&gt;
** returns the value of the bits both A and B have&lt;br /&gt;
* | A B&lt;br /&gt;
** returns the value of the bits either A or B have&lt;br /&gt;
* ~ A&lt;br /&gt;
** returns the inverted bitwise version of A ie (&amp;amp; (~ 128) 255) is 127&lt;br /&gt;
* ^~ A B&lt;br /&gt;
** xor;s the arguments after applying an inversion on B&lt;br /&gt;
* &amp;amp;~ A B&lt;br /&gt;
** and&amp;#039;s the arguments after applying an inversion on B&lt;br /&gt;
* |~ A B&lt;br /&gt;
** or&amp;#039;s the arguments after applying an inversion on B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;&amp;lt;/nowiki&amp;gt; A N&lt;br /&gt;
** shifts A N bits&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; A N&lt;br /&gt;
** shifts A -N bits&lt;br /&gt;
&lt;br /&gt;
===Floating Point Arithmetic===&lt;br /&gt;
&lt;br /&gt;
Generally these just have an -f suffix&lt;br /&gt;
&lt;br /&gt;
* +f A B&lt;br /&gt;
** returns the value of the numbers added together&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;*f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns the result of multiplying A and B&lt;br /&gt;
* -f A B&lt;br /&gt;
** returns the value of A - B&lt;br /&gt;
* =f A B&lt;br /&gt;
** returns true of the two are equal&lt;br /&gt;
* !=f A B&lt;br /&gt;
** returns true if the two aren&amp;#039;t equal&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than-or-equal-to B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than-or-equal-to B&lt;br /&gt;
* divf A B&lt;br /&gt;
** returns the value of A divided by B&lt;br /&gt;
* modf A B&lt;br /&gt;
** returns the modulus of the two arguments&lt;br /&gt;
* minf&lt;br /&gt;
** returns the lowest valued argument of all provided arguments&lt;br /&gt;
* maxf&lt;br /&gt;
** returns the highest valued argument of all provided arguments&lt;br /&gt;
&lt;br /&gt;
===Strings===&lt;br /&gt;
&lt;br /&gt;
* =s A B&lt;br /&gt;
** returns 1 if the string matches, 0 otherwise&lt;br /&gt;
* !=s A B&lt;br /&gt;
** returns 0 if the string matches, 1 otherwise&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns less-than 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns greater-than 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns less-than-or-equal-to 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns greater-than-or-equal-to 0&lt;br /&gt;
* strcmp A B&lt;br /&gt;
** returns 1 if the string matches, 0 otherwise (unlike the C version with returns the disparity)&lt;br /&gt;
* strstr H N&lt;br /&gt;
** returns the position of N in H - otherwise -1 is returned&lt;br /&gt;
* strlen S&lt;br /&gt;
** returns the length of the string&lt;br /&gt;
* strreplace S O N&lt;br /&gt;
** replaces all instances of O inside string S with N&lt;br /&gt;
&lt;br /&gt;
==String/text formatting==&lt;br /&gt;
&lt;br /&gt;
These commands are used to format aliases which are normally huge bits of text&lt;br /&gt;
&lt;br /&gt;
* concat C&lt;br /&gt;
** everything you type after will be returned; with expressions and substitutions performed&lt;br /&gt;
* concatword C&lt;br /&gt;
** the next 25 arguments will be executed and subsequently concatenated without any spaces between them&lt;br /&gt;
* format F S1 S2 S3 S4 S5 S6 S7 S8 S9&lt;br /&gt;
** F is a string containing %# tokens, format substitutes the arguments with their respective %# tokens (ie: S5 will replace %5)&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
*[[map_config|Map Configuration]]&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Cubescript&amp;diff=1539</id>
		<title>Cubescript</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Cubescript&amp;diff=1539"/>
				<updated>2011-12-04T12:39:39Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* substitution */  fix example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cubescript is the scripting language utilised within the sauerbraten/cube2 engine. it is used to set aliases, variables, create binds and generate the menu.&lt;br /&gt;
&lt;br /&gt;
=Writing in Cubescript=&lt;br /&gt;
&lt;br /&gt;
==Aliases==&lt;br /&gt;
&lt;br /&gt;
The brunt of cubescript is concerned with Aliases. Aliases have 3 basic uses.&lt;br /&gt;
* store lists and values for extended periods of time&lt;br /&gt;
* store temporary lists and values&lt;br /&gt;
* grouping a set of commands which are useful when combined&lt;br /&gt;
&lt;br /&gt;
There are two ways to declare an alias. You can do it via infix notation, or by using the alias command. It should be noted that aliases are the exception to the rule, infix notation is only available for creating aliases.&lt;br /&gt;
&lt;br /&gt;
A VERY important note, alias specific operations are available to aliases only. this means builtin variables can&amp;#039;t be set or overridden through alias, =, pop and push (among others).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //command&lt;br /&gt;
  alias myalias [1]&lt;br /&gt;
  &lt;br /&gt;
  //infix variant&lt;br /&gt;
  myalias = [1]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===executing aliases===&lt;br /&gt;
&lt;br /&gt;
To execute an alias, you execute it like any other command. if I had an alias named &amp;#039;&amp;#039;&amp;#039;myalias&amp;#039;&amp;#039;&amp;#039;, I would simply invoke &amp;#039;&amp;#039;&amp;#039;&amp;#039;/myalias&amp;#039;&amp;#039;&amp;#039; to execute it.&lt;br /&gt;
&lt;br /&gt;
These aliases also have access to a class of special aliases. Those are the temporaries in which arguments are stored. There&amp;#039;s also a useful variable named &amp;#039;numargs&amp;#039; which tell you how many arguments were provided. The aliases containing the arguments are named arg. they are numbered and enumerated, starting from 1, so you&amp;#039;d use $arg1 to access the first argument. This does not start at 0, since arg0 is the command&amp;#039;s name (arg0 is also not defined.. ever, nor included in numargs).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //prints all arguments to screen, one by one&lt;br /&gt;
  //see the other comments for an explanation&lt;br /&gt;
  &lt;br /&gt;
  print = [                                    //declares an alias named print&lt;br /&gt;
    loop i $numargs [                          //loops $numargs times, setting i to the current iteration&lt;br /&gt;
      echo (getalias (concatword arg (+ $i 1)) //gets the value of the arguments, by accessing $arg1 $arg2 $arg3....&lt;br /&gt;
    ]                                          //close loop&lt;br /&gt;
  ]                                            //close print alias&lt;br /&gt;
  print I like unicorns                        //should print I like unicorns on 3 separate lines&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===push and pop===&lt;br /&gt;
&lt;br /&gt;
Push and pop used to be two separate instructions, but since the advent of the new Cubescrpt interpreter/compiler (2.6.1), they have been merged into a single instruction. The syntax for this singular stack manipulation command is as follows.&lt;br /&gt;
&lt;br /&gt;
push variable value body&lt;br /&gt;
&lt;br /&gt;
The stack is automatically popped after execution&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;candy&amp;quot;&lt;br /&gt;
  push myalias &amp;quot;lollipops&amp;quot; [&lt;br /&gt;
    echo $myalias&lt;br /&gt;
  ]&lt;br /&gt;
  echo $myalias&lt;br /&gt;
  &lt;br /&gt;
  //expected output&lt;br /&gt;
  //lollipops&lt;br /&gt;
  //candy&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&lt;br /&gt;
Cubescript is not your typical scripting language. Cubescript is not the most flexible, or the best language, but it more than adequate for our needs and purposes. Cubescript draws its main inspiration from quakescript and from Lisp. It is therefor said that Cubescript contains many &amp;quot;Lispisms&amp;quot;. Below is a summary of notable features/quirks.&lt;br /&gt;
&lt;br /&gt;
* comments are denoted by //&lt;br /&gt;
* both newlines and ; denote the end of a call.&lt;br /&gt;
* newlines will automatically close of any strings you may have forgotten to. (you should not rely on this)&lt;br /&gt;
* substitutions are done through the use of $ and @ tokens, (See below)&lt;br /&gt;
* everything is a function which may take arguments. With the exception of setting an alias, infix notation does not exist&lt;br /&gt;
* there are no arrays or vectors, only lists.&lt;br /&gt;
* most implementations have a 25 word limit. This means commands can be invoked with up to 24 arguments&lt;br /&gt;
&lt;br /&gt;
one liner example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias hi [say &amp;quot;hi&amp;quot;; sleep 5000 [say &amp;quot;Hi again&amp;quot;]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
multi liner example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias hi [&lt;br /&gt;
    say &amp;quot;hi&amp;quot;&lt;br /&gt;
    sleep 5000 [&lt;br /&gt;
      say &amp;quot;Hi again&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
it&amp;#039;s obvious what the above code does, it&amp;#039;ll make your character say hi, and wait 5 seconds before saying hi again.&lt;br /&gt;
&lt;br /&gt;
indenting is done in levels, the Tabulator (TAB) key is usually used to indent the text. while not necessary, it tends to make it bigger, and more legible as seen in the above example (when you get to big stuff, you&amp;#039;ll thank yourself for indenting it.&lt;br /&gt;
&lt;br /&gt;
As a rule of thumb, pretty much only [ increases the indentation level. Also note, &amp;quot;, ] and ) can close each other, so make sure you close them off properly&lt;br /&gt;
&lt;br /&gt;
==containers==&lt;br /&gt;
&lt;br /&gt;
Containers in cubescript are of 3 specific types, &amp;quot;&amp;quot;, () and [] - all of these have significant differences in operation and use&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;&amp;quot; container===&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&amp;quot; containers are used to store things EXACTLY as they are written, with a few small exceptions - in-text commands which are denoted by a preceding ^. They are as follows&lt;br /&gt;
&lt;br /&gt;
* ^f#&lt;br /&gt;
** ^f# is used to colour text. # must be replaced by either a number or a capital letter (A-Z). r and s are special control characters which will restore and save the text&amp;#039;s current colour respectively. &lt;br /&gt;
* ^n&lt;br /&gt;
** insert a &amp;#039;\n&amp;#039; character (newline/linefeed)&lt;br /&gt;
* ^t&lt;br /&gt;
** inserts a &amp;#039;\t&amp;#039; character (tabulator)&lt;br /&gt;
* ^&amp;quot;&lt;br /&gt;
** inserts a quote (&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
===() container===&lt;br /&gt;
&lt;br /&gt;
() containers are used mainly for logic/arithmetic operations. They are usually nested inside [] blocks, and unless they are nested inside []&amp;#039;s they&amp;#039;re permanently substituted with their results.&lt;br /&gt;
&lt;br /&gt;
For example - the following will turn into an infinite loop. The condition is initially evaluated and substituted with one and since 1 can never = 0, it&amp;#039;s true forever more&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  i = 0&lt;br /&gt;
  while (= $i 0) [i = (+ $i 1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the following code on the otherhand is devoid of such issues. Being nested inside the [] means it&amp;#039;s not substituted and evaluated each cycle&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  i = 0&lt;br /&gt;
  while [= $i 0] [i = (+ $i 1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===[] container===&lt;br /&gt;
&lt;br /&gt;
This container is used for nesting, deferring execution of it&amp;#039;s contents, deferring calculations and substitutions of () containers, and substitutions of aliases/variables written with a @ prefix (note several levels are needed to achieve this). [] containers are also the ONLY container capable of spanning multiple lines.&lt;br /&gt;
&lt;br /&gt;
This is the most used container and due to it&amp;#039;s properties, is ideal for creating aliases.&lt;br /&gt;
&lt;br /&gt;
generally statements in cubescript can&amp;#039;t span multiple lines. If you should use this container and occupy several, the execution of the prior command continues exactly where this container finished off. This can be demonstrated with an if statement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  if 1 [&lt;br /&gt;
    do&lt;br /&gt;
    stuff&lt;br /&gt;
  ] [&lt;br /&gt;
    do&lt;br /&gt;
    other&lt;br /&gt;
    stuff&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==substitution==&lt;br /&gt;
&lt;br /&gt;
there are two principle ways of substituting values in cubescript, the first is through the use of $ tokens, the second is through the use of @ tokens.&lt;br /&gt;
&lt;br /&gt;
a very simple example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = 5&lt;br /&gt;
  echo $myalias&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
myalias is substituted into the echo statement, so you should see 5 printed to the top-left of the screen&lt;br /&gt;
&lt;br /&gt;
using the @ token would have also resulted in the same behaviour&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = 5&lt;br /&gt;
  echo @myalias&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There&amp;#039;s a big difference between the two, the @ token can be used to concatenate stuff together, $ can&amp;#039;t. @ is also substituted immediately up to the first level of nesting. (this can be incremented by using additional @ tokens, ie @@ for 2 levels of nesting). Do take note that too few @ tokens may cause a substitution to happen too late, and too many may likewise cause it to happen too early.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;An example of use in a level 1 nest&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;I am awesome&amp;quot;&lt;br /&gt;
  mymenu = [guitext @myalias]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
if you were to type /echo $mymenu, it should read: guitext &amp;quot;I am awesome&amp;quot;; using the $ token on the other hand&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias = &amp;quot;I am awesome&amp;quot;&lt;br /&gt;
  mymenu = [guitext $myalias]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
typing /echo $mymenu should produce: guitext $myalias&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;An example of concatenation&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
as i mentioned, @ also allows you to concatenate stuff together, which could result in shorter and simpler scripts. It should be noted that this can also result in extreme obfuscation&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias0 = 5&lt;br /&gt;
  myalias1 = 3.1415&lt;br /&gt;
  myalias2 = 2.481&lt;br /&gt;
  &lt;br /&gt;
  loop i 3 [ do [&lt;br /&gt;
    echo $myalias@i&lt;br /&gt;
  ]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
this should print 5, 3.1415 and 2.481 respectively&lt;br /&gt;
&lt;br /&gt;
the purely $ token equivalent&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias0 = 5&lt;br /&gt;
  myalias1 = 3.1415&lt;br /&gt;
  myalias2 = 2.481&lt;br /&gt;
  &lt;br /&gt;
  loop i 3 [&lt;br /&gt;
    echo (getalias (concatword myalias $i))&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Lookup of a Lookup&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are two ways to look up multiple things; the first is by encasing it inside &amp;#039;getalias&amp;#039;, the second involves using multiple lookup tokens. There is a caveat with the second method, while it works on more types, it&amp;#039;s only available in sandbox as of 2.6.1.&lt;br /&gt;
&lt;br /&gt;
All 3 of the below examples should print &amp;quot;victory!&amp;quot;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  alias1 = &amp;quot;alias2&amp;quot;&lt;br /&gt;
  alias2 = &amp;quot;alias3&amp;quot;&lt;br /&gt;
  alias3 = &amp;quot;victory!&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //the first method&lt;br /&gt;
  echo (getalias (getalias $alias1))&lt;br /&gt;
  &lt;br /&gt;
  //the second method; 2.6.1&lt;br /&gt;
  echo $$$alias1&lt;br /&gt;
  &lt;br /&gt;
  //to show compatibility with @&lt;br /&gt;
  do [&lt;br /&gt;
    echo $$@alias1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Branching/Decisions==&lt;br /&gt;
&lt;br /&gt;
Decisions are based on 6 key commands, &amp;#039;&amp;#039;&amp;#039;if&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;cond&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;case&amp;#039;&amp;#039;&amp;#039; (integer), &amp;#039;&amp;#039;&amp;#039;casef&amp;#039;&amp;#039;&amp;#039; (float) and &amp;#039;&amp;#039;&amp;#039;cases&amp;#039;&amp;#039;&amp;#039; (string). There are also other ways to do this. For example you might be able to easily query something about an object, where it&amp;#039;s obviously unique. You would then execute an alias whose name has this unique bit attached onto the end. This is an advanced method and is generally not recommended. &lt;br /&gt;
&lt;br /&gt;
===if and ?===&lt;br /&gt;
&lt;br /&gt;
Arguments: Cond True False&lt;br /&gt;
&lt;br /&gt;
Unlike most other languages, cubescript&amp;#039;s &amp;#039;&amp;#039;&amp;#039;if&amp;#039;&amp;#039;&amp;#039; contains an implicit else, in short we do not have an else statement. The provided condition is true if it ends up as a series of alpha numerics, or in the case of a number, as a value other than 0. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  myalias1 = 5&lt;br /&gt;
  myalias2 = &amp;quot;woot&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //if else-if else&lt;br /&gt;
  if $myalias1 [&lt;br /&gt;
    echo &amp;quot;myalias1 is true&amp;quot;&lt;br /&gt;
  ] [&lt;br /&gt;
    //this shows the alpha numerics case&lt;br /&gt;
    if $myalias2 [&lt;br /&gt;
      echo &amp;quot;myalias1 is false and myalias2 is true&amp;quot;&lt;br /&gt;
    ] [&lt;br /&gt;
      echo &amp;quot;myalias1 is false and myalias2 is false&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039; acts exactly the same way, but there&amp;#039;s one HUGE difference. &amp;#039;&amp;#039;&amp;#039;?&amp;#039;&amp;#039;&amp;#039; does not execute the chosen result.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //an example of where ? can be used where if would fail&lt;br /&gt;
  items = 1&lt;br /&gt;
  echo (format &amp;quot;You are carrying %1 item%2.&amp;quot; $items (? (= $items 1) &amp;quot;&amp;quot; &amp;quot;s&amp;quot;))&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===cond===&lt;br /&gt;
&lt;br /&gt;
basically you provided a several pairs of arguments, the first half of the pair is the condition, and the second is the result. To put it in a programming perspective, this is like creating a long line of if else&amp;#039;s together. Execution stops when the first condition is matched. Should you place several conditions where more than one may be true at any one time, only the first will be executed. &lt;br /&gt;
&lt;br /&gt;
The following example assumes you have a light entity selected&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  lightstrength = [&lt;br /&gt;
    cond [&amp;lt; (ea 0) 0] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s like a black hole!&amp;quot;&lt;br /&gt;
    ] [= (ea 0) 0] [&lt;br /&gt;
      echo &amp;quot;Blindlier than science!&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 8] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s weaker than Billy&amp;#039;s night light!&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 32] [&lt;br /&gt;
      echo &amp;quot;Nice night light you got there&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 96] [&lt;br /&gt;
      echo &amp;quot;It&amp;#039;s like a lamp, but it&amp;#039;s not a lamp&amp;quot;&lt;br /&gt;
    ] [&amp;lt; (ea 0) 512] [&lt;br /&gt;
      echo &amp;quot;By Jove! I can actually see the ground!&amp;quot;&lt;br /&gt;
    ] [&amp;gt;= (ea 0) 512] [&lt;br /&gt;
      echo &amp;quot;Dark places are icky, don&amp;#039;t you agree?&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===case===&lt;br /&gt;
&lt;br /&gt;
This works similar to switches in most programming languages. The biggest difference is that you can&amp;#039;t break out, nor evaluate multiple cases (aka, fallthroughs).&lt;br /&gt;
&lt;br /&gt;
The first argument tells it which variable to use. The following arguments are given in pairs, the first half is the state, the second is the result.&lt;br /&gt;
If the state is a null type, it is considered the default case. The easiest way to generate a null type is to use ()&lt;br /&gt;
&lt;br /&gt;
The following example requires a particles entity to be selected, it will print out what type it is. Do note that this example exceeds the 25 word limit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  parttype = [&lt;br /&gt;
    pname = &amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
    case (ea 0) 0 [&lt;br /&gt;
      pname = &amp;quot;Fire and Smoke&amp;quot;&lt;br /&gt;
    ] 1 [&lt;br /&gt;
      pname = &amp;quot;Fire&amp;quot;&lt;br /&gt;
    ] 2 [&lt;br /&gt;
      pname = &amp;quot;Smoke Plume&amp;quot;&lt;br /&gt;
    ] 3 [&lt;br /&gt;
      pname = &amp;quot;Smoke&amp;quot;&lt;br /&gt;
    ] 4 [&lt;br /&gt;
      pname = &amp;quot;Fountain&amp;quot;&lt;br /&gt;
    ] 5 [&lt;br /&gt;
      pname = &amp;quot;Explosion&amp;quot;&lt;br /&gt;
    ] 6 [&lt;br /&gt;
      pname = &amp;quot;Meter&amp;quot;&lt;br /&gt;
    ] 7 [&lt;br /&gt;
      pname = &amp;quot;Vs Meter&amp;quot;&lt;br /&gt;
    ] 8 [&lt;br /&gt;
      pname = &amp;quot;Text&amp;quot;&lt;br /&gt;
    ] 9 [&lt;br /&gt;
      pname = &amp;quot;Flare&amp;quot;&lt;br /&gt;
    ] 10 [&lt;br /&gt;
      pname = &amp;quot;Lightning&amp;quot;&lt;br /&gt;
    ] 11 [&lt;br /&gt;
      pname = &amp;quot;Fire&amp;quot;&lt;br /&gt;
    ] 12 [&lt;br /&gt;
      pname = &amp;quot;Smoke&amp;quot;&lt;br /&gt;
    ] 13 [&lt;br /&gt;
      pname = &amp;quot;Water&amp;quot;&lt;br /&gt;
    ] 14 [&lt;br /&gt;
      pname = &amp;quot;Snow&amp;quot;&lt;br /&gt;
    ] 15 [&lt;br /&gt;
      pname = &amp;quot;Leaves&amp;quot;&lt;br /&gt;
    ] 32 [&lt;br /&gt;
      pname = &amp;quot;Lens Flare&amp;quot;&lt;br /&gt;
    ] 33 [&lt;br /&gt;
      pname = &amp;quot;Fixed Size Lens Flare&amp;quot;&lt;br /&gt;
    ] 34 [&lt;br /&gt;
      pname = &amp;quot;Sparkly Lens Flare&amp;quot;&lt;br /&gt;
    ] 35 [&lt;br /&gt;
      pname = &amp;quot;Sparkly Fixed Size Lens Flare&amp;quot;&lt;br /&gt;
    ] () [ //default&lt;br /&gt;
      pname = &amp;quot;A very pretty albeit unsupported particle&amp;quot;&lt;br /&gt;
    ]&lt;br /&gt;
  &lt;br /&gt;
    echo The particle you have selected is of type: $pname&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Naming===&lt;br /&gt;
&lt;br /&gt;
another way of doing decisions/branches is to use paths with different names. This has limited usage though. in short it requires you to query some information to concatenate onto another word, which you would then execute. There are exceptions. Other than the number of results you can query, there is no limit here. A handy trick is to have several results execute the same alias, though this requires that they differ only slightly at most in operation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //This example demonstrates the exception&lt;br /&gt;
  //it requires you to have an entity selected&lt;br /&gt;
  //This will conflict with showquickgui&lt;br /&gt;
  newgui &amp;quot;particles&amp;quot; [guitext &amp;quot;It&amp;#039;s like a random series of nothing&amp;quot;]&lt;br /&gt;
  newgui &amp;quot;light&amp;quot; [guitext &amp;quot;SHINY!!!!&amp;quot;]&lt;br /&gt;
  newgui &amp;quot;jumppad&amp;quot; [guitext &amp;quot;boing!&amp;quot;]&lt;br /&gt;
  &lt;br /&gt;
  identify = [showgui (et)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //shows a more standard example, at present this is exclusively used by edithud (see stdedit.cfg)&lt;br /&gt;
  //this also requires you to have an entity selected.&lt;br /&gt;
  identlight = [echo &amp;quot;it&amp;#039;s so bright...&amp;quot;]&lt;br /&gt;
  identdynlight = [identlight] // to demonstrate how different results can execute the same script&lt;br /&gt;
  identjumppad = [echo &amp;quot;boing? boing!&amp;quot;]&lt;br /&gt;
  identparticles = [echo &amp;quot;Please don&amp;#039;t change it to a lens flare!&amp;quot;]&lt;br /&gt;
  &lt;br /&gt;
  identify = [ if (enthavesel) [ident@(et)] [echo Select an entity first!]]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Lists==&lt;br /&gt;
&lt;br /&gt;
Ordered lists are the closest cubescript has to the likes of arrays. Their declaration is identical to any alias, as they are simply items in a string separated by white space. Using [] is recommended as the container of choice, since it allows you to use &amp;quot;&amp;quot; to include multi-word items in a list as a single unit as well as define the list over multiple lines. &amp;quot;&amp;quot; can also be used to define lists. An example can be inspected below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //declares 2 equivalent lists of 3 elements&lt;br /&gt;
  mylist1 = [one two &amp;quot;three four&amp;quot;]&lt;br /&gt;
  mylist2 = &amp;quot;one two ^&amp;quot;three four^&amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //prints the 3rd element&lt;br /&gt;
  echo (at $mylist 2)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;loops&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are at least 2 ways to loop through a list. The first method involves the use of looplist to iterate over it and the second the use of listlen to determine the list&amp;#039;s length. The difference between using looplist and listlen is that you will not have a reliable way of determining an element&amp;#039;s index and won&amp;#039;t have to manually fetch the element from the list. Basically looplist is faster at the cost of some information and should be used in all cases where the index does not need to be known.&lt;br /&gt;
An example can be inspected below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [&lt;br /&gt;
    0&lt;br /&gt;
    1&lt;br /&gt;
    3.14159265359&lt;br /&gt;
    2.71828182845&lt;br /&gt;
    sqrt(-1)&lt;br /&gt;
    1 //to demonstrate that the index cannot be determined reliably with looplist&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //demonstrates looplist&lt;br /&gt;
  looplist var $mylist [&lt;br /&gt;
    echo number (listfind item $mylist [strcmp $var $item]) : $var&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //demonstrates a loop + listlen combo&lt;br /&gt;
  loop i (listlen $mylist) [&lt;br /&gt;
    echo number $i : (at $mylist $i)&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;concatenation&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Concatenation is pretty simple, albeit not very efficient. It is basically, setting the list to itself plus the additional item. This is of course best achieved through the concat commands.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [1 2 3 4 5 6 7 8 9 10]&lt;br /&gt;
  &lt;br /&gt;
  //using concatword&lt;br /&gt;
  mylist = (concatword $mylist &amp;quot; &amp;quot; 11)&lt;br /&gt;
  &lt;br /&gt;
  //using format&lt;br /&gt;
  mylist = (format &amp;quot;%1 %2&amp;quot; $mylist 12)&lt;br /&gt;
  &lt;br /&gt;
  //using concat - we&amp;#039;re also preparing it for pretty list&lt;br /&gt;
  mylist = (concat $mylist 14)&lt;br /&gt;
  &lt;br /&gt;
  //pretty list does add an item onto the list, but it changes the format dramatically and the new item is placed before the end&lt;br /&gt;
  //it is ideal more so for making things pretty for presentation than concatenation&lt;br /&gt;
  mylist = (prettylist $mylist 13)&lt;br /&gt;
  &lt;br /&gt;
  //should print 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 14&lt;br /&gt;
  echo mylist is $mylist&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
concat returns everything given to it as a singular item, spaces and all. Concatword ignores spaces and &amp;quot;&amp;quot;&amp;#039;s must be explicitly provided. Concat is therefor ideal to add lists together. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist1 = [1 2 3 4 5]&lt;br /&gt;
  mylist2 = [6 7 8 9 10]&lt;br /&gt;
  mylist3 = [11 12 13 14 15]&lt;br /&gt;
  mylist4 = [16 17 18 19 20]&lt;br /&gt;
  mylist5 = [21 22 23 24 25]&lt;br /&gt;
  mylist6 = [26 27 28 29 30]&lt;br /&gt;
  finallist = &amp;quot;&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  //how concatword merged three lists&lt;br /&gt;
  finallist = (concatword $mylist1 &amp;quot; &amp;quot; $mylist2 &amp;quot; &amp;quot; $mylist3)&lt;br /&gt;
  &lt;br /&gt;
  //concat unlike the above does not require&lt;br /&gt;
  finallist = (concat $finallist $mylist4 $mylist5 $mylist6)&lt;br /&gt;
  &lt;br /&gt;
  echo (prettylist $finallist)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;finding&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
there are two ways to find things, the first is to use listfind, and the second is to loop through the list. Both are demonstrated in the example below&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  mylist = [&lt;br /&gt;
    &amp;quot;Jack&amp;quot;&lt;br /&gt;
    &amp;quot;Jane&amp;quot;&lt;br /&gt;
    &amp;quot;Joseph&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //This is an example of looking for a single element, note that this variant of...&lt;br /&gt;
  //strcmp unlike its C counterpart returns 1 when strings are equal&lt;br /&gt;
  //in this example, a 0 should be printed at the top of your screen - listfind returns the index&lt;br /&gt;
  echo (listfind f $mylist [strcmp $f &amp;quot;Jack&amp;quot;])&lt;br /&gt;
  &lt;br /&gt;
  //In this example, -1, as Jill is not in the list&lt;br /&gt;
  echo (listfind f $mylist [strcmp $f &amp;quot;Jill&amp;quot;])&lt;br /&gt;
  &lt;br /&gt;
  //in this example, we want to find anything which contains an e and add it into a list&lt;br /&gt;
  results = &amp;quot;&amp;quot;&lt;br /&gt;
  looplist var $mylist [&lt;br /&gt;
    if (&amp;gt;= (strstr $var &amp;quot;e&amp;quot;) 0) [&lt;br /&gt;
      results = (concatword $results &amp;quot;^&amp;quot;&amp;quot; $var &amp;quot; ^&amp;quot;&amp;quot;)&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  //this should print: Jane Joseph&lt;br /&gt;
  echo $results&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=List of commands=&lt;br /&gt;
&lt;br /&gt;
==General==&lt;br /&gt;
&lt;br /&gt;
The following commands are quite often used in a lot of scripts. &lt;br /&gt;
&lt;br /&gt;
* alias N B&lt;br /&gt;
** creates an alias named N with body B, the intext version is denoted as N = B (equivalent to alias N B)&lt;br /&gt;
* at S I&lt;br /&gt;
** returns the Ith element in string S, note that counting starts from 0. If it&amp;#039;s out of range, &amp;quot;&amp;quot; is returned&lt;br /&gt;
* getalias A&lt;br /&gt;
** returns the value of A. this also does not produce a warning should an alias be undeclared, nor complains when fetching built in variables.&lt;br /&gt;
* if C T F (F is optional)&lt;br /&gt;
** if condition C is true, execute T, otherwise F is executed &lt;br /&gt;
* listlen S&lt;br /&gt;
** returns the amount of elements in list S&lt;br /&gt;
* loop V N B&lt;br /&gt;
** loops N times, and aliases the current iteration to V; B is executed every iteration.&lt;br /&gt;
* result S&lt;br /&gt;
** returns the string, useful when aliases need to be executed&lt;br /&gt;
* rnd N L&lt;br /&gt;
** chooses a random number between 0 and N-1 (inclusive). L sets the lower limit. eg rnd 12 7 will return either 7 8 9 10 or 11&lt;br /&gt;
* sleep N B&lt;br /&gt;
** executes B after a delay of N milliseconds. NOTE: even if N is &amp;lt;= 0, it&amp;#039;ll still wait till the next frame before executing it&lt;br /&gt;
* while C B&lt;br /&gt;
** executed B while C is true. NOTE: surround C in a [] container, or you risk an infinite loop due to the condition not being reevaluated.&lt;br /&gt;
&lt;br /&gt;
==Map Configuration==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;ONLY APPLIES TO FPSGAME&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The following commands are useful in level only aliases&lt;br /&gt;
&lt;br /&gt;
*triggerstate&lt;br /&gt;
*level_trigger&lt;br /&gt;
**level trigger is invoked as level_trigger_1 = [] as an example, the end number is the 4th number in the mapmodel&amp;#039;s strings&lt;br /&gt;
*level_base&lt;br /&gt;
**Used to give bases names in capture mode. This is unfortunately unused in PAS&lt;br /&gt;
&lt;br /&gt;
==Binds==&lt;br /&gt;
&lt;br /&gt;
The following commands are useful in binds.&lt;br /&gt;
&lt;br /&gt;
*onrelease&lt;br /&gt;
&lt;br /&gt;
==Gui Creation==&lt;br /&gt;
&lt;br /&gt;
For newui, please see [[new menu editing]]&lt;br /&gt;
&lt;br /&gt;
These commands are used to create various menus.&lt;br /&gt;
&lt;br /&gt;
* cleargui&lt;br /&gt;
* guibar&lt;br /&gt;
* guibutton&lt;br /&gt;
* guicheckbox&lt;br /&gt;
* guifield&lt;br /&gt;
* guikeyfield&lt;br /&gt;
* guiimage&lt;br /&gt;
* guilist&lt;br /&gt;
* guirolloveraction&lt;br /&gt;
* guirollovername&lt;br /&gt;
* guislider&lt;br /&gt;
* guilistslider&lt;br /&gt;
* guinameslider&lt;br /&gt;
* guistayopen&lt;br /&gt;
* guitab&lt;br /&gt;
* guitext&lt;br /&gt;
* guititle&lt;br /&gt;
* guistrut&lt;br /&gt;
* newgui&lt;br /&gt;
&lt;br /&gt;
==Comparisons==&lt;br /&gt;
&lt;br /&gt;
The functions here can change the values, or return a logical comparison&lt;br /&gt;
for all intents and purposes, the C version of booleans apply here; values not equal to 0 are true - and functions that return true return 1&lt;br /&gt;
&lt;br /&gt;
===Integer Arithmetic===&lt;br /&gt;
&lt;br /&gt;
* + A B&lt;br /&gt;
** returns the value of the numbers added together&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns the result of multiplying A and B&lt;br /&gt;
* - A B&lt;br /&gt;
** returns the value of A - B&lt;br /&gt;
* = A B&lt;br /&gt;
** returns true of the two are equal&lt;br /&gt;
* != A B&lt;br /&gt;
** returns true if the two aren&amp;#039;t equal&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than-or-equal-to B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than-or-equal-to B&lt;br /&gt;
* ! A&lt;br /&gt;
** if the argument is false, it returns true&lt;br /&gt;
* &amp;amp;&amp;amp;&lt;br /&gt;
** returns true if all arguments are true&lt;br /&gt;
* ||&lt;br /&gt;
** returns true it at least one argument is true&lt;br /&gt;
* div A B&lt;br /&gt;
** returns the value of A divided by B&lt;br /&gt;
* mod A B&lt;br /&gt;
** returns the modulus of the two arguments&lt;br /&gt;
* min&lt;br /&gt;
** returns the lowest valued argument of all provided arguments&lt;br /&gt;
* max&lt;br /&gt;
** returns the highest valued argument of all provided arguments&lt;br /&gt;
&lt;br /&gt;
===Bitwise Integer Operations===&lt;br /&gt;
&lt;br /&gt;
* ^ A B&lt;br /&gt;
** returns the value of A xor B ie (^ 8 4) is 12 - (^ 12 4) is 8&lt;br /&gt;
* &amp;amp; A B&lt;br /&gt;
** returns the value of the bits both A and B have&lt;br /&gt;
* | A B&lt;br /&gt;
** returns the value of the bits either A or B have&lt;br /&gt;
* ~ A&lt;br /&gt;
** returns the inverted bitwise version of A ie (&amp;amp; (~ 128) 255) is 127&lt;br /&gt;
* ^~ A B&lt;br /&gt;
** xor;s the arguments after applying an inversion on B&lt;br /&gt;
* &amp;amp;~ A B&lt;br /&gt;
** and&amp;#039;s the arguments after applying an inversion on B&lt;br /&gt;
* |~ A B&lt;br /&gt;
** or&amp;#039;s the arguments after applying an inversion on B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;&amp;lt;/nowiki&amp;gt; A N&lt;br /&gt;
** shifts A N bits&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; A N&lt;br /&gt;
** shifts A -N bits&lt;br /&gt;
&lt;br /&gt;
===Floating Point Arithmetic===&lt;br /&gt;
&lt;br /&gt;
Generally these just have an -f suffix&lt;br /&gt;
&lt;br /&gt;
* +f A B&lt;br /&gt;
** returns the value of the numbers added together&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;*f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns the result of multiplying A and B&lt;br /&gt;
* -f A B&lt;br /&gt;
** returns the value of A - B&lt;br /&gt;
* =f A B&lt;br /&gt;
** returns true of the two are equal&lt;br /&gt;
* !=f A B&lt;br /&gt;
** returns true if the two aren&amp;#039;t equal&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is less-than-or-equal-to B&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=f&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if A is greater-than-or-equal-to B&lt;br /&gt;
* divf A B&lt;br /&gt;
** returns the value of A divided by B&lt;br /&gt;
* modf A B&lt;br /&gt;
** returns the modulus of the two arguments&lt;br /&gt;
* minf&lt;br /&gt;
** returns the lowest valued argument of all provided arguments&lt;br /&gt;
* maxf&lt;br /&gt;
** returns the highest valued argument of all provided arguments&lt;br /&gt;
&lt;br /&gt;
===Strings===&lt;br /&gt;
&lt;br /&gt;
* =s A B&lt;br /&gt;
** returns 1 if the string matches, 0 otherwise&lt;br /&gt;
* !=s A B&lt;br /&gt;
** returns 0 if the string matches, 1 otherwise&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns less-than 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns greater-than 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;lt;=s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns less-than-or-equal-to 0&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;&amp;gt;=s&amp;lt;/nowiki&amp;gt; A B&lt;br /&gt;
** returns true if the C strcmp returns greater-than-or-equal-to 0&lt;br /&gt;
* strcmp A B&lt;br /&gt;
** returns 1 if the string matches, 0 otherwise (unlike the C version with returns the disparity)&lt;br /&gt;
* strstr H N&lt;br /&gt;
** returns the position of N in H - otherwise -1 is returned&lt;br /&gt;
* strlen S&lt;br /&gt;
** returns the length of the string&lt;br /&gt;
* strreplace S O N&lt;br /&gt;
** replaces all instances of O inside string S with N&lt;br /&gt;
&lt;br /&gt;
==String/text formatting==&lt;br /&gt;
&lt;br /&gt;
These commands are used to format aliases which are normally huge bits of text&lt;br /&gt;
&lt;br /&gt;
* concat C&lt;br /&gt;
** everything you type after will be returned; with expressions and substitutions performed&lt;br /&gt;
* concatword C&lt;br /&gt;
** the next 25 arguments will be executed and subsequently concatenated without any spaces between them&lt;br /&gt;
* format F S1 S2 S3 S4 S5 S6 S7 S8 S9&lt;br /&gt;
** F is a string containing %# tokens, format substitutes the arguments with their respective %# tokens (ie: S5 will replace %5)&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
&lt;br /&gt;
*[[map_config|Map Configuration]]&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1520</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1520"/>
				<updated>2011-11-16T12:31:20Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Extras */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;I&amp;#039;m a windows&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If windows is your operating system of choice, do yourself a huge favour and at the very least configure windows to display file extensions such as .cfg. This will save you a fair bit of pain&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need to spawn this in the back of the dedicated room in the dungeon. After that is done, we only need to edit 2 more files, first up, open up variables,cfg.&lt;br /&gt;
&lt;br /&gt;
You use this file to store variables and values you want to persist across sessions. So you want to use these to record the various choices the player has made, the things he has done and the status of all kinds of things in the world.&lt;br /&gt;
&lt;br /&gt;
append this onto the end of variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 bobmcguffin = (r_global_new 0) //bob&amp;#039;s quest to retrieve the mcguffin, 1 - have quest 2 - finished quest&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now only have Bob&amp;#039;s dialogue left to go. We will provide different responses for the various states as well as set any variables that need be and remove any inventory items that need be.&lt;br /&gt;
&lt;br /&gt;
We will need to change a fair bit of his script, So without further ado, open up his script and replace the dialogue with the following.&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
   r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
   case (r_global_get $bobmcguffin) 0 [&lt;br /&gt;
     r_response &amp;quot;Do you have any work for me?&amp;quot; 2&lt;br /&gt;
   ] 1 [&lt;br /&gt;
     if (r_get_amount player 7) [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 4&lt;br /&gt;
     ] [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 6&lt;br /&gt;
     ]&lt;br /&gt;
   ] 2 [&lt;br /&gt;
     r_response &amp;quot;Do you have any more work for me?&amp;quot; 7&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I need someone to go into the cave to the North-West of this valley and retrieve the mcGuffin, can you do that for me?&amp;quot; [ //2&lt;br /&gt;
   r_response &amp;quot;You can count on me!&amp;quot; 3 [ r_global_set $bobmcguffin 1 ]&lt;br /&gt;
   r_response &amp;quot;Maybe some other time&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Great! I&amp;#039;ll be waiting for your return&amp;quot; [ //3&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you for finding it, but I don&amp;#039;t have a reward for you but I&amp;#039;d till very much like the mcGuffin.&amp;quot; [ //4&lt;br /&gt;
   r_response &amp;quot;[Give him the mcGuffin]&amp;quot; 5 [&lt;br /&gt;
     r_remove player 7 1&lt;br /&gt;
     r_givexp player 900&lt;br /&gt;
     r_global_set $bobmcguffin 2&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;I think I&amp;#039;ll hold onto it for now&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you very much, I will never forget this&amp;quot; [ // 5&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Where is it?&amp;quot; [ //6&lt;br /&gt;
   r_response &amp;quot;I must&amp;#039;ve forgotten it in the cave...&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;No, but once again, thank you for getting this for me&amp;quot; [ //7&lt;br /&gt;
   r_response &amp;quot;Farewell&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congrats, you&amp;#039;ve made your first FedEx quest. I hope you&amp;#039;re ashamed of yourself and will take this moment to reflect on your actions and produce quests with multiple paths and solutions that aren&amp;#039;t simply get X of Y or kill X of Y ;)&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global Variable Tips&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are saved with your game and remain in a constant order and are all defined inside variables.cfg and they can only be integers. r_global_new returns the variable&amp;#039;s index (ie, the first will return 0) and you should alias these return values to an easy to remember name that is short and as descriptive as possible. If you need to list more detailed information, do so in comments either before or on the same line.&lt;br /&gt;
&lt;br /&gt;
You will want to increase the game/compat versions when you move/remove/add anything in here, serious breakage can occur&lt;br /&gt;
&lt;br /&gt;
You should keep the names short and easy to type, for example, if we have a quest where you find a someone named Jane a bunch of apples, JaneApples and ApplesForJane would be some of the better names.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Journal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There is no journal at present but there will be in the future, you will want to record rumours, quest notes, deeds, obituaries and all kinds of other things in there. What you can do for now is make a book where the player can access all this information via dialogue.&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic logic puzzle to open a door.&lt;br /&gt;
&lt;br /&gt;
We will create a 10 digit number pad of sorts, the player would need to interact with in a specific order to remove an obstacle we will place in the second area.&lt;br /&gt;
&lt;br /&gt;
Our first order of business will be to define the variables we&amp;#039;ll need to pull this off, we&amp;#039;ll need two for the method we&amp;#039;ll be using.&lt;br /&gt;
&lt;br /&gt;
variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 keyprogress = (r_global_new 0)&lt;br /&gt;
 keytest = (r_global_new -1)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we&amp;#039;ll define the button&amp;#039;s scripts. The scripts will set the keytest variable and will then call the &amp;quot;testkey&amp;quot; signal on the current map and propagate it to the door. We will define the door a bit later.&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 0&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
14.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 1&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
15.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 2&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
16.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 3&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
17.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 4&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
18.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 5&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
19.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 6&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
20.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 7&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
21.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 8&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
22.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 9&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you thought that wasn&amp;#039;t boring enough, we now define the buttons themselves with similarly minor alterations, these should occupy slots 3 to 12 in the triggers directory, feel free to use a more appropriate model if you have one available.&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;0 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 13&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;1 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;2 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 15&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;3 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 16&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;4 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 17&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;5 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 18&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;6 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 19&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;7 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 20&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;8 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;9 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 22&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will not get to the fun part! defining the actual door itself (hooray!). Like in every other instance, we will define the script first. The door&amp;#039;s script will be as follows, it need to test and increment the global variables we&amp;#039;ve defined earlier.&lt;br /&gt;
&lt;br /&gt;
23.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 key = [ 3 1 3 3 7 ] //change as appropriate&lt;br /&gt;
 keylen = (listlen $key)&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal testkey [&lt;br /&gt;
   if (&amp;lt; (r_global_get $keyprogress) @keylen) [&lt;br /&gt;
     if (= (at [@@@key] (r_global_get $keyprogress)) (r_global_get $keytest) [&lt;br /&gt;
       r_global_set $keyprogress (+ (r_global_get $keyprogress) 1)&lt;br /&gt;
     ] [&lt;br /&gt;
       r_global_set $keyprogress 0&lt;br /&gt;
     ]&lt;br /&gt;
     if (= (r_global_get $keyprogress) @@keylen) [&lt;br /&gt;
       r_trigger self&lt;br /&gt;
     ]&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now make the trigger itself, like with the last step, choose a model of appropriate size to block the passage to the mcGuffin&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Heavy door&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_script 23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;a guiding hand&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Depending on the puzzle and its difficulty, you should strive to give the player a few hints to solve it. You should avoid giving the player the answer but you should give the player some audio or visual feedback based on his actions.&lt;br /&gt;
&lt;br /&gt;
Take our above puzzle for example, we have no idea if the combination we have entered is even correct apart from the door opening after interacting with the triggers. In addition, trying every 5 digit combo to get the example combination can take as many as 100000 attempts.&lt;br /&gt;
&lt;br /&gt;
For a puzzle like that, it is unreasonable to just expect the player to figure out the answer himself without a few hints. Short of giving the player the answer, we could perhaps tell him the digits but in a wrong order, or perhaps give him a mnemonic he has to decipher to get the answer.&lt;br /&gt;
&lt;br /&gt;
=Extras=&lt;br /&gt;
&lt;br /&gt;
* [http://www.sendspace.com/file/cu341n Finished product] - Note, sandbox 2.7.1 or newer is required&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Development&amp;diff=1519</id>
		<title>Development</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Development&amp;diff=1519"/>
				<updated>2011-11-16T12:02:22Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Important Revisions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We&amp;#039;ve no intention of releasing development, or testing versions. alas we have a stable development repository available. Using it is not meant for the faint of heart, we (by that I mean Hirato) may occasionally break something.&lt;br /&gt;
&lt;br /&gt;
Obtaining development versions is useful for testing, and it allows users (like yourself) to test out that latest and greatest of the feature set.&lt;br /&gt;
&lt;br /&gt;
On a side note, we use SVN for our development repository needs.&lt;br /&gt;
&lt;br /&gt;
and for those in search of the Eisenstern derived, &amp;quot;Master Chef Ogro&amp;quot; RPG, simply substitute&amp;lt;br&amp;gt;&lt;br /&gt;
http://www.svn.kids.platinumarts.net/32pas32/trunk/&amp;lt;br&amp;gt;&lt;br /&gt;
for&amp;lt;br&amp;gt;&lt;br /&gt;
http://svnrpg.kids.platinumarts.net/kidsrpg&lt;br /&gt;
&lt;br /&gt;
=Main Windows SVN How To=&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Using Tortoise SVN&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
One of the easiest and most popular ways of using SVN on Windows is through the program Tortoise SVN here [http://tortoisesvn.net/downloads]  The top link under Windows 32 is what most people want to get.  After installing Tortoisesvn, create a folder and call it PAS.  Right click on the folder and select SVN Checkout.  Under where it says URL enter:&lt;br /&gt;
&lt;br /&gt;
Main Version http://www.svn.kids.platinumarts.net/32pas32/trunk/ &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Under where it says checkout directory enter where you put the PAS folder.  You can click on those three dots to navigate to it.  After that hit okay and you should start downloading Sandbox to the PAS folder.  Once you&amp;#039;ve finished you&amp;#039;ll need to compile the source code to get fully up to date, please see our [[Compiling_the_source_code]] instructions for that.  To update right click the PAS folder and select update.  If you delete a file by accident you can just select update to restore it :)&lt;br /&gt;
&lt;br /&gt;
=Main POSIX system SVN How To=&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Using the trusty old, Command Line&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The first step would be to obtain an SVN client, in any popular Linux distribution this can be found in the &amp;quot;subversion&amp;quot; package, OS X users should find a copy bundled with the xcode family of tools for their system.&lt;br /&gt;
&lt;br /&gt;
Now simply fire up a terminal window, we recommend executing the following command in your home directory or a dedicated directory.&lt;br /&gt;
feel free to substitute sandbox with an alternative destination.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  svn co http://www.svn.kids.platinumarts.net/32pas32/trunk sandbox&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;d like to checkout the other branches as well (currently only sandboxlite) execute the following command instead&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  svn co http://www.svn.kids.platinumarts.net/32pas32 sandbox&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the following are some common and useful commands you should get used to if you&amp;#039;re planning to use the SVN, for all of them you may pass --help for further details&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  svn update # updates to the latest version available on the repository&lt;br /&gt;
  svn revert --recursive # reverts any changes you&amp;#039;ve made to your checkout&lt;br /&gt;
  svn diff -r BASE &amp;gt; mypatch.diff # generates a patch from your changes to the SVN you can send to us&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Gui Interfaces=&lt;br /&gt;
&lt;br /&gt;
A well designed GUI can ease the effort that may other wise be required to commit changes, access the repository, do diff (differences between two versions of a file, also called a patch). GUIs also take a bit of time getting used to, as they often have different and confusing ways of defining a repository and checking it out&lt;br /&gt;
&lt;br /&gt;
==kdesvn==&lt;br /&gt;
[[image:kdesvn.png|left|thumb|200px|A screenshot of the context menus in KDE 3.5]]&lt;br /&gt;
[[image:kdesvn1.png|right|thumb|200px|A screenshot of the checkout dailogue in KDE 3.5]]&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Konqueror&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
A KDE svn client, integrates with konqueror to allow easy manipulation of svn directories via right click context menus and possibly other methods.&lt;br /&gt;
&lt;br /&gt;
to use kdesvn (our way), install it and launch konqueror. type ~ into the location bar.&lt;br /&gt;
&lt;br /&gt;
now, create a new folder named &amp;#039;sandbox&amp;#039; or &amp;#039;pas&amp;#039; or whatever.&lt;br /&gt;
&lt;br /&gt;
enter the directory then right click or right click the directory, and then hover your cursor over &amp;#039;actions&amp;#039;, then &amp;#039;Subversion&amp;#039;, kdesvn should be in suffixing brackets. click &amp;#039;checkout from a repository&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
make sure the destination directory is as you want it. Enter http://www.svn.kids.platinumarts.net/32pas32/trunk/ into the &amp;#039;Enter URL&amp;#039; field. Make sure that HEAD is selected of the below options, and that is recurses directories. Untick &amp;#039;append source url name to folder&amp;#039; as I already made you create a valid directory&lt;br /&gt;
&lt;br /&gt;
congrats, once it fetches about 80 MB, you have the latest dev of sandbox. just periodically right click the folder, and follow the context menus to update it. you can also do diffs, revert your changes and review logs through the simple to use context menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Stand alone GUI&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
using the Standalone GUI is simple and easy, simply start it up (ALT-F2, and enter kdesvn into the box that appears), click on &amp;#039;Subversion&amp;#039; at the top bar, hover it over &amp;#039;General&amp;#039;, and then click, &amp;#039;Checkout a Repository&amp;#039;. Alternatively you can click the button 3rd from the right in the bar, it should have the tooltip, &amp;#039;Checkout a Repository&amp;#039;&lt;br /&gt;
&lt;br /&gt;
in the window that appears, click the folder icon and select a directory to check it into, the &amp;#039;append source url name to folder&amp;#039; is optional, depending on where you chose. somewhere in your home folder (~) is recommended. once again, enter http://www.svn.kids.platinumarts.net/32pas32/trunk/ into the URL field.&lt;br /&gt;
&lt;br /&gt;
and you&amp;#039;re done. note, you may wish to tick the &amp;#039;load last opened url on start&amp;#039; in the &amp;#039;settings&amp;#039; area of the main gui.&lt;br /&gt;
&lt;br /&gt;
==Rapid SVN==&lt;br /&gt;
&lt;br /&gt;
Works on both Linux and Windows.  Not quite as easy to use as the SVN programs that integrate with the browsers but it is another alternative.&lt;br /&gt;
&lt;br /&gt;
==eSvn==&lt;br /&gt;
&lt;br /&gt;
===Checking out the repo===&lt;br /&gt;
&lt;br /&gt;
===What else is there to do===&lt;br /&gt;
&lt;br /&gt;
===File Mapping===&lt;br /&gt;
&lt;br /&gt;
=Important Revisions=&lt;br /&gt;
This is mostly for people who want to get &amp;#039;release&amp;#039; versions from the repos.&lt;br /&gt;
*3359 - Final 2.7.1 package&lt;br /&gt;
*3253 - Final 2.7.0 build&lt;br /&gt;
*2774 - Final 2.6.1 build&lt;br /&gt;
*2655 - Final 2.6.0 build&lt;br /&gt;
*1523 - Final 2.5.0 build&lt;br /&gt;
*1165 - Final 2.4.0rc1 build&lt;br /&gt;
*760 - Final 2.3.0 Release build&lt;br /&gt;
*446 - Final 2.2.0 release&lt;br /&gt;
*441 - 2.2.0 fileplanet release&lt;br /&gt;
*~200 - 2.1.0 release (sorry there were a few problems that make it difficult to be more accurate)&lt;br /&gt;
*89 - 2.0.0 release&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_todo&amp;diff=1514</id>
		<title>RPG todo</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_todo&amp;diff=1514"/>
				<updated>2011-11-05T09:51:58Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Script */ I-i-implemented!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Gameplay=&lt;br /&gt;
* hotkeys&lt;br /&gt;
* special item properties&lt;br /&gt;
** money (constant value for all purposes)&lt;br /&gt;
** cursed status&lt;br /&gt;
** unidentified status&lt;br /&gt;
*** hide true power or make it a lot less useful?&lt;br /&gt;
* (maybe?) character generation&lt;br /&gt;
* looting and trading... hardcode references &amp;quot;loot&amp;quot; and &amp;quot;trade&amp;quot;?&lt;br /&gt;
* sneaking/stealth&lt;br /&gt;
** light and visibility&lt;br /&gt;
** silhouettes and light levels?&lt;br /&gt;
** stealing&lt;br /&gt;
* proper friendly fire protection&lt;br /&gt;
** 0 - no protection (default)&lt;br /&gt;
** 1 - prevents you from hurting yourself&lt;br /&gt;
** 2 - 1 + prevents you from hurting allies&lt;br /&gt;
** 3 - allows injury to hostile characters only&lt;br /&gt;
* spell types&lt;br /&gt;
** movement (paralysis counters)&lt;br /&gt;
** vocal (silence counters)&lt;br /&gt;
&lt;br /&gt;
=Logic=&lt;br /&gt;
* the consume use case for books and potions.&lt;br /&gt;
* statusgroups on items&lt;br /&gt;
** temporary spells that alters the properties of the weapon&lt;br /&gt;
** multiple at once with different targets.&lt;br /&gt;
* temporary spell effects for wielded items, &lt;br /&gt;
** multiple status effects on a single use, separate chargeflags, multiplier, duration and element.&lt;br /&gt;
** make sure to use each for the right purpose&lt;br /&gt;
* Projectiles&lt;br /&gt;
** improve ricochet, gravity related stuff is funky&lt;br /&gt;
* target types&lt;br /&gt;
** cone&lt;br /&gt;
** self-area/multi&lt;br /&gt;
* status types&lt;br /&gt;
** dispel - should work on individual effects&lt;br /&gt;
** silence&lt;br /&gt;
** paralysis/stun&lt;br /&gt;
* Expose a tonne of constants to Cubescript for configuration at the game maker&amp;#039;s discretion. These include leveling and power curves&lt;br /&gt;
* arbitrary trigger bounding box scales&lt;br /&gt;
&lt;br /&gt;
=GUI=&lt;br /&gt;
* inventory&lt;br /&gt;
** item examination&lt;br /&gt;
* status effects&lt;br /&gt;
* trade &lt;br /&gt;
* stats&lt;br /&gt;
* crafting&lt;br /&gt;
* journal&lt;br /&gt;
* newui variants&lt;br /&gt;
&lt;br /&gt;
=Recipes=&lt;br /&gt;
* (maybe) allow in game apparatuses to act as a catalyst&lt;br /&gt;
** (maybe) several catalysts and ingredients list? or just duplicate and alter the recipe?&lt;br /&gt;
&lt;br /&gt;
=AI=&lt;br /&gt;
* queued prioritised actions&lt;br /&gt;
** most important done first&lt;br /&gt;
** multitasking&lt;br /&gt;
* waypoints&lt;br /&gt;
** randomness&lt;br /&gt;
** state - don&amp;#039;t favour waypoints which are in use&lt;br /&gt;
* ai tags&lt;br /&gt;
** identify purpose and effect of entities in game world for the AI (parsing the script for these is simply not practical)&lt;br /&gt;
*** alternatively use simpler more specific types, such as &amp;quot;door&amp;quot;, &amp;quot;container&amp;quot;, &amp;quot;portal&amp;quot; and &amp;quot;mover&amp;quot; as opposed to a singular &amp;quot;object&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Cutscenes=&lt;br /&gt;
* create a cutscene variant which can&amp;#039;t be skippped (maybe)&lt;br /&gt;
* some sort of skipping bar (1000 ms?) to prevent accidental skips&lt;br /&gt;
&lt;br /&gt;
=Renderer=&lt;br /&gt;
* particles for active spell effects&lt;br /&gt;
* render attachments/equipment&lt;br /&gt;
* animations for weapons&lt;br /&gt;
** generic animations, unarmed strike, melee strike, bow shoot, gun shoot, etc&lt;br /&gt;
&lt;br /&gt;
=Journal=&lt;br /&gt;
* quests&lt;br /&gt;
* log entries&lt;br /&gt;
* sorting and filters&lt;br /&gt;
&lt;br /&gt;
=Sound=&lt;br /&gt;
* sounds while charging spells&lt;br /&gt;
* sounds for projectile firing, travel and death&lt;br /&gt;
* sounds for active statusgroups&lt;br /&gt;
* (maybe) voiced dialogue&lt;br /&gt;
&lt;br /&gt;
=I/O=&lt;br /&gt;
* flat file export of current script/data definitions (maybe)&lt;br /&gt;
** couple with ingame menus for realtime modification (maybe)&lt;br /&gt;
* better range checks and protection&lt;br /&gt;
* save and restore AI directives&lt;br /&gt;
&lt;br /&gt;
=Particles=&lt;br /&gt;
* set particle effects for entity afflicted status effects&lt;br /&gt;
* vary spawned amount of particles depending on distance (few when close, full amount when far away)&lt;br /&gt;
* explicit variable for setting waypoint drawing distance&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1513</id>
		<title>Platinum Arts Sandbox Free 3D Game Maker:Community Portal</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1513"/>
				<updated>2011-11-01T03:32:11Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: Reverted edits by HughLacasse (Talk) to last revision by Hirato&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Possible upcoming events.  Please contact us if you are interested!&lt;br /&gt;
&lt;br /&gt;
* Kid friendly RPG&lt;br /&gt;
* Water Waters - DM type game with water guns and water balloon bazookas!&lt;br /&gt;
* Kart mode into an actual racing game.&lt;br /&gt;
Also Sandbox is being used in more and more schools!  The goal is to try to get Sandbox into as many schools as we can, and the more schools and kids using it the better!  Any help that you can give us is much appreciated!&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Packaging_guide&amp;diff=1498</id>
		<title>Packaging guide</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Packaging_guide&amp;diff=1498"/>
				<updated>2011-10-30T09:03:25Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* invalid substitutes for &amp;quot;map&amp;quot; */  tweaks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is mostly a set of guidelines for people packaging up their maps for redistribution among peers in the sandbox community&lt;br /&gt;
&lt;br /&gt;
it&amp;#039;s important to note that if you intend to distribute more than the ogz itself, that you&amp;#039;re to use zip archives, or tar archives with either bzip or gzip compression. (non-windows platforms support this natively, for windows, use 7zip)&lt;br /&gt;
&lt;br /&gt;
rar archives are not to be used, simply for cross platform concerns (linux supports it poorly, and OSX I believe doesn&amp;#039;t support it at all)&lt;br /&gt;
&lt;br /&gt;
=What to include in the zip=&lt;br /&gt;
&lt;br /&gt;
==the basic zip structure==&lt;br /&gt;
[] indicates a folder, - the level.&lt;br /&gt;
&lt;br /&gt;
* [packages]&lt;br /&gt;
*  - [base]&lt;br /&gt;
*  -  - map.ogz&lt;br /&gt;
*  -  - map.cfg&lt;br /&gt;
*  -  - map-art.cfg&lt;br /&gt;
*  -  - map.jpg&lt;br /&gt;
*  -  - map_big.jpg&lt;br /&gt;
&lt;br /&gt;
if it&amp;#039;s just a map, feel free to omit the base and package directories form the hierarchy.&lt;br /&gt;
&lt;br /&gt;
note that other users do NOT want to pick through you archive to extract everything, so the first folder should always be packages, not the second!&amp;lt;br&amp;gt;&lt;br /&gt;
it&amp;#039;s less painful that way, and allows some operating systems to add the files, instead of overwriting the whole packages directory.&lt;br /&gt;
&lt;br /&gt;
==invalid substitutes for &amp;quot;map&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
When one names his map, there&amp;#039;s a few things you can&amp;#039;t do, you&amp;#039;re not allowed to name the map as to...&lt;br /&gt;
&lt;br /&gt;
* contains any brackets (this is includes braces and square brackets)&lt;br /&gt;
* contain any punctuation (the only exception is the fullstop signaling the file extension)&lt;br /&gt;
* contain greater than or less than signs, the engine WILL ignore them&lt;br /&gt;
&lt;br /&gt;
Normal social standards also apply, expletives are not to be present in map names and ridicule directed at anyone isn&amp;#039;t to be in the name.&lt;br /&gt;
&lt;br /&gt;
==taking the map.jpg screenshots==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note: png, bmp and tga are also allowed, but not recommended (the engine will identify the extension automatically)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
map.jpg&lt;br /&gt;
# go into windowed mode and resize the window to 512x512 or 1024x1024&lt;br /&gt;
# press Ctrl-F12 to take the screenshot&lt;br /&gt;
# open the screenshot in the gimp or photoshop and resize it to either 512x512 or 256x256 and save it into packages/base, whilst substituting map for the map&amp;#039;s name (note that resolutions that are not 2^n (where n is an integer) display oddly, and mapshots above 512^512 won&amp;#039;t be accepted)&lt;br /&gt;
## you might like to play with /fov to try a different/better view for the screenshot&lt;br /&gt;
&lt;br /&gt;
map_big.jpg&lt;br /&gt;
# use your standard resolution in sandbox, such as 1024x768 (1280x960 or above is suggested, note that if the map&amp;#039;s included in sandbox, it won&amp;#039;t be allowed past 1280x960)&lt;br /&gt;
## NOTE: 2.3.3 and later (development versions), scale the images based on size, so feel free to use 16:9, anything older requires you to use 4:3.&lt;br /&gt;
# ctrl-F12 to take a screenshot&lt;br /&gt;
# open the screenshot in the gimp or photoshop and save it to packages/base as map_big.jpg, whilst substituting map for the map&amp;#039;s name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Custom art==&lt;br /&gt;
&lt;br /&gt;
custom art created by you is to be placed in either 1 or more of the following 3 directories&lt;br /&gt;
&lt;br /&gt;
* [packages]&lt;br /&gt;
* - [my_name]&lt;br /&gt;
* - [models]&lt;br /&gt;
* - - [my_name] &lt;br /&gt;
* - [sounds]&lt;br /&gt;
* - - [my_name]&lt;br /&gt;
&lt;br /&gt;
packages/my_name is to be used for textures, music, and other graphical data&amp;lt;br&amp;gt;&lt;br /&gt;
packages/models/my_name is to be used for hosting models, and any relevant skins, which aren&amp;#039;t going to be used as regular textures&amp;lt;br&amp;gt;&lt;br /&gt;
packages/sounds/my_name is to be used for any custom SFX you wish to add&lt;br /&gt;
&lt;br /&gt;
the above assumes of course, you&amp;#039;re including your art, while including the art of another, you can either but them in a sub directory with THEIR alias, or keep them with your files.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;big&amp;gt;just don&amp;#039;t forget to give proper attribution within the readmes&amp;lt;/big&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Packaging_guide&amp;diff=1497</id>
		<title>Packaging guide</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Packaging_guide&amp;diff=1497"/>
				<updated>2011-10-30T09:00:32Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: let&amp;#039;s not encourage use of the rar format ;)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is mostly a set of guidelines for people packaging up their maps for redistribution among peers in the sandbox community&lt;br /&gt;
&lt;br /&gt;
it&amp;#039;s important to note that if you intend to distribute more than the ogz itself, that you&amp;#039;re to use zip archives, or tar archives with either bzip or gzip compression. (non-windows platforms support this natively, for windows, use 7zip)&lt;br /&gt;
&lt;br /&gt;
rar archives are not to be used, simply for cross platform concerns (linux supports it poorly, and OSX I believe doesn&amp;#039;t support it at all)&lt;br /&gt;
&lt;br /&gt;
=What to include in the zip=&lt;br /&gt;
&lt;br /&gt;
==the basic zip structure==&lt;br /&gt;
[] indicates a folder, - the level.&lt;br /&gt;
&lt;br /&gt;
* [packages]&lt;br /&gt;
*  - [base]&lt;br /&gt;
*  -  - map.ogz&lt;br /&gt;
*  -  - map.cfg&lt;br /&gt;
*  -  - map-art.cfg&lt;br /&gt;
*  -  - map.jpg&lt;br /&gt;
*  -  - map_big.jpg&lt;br /&gt;
&lt;br /&gt;
if it&amp;#039;s just a map, feel free to omit the base and package directories form the hierarchy.&lt;br /&gt;
&lt;br /&gt;
note that other users do NOT want to pick through you archive to extract everything, so the first folder should always be packages, not the second!&amp;lt;br&amp;gt;&lt;br /&gt;
it&amp;#039;s less painful that way, and allows some operating systems to add the files, instead of overwriting the whole packages directory.&lt;br /&gt;
&lt;br /&gt;
==invalid substitutes for &amp;quot;map&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
When one names his map, there&amp;#039;s a few things you can&amp;#039;t do, you&amp;#039;re not allowed to name the map as to...&lt;br /&gt;
&lt;br /&gt;
* contains any brackets (this is includes braces and square brackets)&lt;br /&gt;
* contain any punctuation (the only exception is the fullstop signaling the file extension)&lt;br /&gt;
* contain greater than or less than signs, the engine WILL ignore them&lt;br /&gt;
* contain forward or back slashes&lt;br /&gt;
&lt;br /&gt;
just for social standards, mapnames aren&amp;#039;t allowed to&lt;br /&gt;
* contain any form of prejudice against a group of people&lt;br /&gt;
* contain any &amp;quot;swear&amp;quot; words&lt;br /&gt;
&lt;br /&gt;
==taking the map.jpg screenshots==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note: png, bmp and tga are also allowed, but not recommended (the engine will identify the extension automatically)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
map.jpg&lt;br /&gt;
# go into windowed mode and resize the window to 512x512 or 1024x1024&lt;br /&gt;
# press Ctrl-F12 to take the screenshot&lt;br /&gt;
# open the screenshot in the gimp or photoshop and resize it to either 512x512 or 256x256 and save it into packages/base, whilst substituting map for the map&amp;#039;s name (note that resolutions that are not 2^n (where n is an integer) display oddly, and mapshots above 512^512 won&amp;#039;t be accepted)&lt;br /&gt;
## you might like to play with /fov to try a different/better view for the screenshot&lt;br /&gt;
&lt;br /&gt;
map_big.jpg&lt;br /&gt;
# use your standard resolution in sandbox, such as 1024x768 (1280x960 or above is suggested, note that if the map&amp;#039;s included in sandbox, it won&amp;#039;t be allowed past 1280x960)&lt;br /&gt;
## NOTE: 2.3.3 and later (development versions), scale the images based on size, so feel free to use 16:9, anything older requires you to use 4:3.&lt;br /&gt;
# ctrl-F12 to take a screenshot&lt;br /&gt;
# open the screenshot in the gimp or photoshop and save it to packages/base as map_big.jpg, whilst substituting map for the map&amp;#039;s name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Custom art==&lt;br /&gt;
&lt;br /&gt;
custom art created by you is to be placed in either 1 or more of the following 3 directories&lt;br /&gt;
&lt;br /&gt;
* [packages]&lt;br /&gt;
* - [my_name]&lt;br /&gt;
* - [models]&lt;br /&gt;
* - - [my_name] &lt;br /&gt;
* - [sounds]&lt;br /&gt;
* - - [my_name]&lt;br /&gt;
&lt;br /&gt;
packages/my_name is to be used for textures, music, and other graphical data&amp;lt;br&amp;gt;&lt;br /&gt;
packages/models/my_name is to be used for hosting models, and any relevant skins, which aren&amp;#039;t going to be used as regular textures&amp;lt;br&amp;gt;&lt;br /&gt;
packages/sounds/my_name is to be used for any custom SFX you wish to add&lt;br /&gt;
&lt;br /&gt;
the above assumes of course, you&amp;#039;re including your art, while including the art of another, you can either but them in a sub directory with THEIR alias, or keep them with your files.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;big&amp;gt;just don&amp;#039;t forget to give proper attribution within the readmes&amp;lt;/big&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1494</id>
		<title>Platinum Arts Sandbox Free 3D Game Maker:Community Portal</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1494"/>
				<updated>2011-10-25T05:22:05Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: Reverted edits by IsabelleBarry (Talk) to last revision by Hirato&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Possible upcoming events.  Please contact us if you are interested!&lt;br /&gt;
&lt;br /&gt;
* Kid friendly RPG&lt;br /&gt;
* Water Waters - DM type game with water guns and water balloon bazookas!&lt;br /&gt;
* Kart mode into an actual racing game.&lt;br /&gt;
Also Sandbox is being used in more and more schools!  The goal is to try to get Sandbox into as many schools as we can, and the more schools and kids using it the better!  Any help that you can give us is much appreciated!&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1492</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1492"/>
				<updated>2011-10-20T02:10:01Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;I&amp;#039;m a windows&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If windows is your operating system of choice, do yourself a huge favour and at the very least configure windows to display file extensions such as .cfg. This will save you a fair bit of pain&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need to spawn this in the back of the dedicated room in the dungeon. After that is done, we only need to edit 2 more files, first up, open up variables,cfg.&lt;br /&gt;
&lt;br /&gt;
You use this file to store variables and values you want to persist across sessions. So you want to use these to record the various choices the player has made, the things he has done and the status of all kinds of things in the world.&lt;br /&gt;
&lt;br /&gt;
append this onto the end of variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 bobmcguffin = (r_global_new 0) //bob&amp;#039;s quest to retrieve the mcguffin, 1 - have quest 2 - finished quest&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now only have Bob&amp;#039;s dialogue left to go. We will provide different responses for the various states as well as set any variables that need be and remove any inventory items that need be.&lt;br /&gt;
&lt;br /&gt;
We will need to change a fair bit of his script, So without further ado, open up his script and replace the dialogue with the following.&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
   r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
   case (r_global_get $bobmcguffin) 0 [&lt;br /&gt;
     r_response &amp;quot;Do you have any work for me?&amp;quot; 2&lt;br /&gt;
   ] 1 [&lt;br /&gt;
     if (r_get_amount player 7) [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 4&lt;br /&gt;
     ] [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 6&lt;br /&gt;
     ]&lt;br /&gt;
   ] 2 [&lt;br /&gt;
     r_response &amp;quot;Do you have any more work for me?&amp;quot; 7&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I need someone to go into the cave to the North-West of this valley and retrieve the mcGuffin, can you do that for me?&amp;quot; [ //2&lt;br /&gt;
   r_response &amp;quot;You can count on me!&amp;quot; 3 [ r_global_set $bobmcguffin 1 ]&lt;br /&gt;
   r_response &amp;quot;Maybe some other time&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Great! I&amp;#039;ll be waiting for your return&amp;quot; [ //3&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you for finding it, but I don&amp;#039;t have a reward for you but I&amp;#039;d till very much like the mcGuffin.&amp;quot; [ //4&lt;br /&gt;
   r_response &amp;quot;[Give him the mcGuffin]&amp;quot; 5 [&lt;br /&gt;
     r_remove player 7 1&lt;br /&gt;
     r_givexp player 900&lt;br /&gt;
     r_global_set $bobmcguffin 2&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;I think I&amp;#039;ll hold onto it for now&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you very much, I will never forget this&amp;quot; [ // 5&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Where is it?&amp;quot; [ //6&lt;br /&gt;
   r_response &amp;quot;I must&amp;#039;ve forgotten it in the cave...&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;No, but once again, thank you for getting this for me&amp;quot; [ //7&lt;br /&gt;
   r_response &amp;quot;Farewell&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congrats, you&amp;#039;ve made your first FedEx quest. I hope you&amp;#039;re ashamed of yourself and will take this moment to reflect on your actions and produce quests with multiple paths and solutions that aren&amp;#039;t simply get X of Y or kill X of Y ;)&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global Variable Tips&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are saved with your game and remain in a constant order and are all defined inside variables.cfg and they can only be integers. r_global_new returns the variable&amp;#039;s index (ie, the first will return 0) and you should alias these return values to an easy to remember name that is short and as descriptive as possible. If you need to list more detailed information, do so in comments either before or on the same line.&lt;br /&gt;
&lt;br /&gt;
You will want to increase the game/compat versions when you move/remove/add anything in here, serious breakage can occur&lt;br /&gt;
&lt;br /&gt;
You should keep the names short and easy to type, for example, if we have a quest where you find a someone named Jane a bunch of apples, JaneApples and ApplesForJane would be some of the better names.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Journal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There is no journal at present but there will be in the future, you will want to record rumours, quest notes, deeds, obituaries and all kinds of other things in there. What you can do for now is make a book where the player can access all this information via dialogue.&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic logic puzzle to open a door.&lt;br /&gt;
&lt;br /&gt;
We will create a 10 digit number pad of sorts, the player would need to interact with in a specific order to remove an obstacle we will place in the second area.&lt;br /&gt;
&lt;br /&gt;
Our first order of business will be to define the variables we&amp;#039;ll need to pull this off, we&amp;#039;ll need two for the method we&amp;#039;ll be using.&lt;br /&gt;
&lt;br /&gt;
variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 keyprogress = (r_global_new 0)&lt;br /&gt;
 keytest = (r_global_new -1)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we&amp;#039;ll define the button&amp;#039;s scripts. The scripts will set the keytest variable and will then call the &amp;quot;testkey&amp;quot; signal on the current map and propagate it to the door. We will define the door a bit later.&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 0&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
14.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 1&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
15.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 2&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
16.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 3&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
17.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 4&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
18.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 5&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
19.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 6&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
20.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 7&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
21.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 8&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
22.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 9&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you thought that wasn&amp;#039;t boring enough, we now define the buttons themselves with similarly minor alterations, these should occupy slots 3 to 12 in the triggers directory, feel free to use a more appropriate model if you have one available.&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;0 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 13&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;1 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;2 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 15&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;3 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 16&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;4 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 17&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;5 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 18&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;6 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 19&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;7 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 20&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;8 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;9 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 22&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will not get to the fun part! defining the actual door itself (hooray!). Like in every other instance, we will define the script first. The door&amp;#039;s script will be as follows, it need to test and increment the global variables we&amp;#039;ve defined earlier.&lt;br /&gt;
&lt;br /&gt;
23.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 key = [ 3 1 3 3 7 ] //change as appropriate&lt;br /&gt;
 keylen = (listlen $key)&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal testkey [&lt;br /&gt;
   if (&amp;lt; (r_global_get $keyprogress) @keylen) [&lt;br /&gt;
     if (= (at [@@@key] (r_global_get $keyprogress)) (r_global_get $keytest) [&lt;br /&gt;
       r_global_set $keyprogress (+ (r_global_get $keyprogress) 1)&lt;br /&gt;
     ] [&lt;br /&gt;
       r_global_set $keyprogress 0&lt;br /&gt;
     ]&lt;br /&gt;
     if (= (r_global_get $keyprogress) @@keylen) [&lt;br /&gt;
       r_trigger self&lt;br /&gt;
     ]&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now make the trigger itself, like with the last step, choose a model of appropriate size to block the passage to the mcGuffin&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Heavy door&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_script 23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;a guiding hand&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Depending on the puzzle and its difficulty, you should strive to give the player a few hints to solve it. You should avoid giving the player the answer but you should give the player some audio or visual feedback based on his actions.&lt;br /&gt;
&lt;br /&gt;
Take our above puzzle for example, we have no idea if the combination we have entered is even correct apart from the door opening after interacting with the triggers. In addition, trying every 5 digit combo to get the example combination can take as many as 100000 attempts.&lt;br /&gt;
&lt;br /&gt;
For a puzzle like that, it is unreasonable to just expect the player to figure out the answer himself without a few hints. Short of giving the player the answer, we could perhaps tell him the digits but in a wrong order, or perhaps give him a mnemonic he has to decipher to get the answer.&lt;br /&gt;
&lt;br /&gt;
=Extras=&lt;br /&gt;
&lt;br /&gt;
* [http://www.sendspace.com/file/cu341n Finished product] - Note, the maps require a version of sandbox newer than 2.7.0&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1491</id>
		<title>Platinum Arts Sandbox Free 3D Game Maker:Community Portal</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1491"/>
				<updated>2011-10-20T02:01:32Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Possible upcoming events.  Please contact us if you are interested!&lt;br /&gt;
&lt;br /&gt;
* Kid friendly RPG&lt;br /&gt;
* Water Waters - DM type game with water guns and water balloon bazookas!&lt;br /&gt;
* Kart mode into an actual racing game.&lt;br /&gt;
Also Sandbox is being used in more and more schools!  The goal is to try to get Sandbox into as many schools as we can, and the more schools and kids using it the better!  Any help that you can give us is much appreciated!&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Contact_The_Team&amp;diff=1490</id>
		<title>Contact The Team</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Contact_The_Team&amp;diff=1490"/>
				<updated>2011-10-20T01:58:37Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: Reverted edits by Markchristaen (Talk) to last revision by Hirato&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Interested in getting into contact with us?  Here are a few quick easy ways to do so :)&lt;br /&gt;
&lt;br /&gt;
== Developer Chatroom ==&lt;br /&gt;
&lt;br /&gt;
The easiest way of finding us is to join our developer chatroom.  &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;NOTE:  KIDS MUST HAVE PARENTAL PERMISSION TO JOIN AND WE CANNOT BE RESPONSIBLE FOR THINGS SAID IN THERE. ALSO WE ARE FREQUENTLY IDLE IN THE CHATROOM WORKING ON SANDBOX, IF YOU EXPECT A RESPONSE PLEASE WAIT&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You can simply [http://sandboxgamemaker.com/irc/irc.html click here] or if you already have an irc client it is [irc://irc.oftc.net/sandbox irc.OFTC.net #Sandbox]  In addition you can try our new [http://widget.mibbit.com/?settings=ca48890d9db5ad90e8d98c1d1d3ce14b&amp;amp;server=irc.oftc.net&amp;amp;channel=%23sandbox&amp;amp;noServerTab=false&amp;amp;autoConnect=true mibbit link].&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to use your webbrowser to connect to the chatroom, and instead want to use a standalone program, then you can use Xchat at http://silverex.org  This is the free version of xchat, as the main version of xchat has a 30 day trial.&amp;lt;br&amp;gt;&lt;br /&gt;
Instructions: &amp;lt;br&amp;gt;&lt;br /&gt;
1)In the xchat menu to go the network list &amp;lt;br&amp;gt;&lt;br /&gt;
2)Find OFTC or add irc.OFTC.net then select edit &amp;lt;br&amp;gt;&lt;br /&gt;
3) In favorite channels add #sandbox and &lt;br /&gt;
set it to autoconnect &amp;lt;br&amp;gt;&lt;br /&gt;
4) With OFTC still highlighted, hit connect and join us :D &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Forums ==&lt;br /&gt;
&lt;br /&gt;
Obviously we check this on a regular basis so feel free to post there. http://forum.sandboxgamemaker.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== E-mail ==&lt;br /&gt;
&lt;br /&gt;
You &lt;br /&gt;
can contact us at PlatinumArts@gmail.com  PLEASE NO TECHNICAL SUPPORT QUESTIONS.  PLACE TECHNICAL SUPPORT QUESTIONS IN THE FORUM OR CHATROOM&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1489</id>
		<title>Platinum Arts Sandbox Free 3D Game Maker:Community Portal</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Platinum_Arts_Sandbox_Free_3D_Game_Maker:Community_Portal&amp;diff=1489"/>
				<updated>2011-10-20T01:58:36Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: Reverted edits by MacyWales (Talk) to last revision by BradleyBriggs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Possible upcoming events.  Please contact us if you are interested!&lt;br /&gt;
&lt;br /&gt;
* Kid friendly RPG&lt;br /&gt;
* Water Waters - DM type game with water guns and water balloon bazookas!&lt;br /&gt;
* Kart mode into an actual racing game.&lt;br /&gt;
*&amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;[http://www.proposable.com &amp;lt;span style=&amp;quot;color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;&amp;quot;&amp;gt;proposal software&amp;lt;/span&amp;gt;]&lt;br /&gt;
Also Sandbox is being used in more and more schools!  The goal is to try to get Sandbox into as many schools as we can, and the more schools and kids using it the better!  Any help that you can give us is much appreciated!&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=Main_Page&amp;diff=1488</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=Main_Page&amp;diff=1488"/>
				<updated>2011-10-20T01:57:43Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Platinum Arts Sandbox Free 3D Game Maker&amp;#039;&amp;#039;&amp;#039; is a 3D game maker based on the Cube 2 engine that allows users to quickly and easily create and edit their own worlds in game, even cooperatively. It is free, open-source, and easy to use for Kids and Adults.  Sandbox logo by [http://sashazavisha.deviantart.com/art/young-creator-120946941 sashaZavisha].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:49%;float:left;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== General information ==&lt;br /&gt;
&lt;br /&gt;
* [[Platinum Arts Sandbox|About Platinum Arts Sandbox]]&lt;br /&gt;
* [http://SandboxGameMaker.com Project homepage]&lt;br /&gt;
* [[FAQ]]&lt;br /&gt;
* [[Contact The Team]]&lt;br /&gt;
* [[cmdline arguments|Command line Arguments]]&lt;br /&gt;
* [[packaging guide|The Packaging Guide]]&lt;br /&gt;
* [[server list|List Of Sandbox Servers]]&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
* [[Installing Platinum Arts Sandbox]]&lt;br /&gt;
* [[Compiling the source code]]&lt;br /&gt;
* [[package managers|Some Notes for package managers]]&lt;br /&gt;
&lt;br /&gt;
== Development ==&lt;br /&gt;
&lt;br /&gt;
* [[bug reports|Bug Reports]]&lt;br /&gt;
* [[Contributing]]&lt;br /&gt;
* [[development|Obtaining the development version]]&lt;br /&gt;
* [[Todo|To do list]]&lt;br /&gt;
* [[content request| Content Request - Help us out!!]]&lt;br /&gt;
&lt;br /&gt;
== Kid Friendly RPG ==&lt;br /&gt;
* [[Concept Document]]&lt;br /&gt;
* [[Brainstorming area]]&lt;br /&gt;
&lt;br /&gt;
== Master Chef Ogro 2 ==&lt;br /&gt;
* [[Brainstorming]]&lt;br /&gt;
&lt;br /&gt;
== Undercover Kids Game ==&lt;br /&gt;
* [[To Do List]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:49%;float:right;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
* [[Map Editing Basics]]&lt;br /&gt;
* [[Mapping Taboos]]&lt;br /&gt;
* [[Beginner&amp;#039;s video tutorials]]&lt;br /&gt;
* [[Good free programs for Sandbox]]&lt;br /&gt;
&lt;br /&gt;
== Advanced topics ==&lt;br /&gt;
&lt;br /&gt;
* [[Cooperative Editing]] (General Server set up)&lt;br /&gt;
* [[Cooperative Editing 2]] (Easier way using Hamachi)&lt;br /&gt;
* [[Adding Models to Sandbox]]&lt;br /&gt;
* [http://sandboxgamemaker.com/platinumartssandboxeditref.html Editing Reference Guide]&lt;br /&gt;
* [http://sauerbraten.org/docs/models.html Model Reference Guide]&lt;br /&gt;
* [[Configuration Reference Guide]]&lt;br /&gt;
* [[Cubescript]]&lt;br /&gt;
* [[Menu Editing]] ([[New menu editing|newui]])&lt;br /&gt;
* [[map_config|Map Configuration]]&lt;br /&gt;
&lt;br /&gt;
== Example Modules ==&lt;br /&gt;
&lt;br /&gt;
* [[FPS|FPS - First Person Shooter (default)]]&lt;br /&gt;
* [[RPG|RPG - Role Playing Game]]&lt;br /&gt;
* [[SSP|SSP - Side Scrolling Platformer]]&lt;br /&gt;
* [[MovieCube|MovieCube - Machinima Tool]]&lt;br /&gt;
* [[Vehicle Simulator]]&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
*[[Tutorials List | Text Tutorials List]]&lt;br /&gt;
*[[Video Tutorials List]]&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_script&amp;diff=1483</id>
		<title>RPG script</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_script&amp;diff=1483"/>
				<updated>2011-10-13T07:11:46Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=References=&lt;br /&gt;
References are stored separately of cube script and are defined as a stack of hashtables that can be arbitrarily incremented and decreased. The depth is typically 1 unless a script is executing or things are being run inside a r_stack block.&lt;br /&gt;
&lt;br /&gt;
References are the system that exposes a lot of functionality as well as providing a relatively fast and type-safe means for creators to script assorted interactions in their games.&lt;br /&gt;
&lt;br /&gt;
As a general rule, a reference must be defined (or registered) before it can be set or searched for. There are two ways to register a reference. The first is using &amp;#039;&amp;#039;&amp;#039;r_registerref&amp;#039;&amp;#039;&amp;#039; and the second using &amp;#039;&amp;#039;&amp;#039;r_registertemp&amp;#039;&amp;#039;&amp;#039;. Both behave exactly the same except for one difference, &amp;#039;&amp;#039;&amp;#039;r_registertemp&amp;#039;&amp;#039;&amp;#039; only searches the top level for a matching reference as opposed to the whole stack, otherwise they both create one at the top level if one isn&amp;#039;t found. Due to this behaviour, you can shadow variables quite easily and painlessly and allows us to use self and actor as reference for just about every script call.&lt;br /&gt;
&lt;br /&gt;
The references can reference just about anything in the RPG, the current official list is as follows. Note that volatile references are cleared at the start of every update due to the volatile nature of what they reference.&lt;br /&gt;
* Critters&lt;br /&gt;
* Items&lt;br /&gt;
* Obstacles&lt;br /&gt;
* Platforms&lt;br /&gt;
* Triggers&lt;br /&gt;
* Inventory&lt;br /&gt;
* Equipment (volatile)&lt;br /&gt;
* Map&lt;br /&gt;
* Victim Effect (volatile)&lt;br /&gt;
* Area Effect (volatile)&lt;br /&gt;
&lt;br /&gt;
In addition the following list should be considered reserved, you may use them for other purposes but we really do not recommend this for obvious reasons.&lt;br /&gt;
* player - the player&lt;br /&gt;
* curmap - the current map&lt;br /&gt;
* hover - the current hover target&lt;br /&gt;
* talker - who the player is currently talking to&lt;br /&gt;
* actor - generally something that sent a signal to the entity in the self reference&lt;br /&gt;
* self - something executing a script, typically due to to receiving a signal fro mactor&lt;br /&gt;
&lt;br /&gt;
=Signals=&lt;br /&gt;
&lt;br /&gt;
Nearly all scripts in the RPG are defined as a signal to either the script on the mapscript subtypes. The signals can have just about any name, there are several loosely reserved names the engine will call periodically but the creator has completely free reign on what he wants to name his signals and what he wants and when alongside those the game call.&lt;br /&gt;
&lt;br /&gt;
Signals are sent to everything by default unless a specific target is specified. Signals called periodically by the game are as follows&lt;br /&gt;
* update - sent to everything every update&lt;br /&gt;
* collide - sent to every pair of entities that collided in an update&lt;br /&gt;
* hit - sent when something is hit by another&amp;#039;s attack&lt;br /&gt;
* interact - typically sent when you press the E key while having a hover target&lt;br /&gt;
* death - sent to an entity when it does&lt;br /&gt;
* level - sent to an entity when it gains a level&lt;br /&gt;
* equip - send to the item when an entity equips it&lt;br /&gt;
* load - sent to the map when it&amp;#039;s initialised&lt;br /&gt;
* spawn - sent to an entity when it&amp;#039;s created&lt;br /&gt;
&lt;br /&gt;
This list is subject to change in the future&lt;br /&gt;
&lt;br /&gt;
=Context sensitive values=&lt;br /&gt;
&lt;br /&gt;
When some conditions are met or certain signals are sent, global variables are set for it to use.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;hit signal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
friendly - notes whether or not the attack was friendly&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;script/signal status effect&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
=Commands=&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_script&amp;diff=1482</id>
		<title>RPG script</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_script&amp;diff=1482"/>
				<updated>2011-10-13T05:46:50Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Loops */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;&amp;#039;&amp;#039;&amp;#039;WARNING:&amp;#039;&amp;#039;&amp;#039; Information here is incompatible with 2.6.1 and earlier&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=How things work=&lt;br /&gt;
&lt;br /&gt;
The system is stack based. Basically when scripts are executed the stack is pushed, the script executed and then popped. This allows the system/user to define additional lookups on the stack. There are two types of references, regular and temporary references, both serve different purposes, and the stack is searched in reverse for them.&lt;br /&gt;
&lt;br /&gt;
The only notable difference between them is how they&amp;#039;re set. Regular lookups search the whole stack for an existing reference to modify, temporary lookups only search the top of the stack for an existing instance and create one if it doesn&amp;#039;t exist. This effectively allows temporary references to ghost references in the lower stack; In other words with temporary references, you can have two references with the exact same name which point to two distinctly different things.&lt;br /&gt;
&lt;br /&gt;
Users cannot define temporary lookups. In addition most commands require references to function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_loop_maps ref [&lt;br /&gt;
   //ref here refers to the current map&lt;br /&gt;
   r_loop_ents ref ref [&lt;br /&gt;
     //ref here refers to the current entity, the map version is ghosted but not lost&lt;br /&gt;
     //now lets do something productive like killing everyone but the player&lt;br /&gt;
     if (! (r_matchref ref player)) [r_kill ref player]&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reserved lookups==&lt;br /&gt;
Since the RPG works with named lookups, there are several named you should never explicitly define or set. There&amp;#039;s no rule against doing so, but keep in mind very bad things may happen if you do. They are as follows. &lt;br /&gt;
&lt;br /&gt;
* player - a reference to the player&lt;br /&gt;
* hover - a reference to whatever the player&amp;#039;s cursor is hovering over (even nothing)&lt;br /&gt;
* curmap - a reference pointing to the current map&lt;br /&gt;
* talker - (dialogue) a reference to whoever is talking to the player&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following can be overwritten, but exercise due caution when doing so. They are defined when the RPG explicitly calls character, item and map scripts (albeit using temporary references).&lt;br /&gt;
&lt;br /&gt;
* self - in map or ent scripts, refers to the invokee&lt;br /&gt;
* actor - when scripts are executed, this refers to the entity who invoked them.&lt;br /&gt;
* item - during item scripts this refers to the selected item&lt;br /&gt;
&lt;br /&gt;
=Loops=&lt;br /&gt;
&lt;br /&gt;
There are 4 loops, each iterate over certain things, they are as follows&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Command:&amp;#039;&amp;#039;&amp;#039; r_loop_maps reference body&lt;br /&gt;
&lt;br /&gt;
Makes a temporary reference named &amp;#039;reference&amp;#039;, and has it reference each of the maps in turn on which it executes the body.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Command:&amp;#039;&amp;#039;&amp;#039; r_loop_ents map_reference reference body&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;map_reference:&amp;#039;&amp;#039;&amp;#039; must reference a map&lt;br /&gt;
&lt;br /&gt;
Makes a temporary reference named &amp;#039;reference&amp;#039;, and has it reference each of the entities that exist on the map pointed to by map_reference.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Command:&amp;#039;&amp;#039;&amp;#039; r_loop_aeffects map_reference ent_reference reference body&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;map_reference:&amp;#039;&amp;#039;&amp;#039; must reference a map&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;ent_reference:&amp;#039;&amp;#039;&amp;#039; must reference an entity if bounds checking is desired&lt;br /&gt;
&lt;br /&gt;
Makes a temporary volatile named reference that iterates over all area effects on the map_reference that afflicts ent_reference (if provided), loops over all area effects otherwise&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Command:&amp;#039;&amp;#039;&amp;#039; r_loop_inv ent_reference reference body&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;ent_reference:&amp;#039;&amp;#039;&amp;#039; must reference either a character (such as the player) or an object (such as a chest)&lt;br /&gt;
&lt;br /&gt;
Makes a temporary reference named &amp;#039;reference&amp;#039;, and has it reference each of the items that exist in the entity&amp;#039;s inventory&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Command:&amp;#039;&amp;#039;&amp;#039; r_loop_equip ent_reference reference body&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;ent_reference:&amp;#039;&amp;#039;&amp;#039; must reference a character&lt;br /&gt;
&lt;br /&gt;
Makes a temporary volatile reference named &amp;#039;reference&amp;#039;, and has it reference each of the items the entity has equipped. you sohuld avoid unequipping anything while doing this&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Command:&amp;#039;&amp;#039;&amp;#039; r_loop_veffects ent_reference reference body&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;ent_reference:&amp;#039;&amp;#039;&amp;#039; must reference an entity&lt;br /&gt;
&lt;br /&gt;
Makes a temporary volatile reference named &amp;#039;reference&amp;#039;, and has it reference each of the status effects that plagues the provided entity&lt;br /&gt;
&lt;br /&gt;
=Commands=&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_configuration&amp;diff=1481</id>
		<title>RPG configuration</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_configuration&amp;diff=1481"/>
				<updated>2011-10-13T05:34:28Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Containers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Intro=&lt;br /&gt;
The definitions are stored in a series of sub directories in your game&amp;#039;s directory. The directory itself will typically share the name of the definitions it contains, ie, one containing critter definitions will be called critters.&lt;br /&gt;
&lt;br /&gt;
The game&amp;#039;s directory itself will share its name with a .cfg file placed along side it, this CFG file allows the RPG module to ascertain the game&amp;#039;s presence and subsequently load it, as well as define other properties. There is a base directory included to help you set things up.&lt;br /&gt;
&lt;br /&gt;
If you require help in setting things up, please consult the first part of the [[RPG_tutorial tutorial]].&lt;br /&gt;
&lt;br /&gt;
=Game configuration=&lt;br /&gt;
&lt;br /&gt;
the cfg that lives along the game&amp;#039;s directory defines several very important things. It associates maps with scripts and mapflags, defines the first map and all sorts of other properties as well as the game&amp;#039;s HUD.&lt;br /&gt;
&lt;br /&gt;
Currently not implemented is the means to adjust the stat gradients.&lt;br /&gt;
&lt;br /&gt;
Available variables at present are&lt;br /&gt;
* firstmap - the first map that is loaded if one isn&amp;#039;t specified&lt;br /&gt;
* gameversion - game version&lt;br /&gt;
* compatversion - oldest game version the game is compatible with (for patches)&lt;br /&gt;
&lt;br /&gt;
Available commands are&lt;br /&gt;
* r_preparemap map script flags&lt;br /&gt;
&lt;br /&gt;
=Notes and tips=&lt;br /&gt;
&lt;br /&gt;
Firstly slots, each and every single slot has a companion command with a _get (usually takes no arguments) suffix that will return its value.&lt;br /&gt;
&lt;br /&gt;
Secondly, you are going to be modifying the definitions quite a lot and perhaps even tweak them a lot in a very short space of time, there&amp;#039;s a command named &amp;#039;&amp;#039;&amp;#039;r_rehash&amp;#039;&amp;#039;&amp;#039; available to facilitate your testing. Make sure to save your map and game before using it.&lt;br /&gt;
&lt;br /&gt;
Thirdly, if you are going to duplicate definitions for the purpose of making derivatives, use the &amp;#039;&amp;#039;&amp;#039;include&amp;#039;&amp;#039;&amp;#039; command to execute that definition. Include is executed relative to your game&amp;#039;s directory eg. include scripts/1 will execute data/rpg/games/mygame/scripts/1.cfg&lt;br /&gt;
&lt;br /&gt;
=Scripts=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Particle Effects=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Status groups=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Items=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Ammo groups=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Critters=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Factions=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Obstacles=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Containers=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Platforms=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Triggers=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Mapscripts=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Recipes=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Global Variables=&lt;br /&gt;
&lt;br /&gt;
=Tips=&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_configuration&amp;diff=1480</id>
		<title>RPG configuration</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_configuration&amp;diff=1480"/>
				<updated>2011-10-13T05:34:13Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Intro=&lt;br /&gt;
The definitions are stored in a series of sub directories in your game&amp;#039;s directory. The directory itself will typically share the name of the definitions it contains, ie, one containing critter definitions will be called critters.&lt;br /&gt;
&lt;br /&gt;
The game&amp;#039;s directory itself will share its name with a .cfg file placed along side it, this CFG file allows the RPG module to ascertain the game&amp;#039;s presence and subsequently load it, as well as define other properties. There is a base directory included to help you set things up.&lt;br /&gt;
&lt;br /&gt;
If you require help in setting things up, please consult the first part of the [[RPG_tutorial tutorial]].&lt;br /&gt;
&lt;br /&gt;
=Game configuration=&lt;br /&gt;
&lt;br /&gt;
the cfg that lives along the game&amp;#039;s directory defines several very important things. It associates maps with scripts and mapflags, defines the first map and all sorts of other properties as well as the game&amp;#039;s HUD.&lt;br /&gt;
&lt;br /&gt;
Currently not implemented is the means to adjust the stat gradients.&lt;br /&gt;
&lt;br /&gt;
Available variables at present are&lt;br /&gt;
* firstmap - the first map that is loaded if one isn&amp;#039;t specified&lt;br /&gt;
* gameversion - game version&lt;br /&gt;
* compatversion - oldest game version the game is compatible with (for patches)&lt;br /&gt;
&lt;br /&gt;
Available commands are&lt;br /&gt;
* r_preparemap map script flags&lt;br /&gt;
&lt;br /&gt;
=Notes and tips=&lt;br /&gt;
&lt;br /&gt;
Firstly slots, each and every single slot has a companion command with a _get (usually takes no arguments) suffix that will return its value.&lt;br /&gt;
&lt;br /&gt;
Secondly, you are going to be modifying the definitions quite a lot and perhaps even tweak them a lot in a very short space of time, there&amp;#039;s a command named &amp;#039;&amp;#039;&amp;#039;r_rehash&amp;#039;&amp;#039;&amp;#039; available to facilitate your testing. Make sure to save your map and game before using it.&lt;br /&gt;
&lt;br /&gt;
Thirdly, if you are going to duplicate definitions for the purpose of making derivatives, use the &amp;#039;&amp;#039;&amp;#039;include&amp;#039;&amp;#039;&amp;#039; command to execute that definition. Include is executed relative to your game&amp;#039;s directory eg. include scripts/1 will execute data/rpg/games/mygame/scripts/1.cfg&lt;br /&gt;
&lt;br /&gt;
=Scripts=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Particle Effects=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Status groups=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Items=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Ammo groups=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Critters=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Factions=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Obstacles=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Containers=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Platforms&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Triggers=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Mapscripts=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Recipes=&lt;br /&gt;
==Commands==&lt;br /&gt;
==Slots==&lt;br /&gt;
&lt;br /&gt;
=Global Variables=&lt;br /&gt;
&lt;br /&gt;
=Tips=&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG&amp;diff=1479</id>
		<title>RPG</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG&amp;diff=1479"/>
				<updated>2011-10-13T04:47:20Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The RPG is currently still in heavy development with many features still unimplemented. With the advent of the 2.7.0 release it has entered the Alpha stage. It may still change dramatically in the near future, but the various interfaces at this point are more or less stable and should function correctly with future releases.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
* [[RPG configuration|Configuration and Definitions]]&lt;br /&gt;
* [[RPG script|Scripting]]&lt;br /&gt;
* [[RPG_cutscene|Cutscenes]]&lt;br /&gt;
* [[RPG gui|GUIs]]&lt;br /&gt;
* [[RPG hud|HUDs]]&lt;br /&gt;
&lt;br /&gt;
=Tutorials=&lt;br /&gt;
* [[RPG editing|Editing tips]]&lt;br /&gt;
* [[RPG tutorial|Tutorial]]&lt;br /&gt;
&lt;br /&gt;
=Misc. pages=&lt;br /&gt;
* [[RPG todo|todo]]&lt;br /&gt;
&lt;br /&gt;
=Internals=&lt;br /&gt;
&lt;br /&gt;
The creator is capable of defining and manipulating a great many facets of his game, and future releases promise to increase these capabilities and freedoms.&lt;br /&gt;
&lt;br /&gt;
== Cutscenes ==&lt;br /&gt;
&lt;br /&gt;
Cutscenes unlike definitions can contain things other than numbers in their names and aren&amp;#039;t loaded into memory until they are needed. Cutscenes &amp;#039;&amp;#039;&amp;#039;can always be skipped&amp;#039;&amp;#039;&amp;#039; and you as the creator should therefor make sure that the post script takes care of any changes of state that need to happen, additionally during cutscenes are the only time the player can be commanded via AI commands.&lt;br /&gt;
&lt;br /&gt;
There are two parts to the cutscene system, the first is directives for the camera and the second are 2D elements to be drawn on screen and their containers.&lt;br /&gt;
&lt;br /&gt;
with respect to the 2D elements, the cutscene system functions like the HUD in this regard, fitting a proportionally scaled 1600x1200 virtual screen into yours and then adjusting the size to cover the entire screen and storing the size in the hud_right and hud_bottom variables.&lt;br /&gt;
&lt;br /&gt;
Containers basically group a series of actions together and influences them in some way (eg, rotates 2D elements). Containers are destroyed when they no longer possess any children. A very handy use for these are to allow layers. For example, you could create a slide container and a subtitle container, this will result in the subtitles always being drawn above the slides.&lt;br /&gt;
&lt;br /&gt;
== Definitions ==&lt;br /&gt;
&lt;br /&gt;
The creator can define just about anything, from creatures, monsters, maps, containers, scripts, dialogue, cutscenes, HUDs, GUIs and particle effects. The definitions are sourced from the game&amp;#039;s data directory and can be changed in real time during the game. It should be noted that unless things use these definitions as a template, any effects from ingame modifications will not persist across sessions. We therefor recommend that you only use those that accept references as any changes to them will persist unless you simply wish to test and fine tine some variables quickly and easily.&lt;br /&gt;
&lt;br /&gt;
Also note that all definitions must be defined in a separate text file named solely by a number with a .cfg extension. Any other .cfg files will throw warnings and the game will abort if there are any gaps.&lt;br /&gt;
&lt;br /&gt;
For example, there is a definition for a bear creature with 40 strength. I might increase this to 90 in game, but any existing bears will still have 40 strength. Likewise I could create a few new bears which would then have 90 strength. if I was to save and reload my game, any new bears will have 40 strength but those spawned with 90 strength will still exist and walk about.&lt;br /&gt;
&lt;br /&gt;
== Game state ==&lt;br /&gt;
&lt;br /&gt;
All map related information, short of the map&amp;#039;s entities, waypoints and geometry are stored in a hashtable. This hashtable includes the properties of the map, the script, the name and the entities currently present as well as any queued actions that are awaiting the player&amp;#039;s arrival.&lt;br /&gt;
&lt;br /&gt;
Generally speaking, any map besides the current map isn&amp;#039;t updated and is in a state of limbo until the player goes there.&lt;br /&gt;
&lt;br /&gt;
== GUIs ==&lt;br /&gt;
&lt;br /&gt;
The RPG defines a series of commands to facilitate the creation of custom GUIs, unlike previous iterations the GUI isn&amp;#039;t hard coded although it depends on a few hard coded names.&lt;br /&gt;
&lt;br /&gt;
Essentially all the RPG does in relation to this is to force the talk GUI open during conversations and to pause the game while a GUI is open. newui currently isn&amp;#039;t properly supported.&lt;br /&gt;
&lt;br /&gt;
== HUDs ==&lt;br /&gt;
&lt;br /&gt;
The placement of all HUD entities are defined entirely through script, the script itself is evaluated once every update and can be redefined at any part of the game using a r_hud invocation.&lt;br /&gt;
&lt;br /&gt;
The HUD pretends to be a 1600x1200 screen scaled to fit inside your screen and then has its dimensions adjusted, these dimensions are stored in the variables, hud_right and hud_bottom which you should query when you draw items offset from the bottom or the right. The only benefit of using such a size is that it&amp;#039;s far easier to get a sense of scale and to understand in general than a 0.f to 1.f range.&lt;br /&gt;
&lt;br /&gt;
In case you&amp;#039;re wondering why there is a hud_bottom and not a hud_up, the reason is that the screen coordinates are flipped and that the top left is therefor (0, 0), not the bottom left.&lt;br /&gt;
&lt;br /&gt;
== Multiplayer ==&lt;br /&gt;
&lt;br /&gt;
The RPG wasn&amp;#039;t designed to accommodate multiplayer. We may consider NWN style coop sometime in the distant future but the RPG simply lacks any multiplayer capability what so ever.&lt;br /&gt;
&lt;br /&gt;
In other words, this module is presently single player only and will likely remain so.&lt;br /&gt;
&lt;br /&gt;
== Savegames ==&lt;br /&gt;
&lt;br /&gt;
Savegames store the game state and the game definition source. Definitions and the AI&amp;#039;s state isn&amp;#039;t stored, the one exception is recipes in which a portion of the flags slot is saved. specifically the portion that tells us if the player knows the recipe.&lt;br /&gt;
&lt;br /&gt;
Otherwise, everything is saved in a compressed archive, from maps and their contents, to the various properties of each and every existing entity to the whole reference table.&lt;br /&gt;
&lt;br /&gt;
It should be noted that you cannot save at certain points, specifically during dialogue, cutscenes, in editmode and on maps with the F_NOSAVE flag set.&lt;br /&gt;
&lt;br /&gt;
== Scripts ==&lt;br /&gt;
&lt;br /&gt;
Scripts are signal based, you define a signal to listen for and a set of actions to execute when that signal is received. There are several types, those the game sends on every update, those the game sends under certain conditions and those the creator manually sends himself via r_signal.&lt;br /&gt;
&lt;br /&gt;
The second and probably the most important facet of scripting is the use of references. The reference system is type safe, prone to whining (the solution is to fix what it&amp;#039;s complaining about, not ignore it) and is implemented as a layer utilising cubescript as opposed to being a part of it. &lt;br /&gt;
&lt;br /&gt;
The reference system is implemented as an array of hashtables, which introduces the concept of scope and shadowing and there are also some hard-coded reserved references. At present these are specifically, &amp;quot;player&amp;quot;, &amp;quot;curmap&amp;quot;, &amp;quot;talker&amp;quot;, &amp;quot;self&amp;quot; and &amp;quot;actor&amp;quot;, you should not change them and they will likely be read only in the near future. In addition there are also temporary references, these aren&amp;#039;t saved in the save game and are cleared at the end of the update cycle. Some of the destinations may persist for a long time but there is no such guarantee.&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1478</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1478"/>
				<updated>2011-10-12T17:24:27Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: a little extra for my fans ;)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need to spawn this in the back of the dedicated room in the dungeon. After that is done, we only need to edit 2 more files, first up, open up variables,cfg.&lt;br /&gt;
&lt;br /&gt;
You use this file to store variables and values you want to persist across sessions. So you want to use these to record the various choices the player has made, the things he has done and the status of all kinds of things in the world.&lt;br /&gt;
&lt;br /&gt;
append this onto the end of variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 bobmcguffin = (r_global_new 0) //bob&amp;#039;s quest to retrieve the mcguffin, 1 - have quest 2 - finished quest&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now only have Bob&amp;#039;s dialogue left to go. We will provide different responses for the various states as well as set any variables that need be and remove any inventory items that need be.&lt;br /&gt;
&lt;br /&gt;
We will need to change a fair bit of his script, So without further ado, open up his script and replace the dialogue with the following.&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
   r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
   case (r_global_get $bobmcguffin) 0 [&lt;br /&gt;
     r_response &amp;quot;Do you have any work for me?&amp;quot; 2&lt;br /&gt;
   ] 1 [&lt;br /&gt;
     if (r_get_amount player 7) [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 4&lt;br /&gt;
     ] [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 6&lt;br /&gt;
     ]&lt;br /&gt;
   ] 2 [&lt;br /&gt;
     r_response &amp;quot;Do you have any more work for me?&amp;quot; 7&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I need someone to go into the cave to the North-West of this valley and retrieve the mcGuffin, can you do that for me?&amp;quot; [ //2&lt;br /&gt;
   r_response &amp;quot;You can count on me!&amp;quot; 3 [ r_global_set $bobmcguffin 1 ]&lt;br /&gt;
   r_response &amp;quot;Maybe some other time&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Great! I&amp;#039;ll be waiting for your return&amp;quot; [ //3&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you for finding it, but I don&amp;#039;t have a reward for you but I&amp;#039;d till very much like the mcGuffin.&amp;quot; [ //4&lt;br /&gt;
   r_response &amp;quot;[Give him the mcGuffin]&amp;quot; 5 [&lt;br /&gt;
     r_remove player 7 1&lt;br /&gt;
     r_givexp player 900&lt;br /&gt;
     r_global_set $bobmcguffin 2&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;I think I&amp;#039;ll hold onto it for now&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you very much, I will never forget this&amp;quot; [ // 5&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Where is it?&amp;quot; [ //6&lt;br /&gt;
   r_response &amp;quot;I must&amp;#039;ve forgotten it in the cave...&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;No, but once again, thank you for getting this for me&amp;quot; [ //7&lt;br /&gt;
   r_response &amp;quot;Farewell&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congrats, you&amp;#039;ve made your first FedEx quest. I hope you&amp;#039;re ashamed of yourself and will take this moment to reflect on your actions and produce quests with multiple paths and solutions that aren&amp;#039;t simply get X of Y or kill X of Y ;)&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global Variable Tips&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are saved with your game and remain in a constant order and are all defined inside variables.cfg and they can only be integers. r_global_new returns the variable&amp;#039;s index (ie, the first will return 0) and you should alias these return values to an easy to remember name that is short and as descriptive as possible. If you need to list more detailed information, do so in comments either before or on the same line.&lt;br /&gt;
&lt;br /&gt;
You will want to increase the game/compat versions when you move/remove/add anything in here, serious breakage can occur&lt;br /&gt;
&lt;br /&gt;
You should keep the names short and easy to type, for example, if we have a quest where you find a someone named Jane a bunch of apples, JaneApples and ApplesForJane would be some of the better names.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Journal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There is no journal at present but there will be in the future, you will want to record rumours, quest notes, deeds, obituaries and all kinds of other things in there. What you can do for now is make a book where the player can access all this information via dialogue.&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic logic puzzle to open a door.&lt;br /&gt;
&lt;br /&gt;
We will create a 10 digit number pad of sorts, the player would need to interact with in a specific order to remove an obstacle we will place in the second area.&lt;br /&gt;
&lt;br /&gt;
Our first order of business will be to define the variables we&amp;#039;ll need to pull this off, we&amp;#039;ll need two for the method we&amp;#039;ll be using.&lt;br /&gt;
&lt;br /&gt;
variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 keyprogress = (r_global_new 0)&lt;br /&gt;
 keytest = (r_global_new -1)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we&amp;#039;ll define the button&amp;#039;s scripts. The scripts will set the keytest variable and will then call the &amp;quot;testkey&amp;quot; signal on the current map and propagate it to the door. We will define the door a bit later.&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 0&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
14.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 1&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
15.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 2&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
16.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 3&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
17.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 4&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
18.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 5&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
19.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 6&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
20.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 7&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
21.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 8&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
22.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 9&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you thought that wasn&amp;#039;t boring enough, we now define the buttons themselves with similarly minor alterations, these should occupy slots 3 to 12 in the triggers directory, feel free to use a more appropriate model if you have one available.&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;0 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 13&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;1 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;2 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 15&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;3 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 16&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;4 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 17&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;5 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 18&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;6 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 19&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;7 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 20&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;8 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;9 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 22&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will not get to the fun part! defining the actual door itself (hooray!). Like in every other instance, we will define the script first. The door&amp;#039;s script will be as follows, it need to test and increment the global variables we&amp;#039;ve defined earlier.&lt;br /&gt;
&lt;br /&gt;
23.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 key = [ 3 1 3 3 7 ] //change as appropriate&lt;br /&gt;
 keylen = (listlen $key)&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal testkey [&lt;br /&gt;
   if (&amp;lt; (r_global_get $keyprogress) @keylen) [&lt;br /&gt;
     if (= (at [@@@key] (r_global_get $keyprogress)) (r_global_get $keytest) [&lt;br /&gt;
       r_global_set $keyprogress (+ (r_global_get $keyprogress) 1)&lt;br /&gt;
     ] [&lt;br /&gt;
       r_global_set $keyprogress 0&lt;br /&gt;
     ]&lt;br /&gt;
     if (= (r_global_get $keyprogress) @@keylen) [&lt;br /&gt;
       r_trigger self&lt;br /&gt;
     ]&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now make the trigger itself, like with the last step, choose a model of appropriate size to block the passage to the mcGuffin&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Heavy door&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_script 23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;a guiding hand&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Depending on the puzzle and its difficulty, you should strive to give the player a few hints to solve it. You should avoid giving the player the answer but you should give the player some audio or visual feedback based on his actions.&lt;br /&gt;
&lt;br /&gt;
Take our above puzzle for example, we have no idea if the combination we have entered is even correct apart from the door opening after interacting with the triggers. In addition, trying every 5 digit combo to get the example combination can take as many as 100000 attempts.&lt;br /&gt;
&lt;br /&gt;
For a puzzle like that, it is unreasonable to just expect the player to figure out the answer himself without a few hints. Short of giving the player the answer, we could perhaps tell him the digits but in a wrong order, or perhaps give him a mnemonic he has to decipher to get the answer.&lt;br /&gt;
&lt;br /&gt;
=Extras=&lt;br /&gt;
&lt;br /&gt;
* [http://www.sendspace.com/file/cu341n Finished product] - Note, the maps require a version of sandbox newer than 2.7.0&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1477</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1477"/>
				<updated>2011-10-12T17:13:56Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 7 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need to spawn this in the back of the dedicated room in the dungeon. After that is done, we only need to edit 2 more files, first up, open up variables,cfg.&lt;br /&gt;
&lt;br /&gt;
You use this file to store variables and values you want to persist across sessions. So you want to use these to record the various choices the player has made, the things he has done and the status of all kinds of things in the world.&lt;br /&gt;
&lt;br /&gt;
append this onto the end of variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 bobmcguffin = (r_global_new 0) //bob&amp;#039;s quest to retrieve the mcguffin, 1 - have quest 2 - finished quest&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now only have Bob&amp;#039;s dialogue left to go. We will provide different responses for the various states as well as set any variables that need be and remove any inventory items that need be.&lt;br /&gt;
&lt;br /&gt;
We will need to change a fair bit of his script, So without further ado, open up his script and replace the dialogue with the following.&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
   r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
   case (r_global_get $bobmcguffin) 0 [&lt;br /&gt;
     r_response &amp;quot;Do you have any work for me?&amp;quot; 2&lt;br /&gt;
   ] 1 [&lt;br /&gt;
     if (r_get_amount player 7) [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 4&lt;br /&gt;
     ] [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 6&lt;br /&gt;
     ]&lt;br /&gt;
   ] 2 [&lt;br /&gt;
     r_response &amp;quot;Do you have any more work for me?&amp;quot; 7&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I need someone to go into the cave to the North-West of this valley and retrieve the mcGuffin, can you do that for me?&amp;quot; [ //2&lt;br /&gt;
   r_response &amp;quot;You can count on me!&amp;quot; 3 [ r_global_set $bobmcguffin 1 ]&lt;br /&gt;
   r_response &amp;quot;Maybe some other time&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Great! I&amp;#039;ll be waiting for your return&amp;quot; [ //3&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you for finding it, but I don&amp;#039;t have a reward for you but I&amp;#039;d till very much like the mcGuffin.&amp;quot; [ //4&lt;br /&gt;
   r_response &amp;quot;[Give him the mcGuffin]&amp;quot; 5 [&lt;br /&gt;
     r_remove player 7 1&lt;br /&gt;
     r_givexp player 900&lt;br /&gt;
     r_global_set $bobmcguffin 2&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;I think I&amp;#039;ll hold onto it for now&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you very much, I will never forget this&amp;quot; [ // 5&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Where is it?&amp;quot; [ //6&lt;br /&gt;
   r_response &amp;quot;I must&amp;#039;ve forgotten it in the cave...&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;No, but once again, thank you for getting this for me&amp;quot; [ //7&lt;br /&gt;
   r_response &amp;quot;Farewell&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congrats, you&amp;#039;ve made your first FedEx quest. I hope you&amp;#039;re ashamed of yourself and will take this moment to reflect on your actions and produce quests with multiple paths and solutions that aren&amp;#039;t simply get X of Y or kill X of Y ;)&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global Variable Tips&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are saved with your game and remain in a constant order and are all defined inside variables.cfg and they can only be integers. r_global_new returns the variable&amp;#039;s index (ie, the first will return 0) and you should alias these return values to an easy to remember name that is short and as descriptive as possible. If you need to list more detailed information, do so in comments either before or on the same line.&lt;br /&gt;
&lt;br /&gt;
You will want to increase the game/compat versions when you move/remove/add anything in here, serious breakage can occur&lt;br /&gt;
&lt;br /&gt;
You should keep the names short and easy to type, for example, if we have a quest where you find a someone named Jane a bunch of apples, JaneApples and ApplesForJane would be some of the better names.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Journal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There is no journal at present but there will be in the future, you will want to record rumours, quest notes, deeds, obituaries and all kinds of other things in there. What you can do for now is make a book where the player can access all this information via dialogue.&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic logic puzzle to open a door.&lt;br /&gt;
&lt;br /&gt;
We will create a 10 digit number pad of sorts, the player would need to interact with in a specific order to remove an obstacle we will place in the second area.&lt;br /&gt;
&lt;br /&gt;
Our first order of business will be to define the variables we&amp;#039;ll need to pull this off, we&amp;#039;ll need two for the method we&amp;#039;ll be using.&lt;br /&gt;
&lt;br /&gt;
variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 keyprogress = (r_global_new 0)&lt;br /&gt;
 keytest = (r_global_new -1)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we&amp;#039;ll define the button&amp;#039;s scripts. The scripts will set the keytest variable and will then call the &amp;quot;testkey&amp;quot; signal on the current map and propagate it to the door. We will define the door a bit later.&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 0&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
14.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 1&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
15.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 2&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
16.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 3&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
17.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 4&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
18.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 5&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
19.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 6&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
20.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 7&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
21.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 8&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
22.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 9&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you thought that wasn&amp;#039;t boring enough, we now define the buttons themselves with similarly minor alterations, these should occupy slots 3 to 12 in the triggers directory, feel free to use a more appropriate model if you have one available.&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;0 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 13&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;1 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;2 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 15&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;3 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 16&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;4 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 17&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;5 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 18&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;6 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 19&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;7 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 20&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;8 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;9 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 22&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will not get to the fun part! defining the actual door itself (hooray!). Like in every other instance, we will define the script first. The door&amp;#039;s script will be as follows, it need to test and increment the global variables we&amp;#039;ve defined earlier.&lt;br /&gt;
&lt;br /&gt;
23.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 key = [ 3 1 3 3 7 ] //change as appropriate&lt;br /&gt;
 keylen = (listlen $key)&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal testkey [&lt;br /&gt;
   if (&amp;lt; (r_global_get $keyprogress) @keylen) [&lt;br /&gt;
     if (= (at [@@@key] (r_global_get $keyprogress)) (r_global_get $keytest) [&lt;br /&gt;
       r_global_set $keyprogress (+ (r_global_get $keyprogress) 1)&lt;br /&gt;
     ] [&lt;br /&gt;
       r_global_set $keyprogress 0&lt;br /&gt;
     ]&lt;br /&gt;
     if (= (r_global_get $keyprogress) @@keylen) [&lt;br /&gt;
       r_trigger self&lt;br /&gt;
     ]&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now make the trigger itself, like with the last step, choose a model of appropriate size to block the passage to the mcGuffin&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Heavy door&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_script 23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;a guiding hand&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Depending on the puzzle and its difficulty, you should strive to give the player a few hints to solve it. You should avoid giving the player the answer but you should give the player some audio or visual feedback based on his actions.&lt;br /&gt;
&lt;br /&gt;
Take our above puzzle for example, we have no idea if the combination we have entered is even correct apart from the door opening after interacting with the triggers. In addition, trying every 5 digit combo to get the example combination can take as many as 100000 attempts.&lt;br /&gt;
&lt;br /&gt;
For a puzzle like that, it is unreasonable to just expect the player to figure out the answer himself without a few hints. Short of giving the player the answer, we could perhaps tell him the digits but in a wrong order, or perhaps give him a mnemonic he has to decipher to get the answer.&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1476</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1476"/>
				<updated>2011-10-12T16:32:40Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 7 */ puzzles!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need to spawn this in the back of the dedicated room in the dungeon. After that is done, we only need to edit 2 more files, first up, open up variables,cfg.&lt;br /&gt;
&lt;br /&gt;
You use this file to store variables and values you want to persist across sessions. So you want to use these to record the various choices the player has made, the things he has done and the status of all kinds of things in the world.&lt;br /&gt;
&lt;br /&gt;
append this onto the end of variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 bobmcguffin = (r_global_new 0) //bob&amp;#039;s quest to retrieve the mcguffin, 1 - have quest 2 - finished quest&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now only have Bob&amp;#039;s dialogue left to go. We will provide different responses for the various states as well as set any variables that need be and remove any inventory items that need be.&lt;br /&gt;
&lt;br /&gt;
We will need to change a fair bit of his script, So without further ado, open up his script and replace the dialogue with the following.&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
   r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
   case (r_global_get $bobmcguffin) 0 [&lt;br /&gt;
     r_response &amp;quot;Do you have any work for me?&amp;quot; 2&lt;br /&gt;
   ] 1 [&lt;br /&gt;
     if (r_get_amount player 7) [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 4&lt;br /&gt;
     ] [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 6&lt;br /&gt;
     ]&lt;br /&gt;
   ] 2 [&lt;br /&gt;
     r_response &amp;quot;Do you have any more work for me?&amp;quot; 7&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I need someone to go into the cave to the North-West of this valley and retrieve the mcGuffin, can you do that for me?&amp;quot; [ //2&lt;br /&gt;
   r_response &amp;quot;You can count on me!&amp;quot; 3 [ r_global_set $bobmcguffin 1 ]&lt;br /&gt;
   r_response &amp;quot;Maybe some other time&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Great! I&amp;#039;ll be waiting for your return&amp;quot; [ //3&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you for finding it, but I don&amp;#039;t have a reward for you but I&amp;#039;d till very much like the mcGuffin.&amp;quot; [ //4&lt;br /&gt;
   r_response &amp;quot;[Give him the mcGuffin]&amp;quot; 5 [&lt;br /&gt;
     r_remove player 7 1&lt;br /&gt;
     r_givexp player 900&lt;br /&gt;
     r_global_set $bobmcguffin 2&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;I think I&amp;#039;ll hold onto it for now&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you very much, I will never forget this&amp;quot; [ // 5&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Where is it?&amp;quot; [ //6&lt;br /&gt;
   r_response &amp;quot;I must&amp;#039;ve forgotten it in the cave...&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;No, but once again, thank you for getting this for me&amp;quot; [ //7&lt;br /&gt;
   r_response &amp;quot;Farewell&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congrats, you&amp;#039;ve made your first FedEx quest. I hope you&amp;#039;re ashamed of yourself and will take this moment to reflect on your actions and produce quests with multiple paths and solutions that aren&amp;#039;t simply get X of Y or kill X of Y ;)&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global Variable Tips&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are saved with your game and remain in a constant order and are all defined inside variables.cfg and they can only be integers. r_global_new returns the variable&amp;#039;s index (ie, the first will return 0) and you should alias these return values to an easy to remember name that is short and as descriptive as possible. If you need to list more detailed information, do so in comments either before or on the same line.&lt;br /&gt;
&lt;br /&gt;
You will want to increase the game/compat versions when you move/remove/add anything in here, serious breakage can occur&lt;br /&gt;
&lt;br /&gt;
You should keep the names short and easy to type, for example, if we have a quest where you find a someone named Jane a bunch of apples, JaneApples and ApplesForJane would be some of the better names.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Journal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There is no journal at present but there will be in the future, you will want to record rumours, quest notes, deeds, obituaries and all kinds of other things in there. What you can do for now is make a book where the player can access all this information via dialogue.&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic logic puzzle to open a door.&lt;br /&gt;
&lt;br /&gt;
We will create a 10 digit number pad of sorts, the player would need to interact with in a specific order to remove an obstacle we will place in the second area.&lt;br /&gt;
&lt;br /&gt;
Our first order of business will be to define the variables we&amp;#039;ll need to pull this off, we&amp;#039;ll need two for the method we&amp;#039;ll be using.&lt;br /&gt;
&lt;br /&gt;
variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 keyprogress = (r_global_new 0)&lt;br /&gt;
 keytest = (r_global_new -1)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we&amp;#039;ll define the button&amp;#039;s scripts. The scripts will set the keytest variable and will then call the &amp;quot;testkey&amp;quot; signal on the current map and propagate it to the door. We will define the door a bit later.&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 0&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
14.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 1&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
15.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 2&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
16.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 3&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
17.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 4&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
18.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 5&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
19.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 6&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
20.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 7&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
21.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 8&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
22.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal interact [&lt;br /&gt;
   r_global_set $keytest 9&lt;br /&gt;
   r_signal &amp;quot;testkey&amp;quot; self curmap 1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you thought that wasn&amp;#039;t boring enough, we now define the buttons themselves with similarly minor alterations, these should occupy slots 3 to 12 in the triggers directory, feel free to use a more appropriate model if you have one available.&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;0 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 13&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;1 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 14&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;2 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 15&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;3 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 16&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;4 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 17&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;5 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 18&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;6 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 19&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;7 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 20&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;8 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 21&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;9 Key&lt;br /&gt;
 r_trigger_mdl &amp;quot;teleporter&lt;br /&gt;
 r_trigger_script 22&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will not get to the fun part! defining the actual door itself (hooray!). Like in every other instance, we will define the script first. The door&amp;#039;s script will be as follows, it need to test and increment the global variables we&amp;#039;ve defined earlier.&lt;br /&gt;
&lt;br /&gt;
23.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 key = [ 3 1 3 3 7 ] //change as appropriate&lt;br /&gt;
 keylen = (listlen $key)&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal testkey [&lt;br /&gt;
   if (&amp;lt; (r_global_get $keyprogress) @keylen) [&lt;br /&gt;
     if (= (at [@@@key] (r_global_get $keyprogress)) (r_global_get $keytest) [&lt;br /&gt;
       r_global_set $keyprogress (+ (r_global_get $keyprogress) 1)&lt;br /&gt;
     ]&lt;br /&gt;
     if (= (r_global_get $keyprogress) @@keylen) [&lt;br /&gt;
       r_trigger self&lt;br /&gt;
     ]&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now make the trigger itself, like with the last step, choose a model of appropriate size to block the passage to the mcGuffin&lt;br /&gt;
&lt;br /&gt;
13.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Heavy door&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_script 23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1472</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1472"/>
				<updated>2011-10-09T16:00:27Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 6 */ finish part 6&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will need to spawn this in the back of the dedicated room in the dungeon. After that is done, we only need to edit 2 more files, first up, open up variables,cfg.&lt;br /&gt;
&lt;br /&gt;
You use this file to store variables and values you want to persist across sessions. So you want to use these to record the various choices the player has made, the things he has done and the status of all kinds of things in the world.&lt;br /&gt;
&lt;br /&gt;
append this onto the end of variables.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 bobmcguffin = (r_global_new 0) //bob&amp;#039;s quest to retrieve the mcguffin, 1 - have quest 2 - finished quest&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now only have Bob&amp;#039;s dialogue left to go. We will provide different responses for the various states as well as set any variables that need be and remove any inventory items that need be.&lt;br /&gt;
&lt;br /&gt;
We will need to change a fair bit of his script, So without further ado, open up his script and replace the dialogue with the following.&lt;br /&gt;
&lt;br /&gt;
8.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
   r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
   case (r_global_get $bobmcguffin) 0 [&lt;br /&gt;
     r_response &amp;quot;Do you have any work for me?&amp;quot; 2&lt;br /&gt;
   ] 1 [&lt;br /&gt;
     if (r_get_amount player 7) [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 4&lt;br /&gt;
     ] [&lt;br /&gt;
       r_response &amp;quot;I brought you the mcGuffin&amp;quot; 6&lt;br /&gt;
     ]&lt;br /&gt;
   ] 2 [&lt;br /&gt;
     r_response &amp;quot;Do you have any more work for me?&amp;quot; 7&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
   r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;I need someone to go into the cave to the North-West of this valley and retrieve the mcGuffin, can you do that for me?&amp;quot; [ //2&lt;br /&gt;
   r_response &amp;quot;You can count on me!&amp;quot; 3 [ r_global_set $bobmcguffin 1 ]&lt;br /&gt;
   r_response &amp;quot;Maybe some other time&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Great! I&amp;#039;ll be waiting for your return&amp;quot; [ //3&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you for finding it, but I don&amp;#039;t have a reward for you but I&amp;#039;d till very much like the mcGuffin.&amp;quot; [ //4&lt;br /&gt;
   r_response &amp;quot;[Give him the mcGuffin]&amp;quot; 5 [&lt;br /&gt;
     r_remove player 7 1&lt;br /&gt;
     r_givexp player 900&lt;br /&gt;
     r_global_set $bobmcguffin 2&lt;br /&gt;
   ]&lt;br /&gt;
   r_response &amp;quot;I think I&amp;#039;ll hold onto it for now&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Thank you very much, I will never forget this&amp;quot; [ // 5&lt;br /&gt;
   r_response &amp;quot;[End]&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;Where is it?&amp;quot; [ //6&lt;br /&gt;
   r_response &amp;quot;I must&amp;#039;ve forgotten it in the cave...&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_say &amp;quot;No, but once again, thank you for getting this for me&amp;quot; [ //7&lt;br /&gt;
   r_response &amp;quot;Farewell&amp;quot; -1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congrats, you&amp;#039;ve made your first FedEx quest. I hope you&amp;#039;re ashamed of yourself and will take this moment to reflect on your actions and produce quests with multiple paths and solutions that aren&amp;#039;t simply get X of Y or kill X of Y ;)&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global Variable Tips&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are saved with your game and remain in a constant order and are all defined inside variables.cfg and they can only be integers. r_global_new returns the variable&amp;#039;s index (ie, the first will return 0) and you should alias these return values to an easy to remember name that is short and as descriptive as possible. If you need to list more detailed information, do so in comments either before or on the same line.&lt;br /&gt;
&lt;br /&gt;
You will want to increase the game/compat versions when you move/remove/add anything in here, serious breakage can occur&lt;br /&gt;
&lt;br /&gt;
You should keep the names short and easy to type, for example, if we have a quest where you find a someone named Jane a bunch of apples, JaneApples and ApplesForJane would be some of the better names.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Journal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There is no journal at present but there will be in the future, you will want to record rumours, quest notes, deeds, obituaries and all kinds of other things in there. What you can do for now is make a book where the player can access all this information via dialogue.&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic puzzle to open a door as well as overriding the HUD&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1471</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1471"/>
				<updated>2011-10-09T12:03:23Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 5 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_clear self&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Spawn this in the back of the dedicated room in the dungeon. All that is left to do now is to add relevant dialogue paths to Bob and record your progress via global variables.&lt;br /&gt;
&lt;br /&gt;
REST OF TUTORIAL HERE&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic puzzle to open a door as well as overriding the HUD&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1470</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1470"/>
				<updated>2011-10-09T11:13:04Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout.&lt;br /&gt;
&lt;br /&gt;
After that is done, our first order of business would be to add this to the list of maps for the tutorial game. Since we plan to create a special HUD for the map in the next part, it would be easiest for us if we can prohibit saving. Add the map as follows below the first map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_preparemap tutorial2 0 $MAP_NOSAVE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now brings us to the most important, we need to define some means of getting in and out of the dungeon. We will need two triggers and scripts to do this. We will be using a special trigger flag that will make the trigger invisible and we will be using the collide script slot to trigger area transitions. If you like me, dislike that, use the interact slots instead. Spend some time first finding a model that fits the entrance to your cavern/dungeon well and would guarantee a collision before continuing. First off, let&amp;#039;s define the scripts for our triggers.&lt;br /&gt;
&lt;br /&gt;
11.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial2&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
12.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   r_teleport actor 0 tutorial1&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scripts would literally move whatever touches it to the specified map at teledest 0, but more on that later. We will now define our triggers.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Enter cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 11&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Leave cavern&amp;quot;&lt;br /&gt;
 r_trigger_script 12&lt;br /&gt;
 r_trigger_mdl &amp;quot;ahab/castle_door&amp;quot;&lt;br /&gt;
 r_trigger_flags $TRIG_INVIS&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that done, you can now spawn the triggers at their respective places. After doing that, spawn teledest ents with a tag of 0 outside the immediate area, so that the teleport command has a destination to place anything it teleports.&lt;br /&gt;
&lt;br /&gt;
Our next step will be to make the mcGuffin, the mcGuffin in this case will be an item.&lt;br /&gt;
&lt;br /&gt;
7.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;McGuffin&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;This item is needed to advance the pl- er.. tutorial.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;hirato/box/standard&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Spawn this in the back of the dedicated room in the dungeon. All that is left to do now is to add relevant dialogue paths to Bob and record your progress via global variables.&lt;br /&gt;
&lt;br /&gt;
REST OF TUTORIAL HERE&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map - use sparingly&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic puzzle to open a door as well as overriding the HUD&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_todo&amp;diff=1469</id>
		<title>RPG todo</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_todo&amp;diff=1469"/>
				<updated>2011-10-09T10:50:07Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Logic */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Script=&lt;br /&gt;
* Timers&lt;br /&gt;
** copy reference table&lt;br /&gt;
** countdown to 0 before executing.&lt;br /&gt;
** update every frame, but execute only outside of cutscenes.&lt;br /&gt;
&lt;br /&gt;
=Gameplay=&lt;br /&gt;
* hotkeys&lt;br /&gt;
* special item properties&lt;br /&gt;
** money (constant value for all purposes)&lt;br /&gt;
** cursed status&lt;br /&gt;
** unidentified status&lt;br /&gt;
*** hide true power or make it a lot less useful?&lt;br /&gt;
* (maybe?) character generation&lt;br /&gt;
* looting and trading... hardcode references &amp;quot;loot&amp;quot; and &amp;quot;trade&amp;quot;?&lt;br /&gt;
* sneaking/stealth&lt;br /&gt;
** light and visibility&lt;br /&gt;
** silhouettes and light levels?&lt;br /&gt;
** stealing&lt;br /&gt;
* proper friendly fire protection&lt;br /&gt;
** 0 - no protection (default)&lt;br /&gt;
** 1 - prevents you from hurting yourself&lt;br /&gt;
** 2 - 1 + prevents you from hurting allies&lt;br /&gt;
** 3 - allows injury to hostile characters only&lt;br /&gt;
* spell types&lt;br /&gt;
** movement (paralysis counters)&lt;br /&gt;
** vocal (silence counters)&lt;br /&gt;
&lt;br /&gt;
=Logic=&lt;br /&gt;
* the consume use case for books and potions.&lt;br /&gt;
* statusgroups on items&lt;br /&gt;
** temporary spells that alters the properties of the weapon&lt;br /&gt;
** multiple at once with different targets.&lt;br /&gt;
* temporary spell effects for wielded items, &lt;br /&gt;
** multiple status effects on a single use, separate chargeflags, multiplier, duration and element.&lt;br /&gt;
** make sure to use each for the right purpose&lt;br /&gt;
* Projectiles&lt;br /&gt;
** improve ricochet, gravity related stuff is funky&lt;br /&gt;
* target types&lt;br /&gt;
** cone&lt;br /&gt;
** self-area/multi&lt;br /&gt;
* status types&lt;br /&gt;
** dispel - should work on individual effects&lt;br /&gt;
** silence&lt;br /&gt;
** paralysis/stun&lt;br /&gt;
* Expose a tonne of constants to Cubescript for configuration at the game maker&amp;#039;s discretion. These include leveling and power curves&lt;br /&gt;
* arbitrary trigger bounding box scales&lt;br /&gt;
&lt;br /&gt;
=GUI=&lt;br /&gt;
* inventory&lt;br /&gt;
** item examination&lt;br /&gt;
* status effects&lt;br /&gt;
* trade &lt;br /&gt;
* stats&lt;br /&gt;
* crafting&lt;br /&gt;
* journal&lt;br /&gt;
* newui variants&lt;br /&gt;
&lt;br /&gt;
=Recipes=&lt;br /&gt;
* (maybe) allow in game apparatuses to act as a catalyst&lt;br /&gt;
** (maybe) several catalysts and ingredients list? or just duplicate and alter the recipe?&lt;br /&gt;
&lt;br /&gt;
=AI=&lt;br /&gt;
* queued prioritised actions&lt;br /&gt;
** most important done first&lt;br /&gt;
** multitasking&lt;br /&gt;
* waypoints&lt;br /&gt;
** randomness&lt;br /&gt;
** state - don&amp;#039;t favour waypoints which are in use&lt;br /&gt;
* ai tags&lt;br /&gt;
** identify purpose and effect of entities in game world for the AI (parsing the script for these is simply not practical)&lt;br /&gt;
*** alternatively use simpler more specific types, such as &amp;quot;door&amp;quot;, &amp;quot;container&amp;quot;, &amp;quot;portal&amp;quot; and &amp;quot;mover&amp;quot; as opposed to a singular &amp;quot;object&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Cutscenes=&lt;br /&gt;
* create a cutscene variant which can&amp;#039;t be skippped (maybe)&lt;br /&gt;
* some sort of skipping bar (1000 ms?) to prevent accidental skips&lt;br /&gt;
&lt;br /&gt;
=Renderer=&lt;br /&gt;
* particles for active spell effects&lt;br /&gt;
* render attachments/equipment&lt;br /&gt;
* animations for weapons&lt;br /&gt;
** generic animations, unarmed strike, melee strike, bow shoot, gun shoot, etc&lt;br /&gt;
&lt;br /&gt;
=Journal=&lt;br /&gt;
* quests&lt;br /&gt;
* log entries&lt;br /&gt;
* sorting and filters&lt;br /&gt;
&lt;br /&gt;
=Sound=&lt;br /&gt;
* sounds while charging spells&lt;br /&gt;
* sounds for projectile firing, travel and death&lt;br /&gt;
* sounds for active statusgroups&lt;br /&gt;
* (maybe) voiced dialogue&lt;br /&gt;
&lt;br /&gt;
=I/O=&lt;br /&gt;
* flat file export of current script/data definitions (maybe)&lt;br /&gt;
** couple with ingame menus for realtime modification (maybe)&lt;br /&gt;
* better range checks and protection&lt;br /&gt;
* save and restore AI directives&lt;br /&gt;
&lt;br /&gt;
=Particles=&lt;br /&gt;
* set particle effects for entity afflicted status effects&lt;br /&gt;
* vary spawned amount of particles depending on distance (few when close, full amount when far away)&lt;br /&gt;
* explicit variable for setting waypoint drawing distance&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1468</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1468"/>
				<updated>2011-10-09T10:37:23Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map2.jpg|200px|thumb|rihgt|suggested layout for dungeon level]]&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout .&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic puzzle to open a door as well as overriding the HUD&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=File:RPG_tutorial_map2.jpg&amp;diff=1467</id>
		<title>File:RPG tutorial map2.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=File:RPG_tutorial_map2.jpg&amp;diff=1467"/>
				<updated>2011-10-09T10:36:38Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: suggested layout for the second tutorial map&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;suggested layout for the second tutorial map&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1466</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1466"/>
				<updated>2011-10-09T10:26:47Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
First up, before we get to the scripts, we are going to create an additional map set below tutorial1, the name of this will be tutorial2. If you are so inclined you can simply create the required geometry below the map, but this is to introduce you to mapflags and mutliple map setups.&lt;br /&gt;
&lt;br /&gt;
We need at least 2 medium sized rooms, connected to each other, with the cavern on the first tutorial map leading into one of them. The first room will be the subject for part 7, the second will house the mcGuffin we will create for this part. The screenshot on the right has an example layout .&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Mapflags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are a variety of mapflags that will affect your ability to do things on the various maps, at present they are as follows&lt;br /&gt;
&lt;br /&gt;
* F_VOLATILE - clears the map state when the player leaves, useful for dungeon levels&lt;br /&gt;
* F_NOSAVE - prevents saving whilst on the map&lt;br /&gt;
* F_NOMINIMAP - doesn&amp;#039;t generate and display a minimap while this flag is active&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic puzzle to open a door as well as overriding the HUD&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1465</id>
		<title>RPG tutorial</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_tutorial&amp;diff=1465"/>
				<updated>2011-10-09T07:10:23Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: /* Part 1 */ typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following tutorials are only meant to cover the basics of developing for the RPG. Each of the tutorials build upon the work from the previous exercises and are therefor best done in order.&lt;br /&gt;
&lt;br /&gt;
=Part 1=&lt;br /&gt;
&lt;br /&gt;
This part covers making the initial skeleton of our game.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By default the RPG detects the available games by searching data/rpg/games for cfg files, these files form the basis of what the main menu will list as the available games. In selecting a game from the menu, it will then attempt to load the definitions from an equivalently named directory.&lt;br /&gt;
&lt;br /&gt;
We now know the first step to making our own tutorial game, we need a corresponding cfg and directory inside &amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Luckily sandbox comes with a base that can be derived to quickly get things up and running, so first up, let&amp;#039;s make a copy of the base directory and call the copy &amp;quot;tutorial&amp;quot; and then move a file named &amp;#039;&amp;#039;&amp;#039;base.cfg&amp;#039;&amp;#039;&amp;#039; inside &amp;#039;&amp;#039;&amp;#039;data/rpg/games/tutorial&amp;#039;&amp;#039;&amp;#039; into &amp;#039;&amp;#039;&amp;#039;data/rpg/games&amp;#039;&amp;#039;&amp;#039; and rename it to &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
We can essentially open up our game in sandbox now, but we still have a few things to do, so for now, open up &amp;#039;&amp;#039;&amp;#039;tutorial.cfg&amp;#039;&amp;#039;&amp;#039; in your favourite text editor. The contents should be pretty self explanatory but we do need to make a few specific changes.&lt;br /&gt;
&lt;br /&gt;
Firstly, we want to set the default map and associate it with mapscript 0, for this excercise we&amp;#039;ll name our map tutorial1.&lt;br /&gt;
&lt;br /&gt;
Secondly, we want to set the version number and the compatibility number to 1.&lt;br /&gt;
&lt;br /&gt;
Finally, we will want to specify a HUD to use for our game. Sandbox currently only ships one, so we will execute it here.&lt;br /&gt;
&lt;br /&gt;
The final version of tutorial.cfg should look similar to this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_preparemap tutorial1 0&lt;br /&gt;
  &lt;br /&gt;
  firstmap tutorial1&lt;br /&gt;
  &lt;br /&gt;
  gameversion 1&lt;br /&gt;
  compatversion 1&lt;br /&gt;
  &lt;br /&gt;
  exec data/rpg/hud_standard.cfg&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save it and we have one more step to go, we need to make a map named tutorial1, so fire up sandbox and save a newmap under that name.&lt;br /&gt;
&lt;br /&gt;
Congratulations! you have successfully set up the basics required to make your RPG with sandbox&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
game.cfg has two explicit purposes. Firstly it identifies the existence of a game and secondly, it defines many of the important attributes of the game.&lt;br /&gt;
&lt;br /&gt;
things that can and should be defined in game.cfg include&lt;br /&gt;
* the script and flags to use on a maps&lt;br /&gt;
* internal properties, such as the game version&lt;br /&gt;
* global game properties, such as friendly fire&lt;br /&gt;
* rule properties (currently not available)&lt;br /&gt;
* the initial/default HUD&lt;br /&gt;
&lt;br /&gt;
=Part 2=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves spawning a neutral NPC and assigning him some dialogue&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We can go about this in a few ways, but we&amp;#039;ll start by first defining the NPC&amp;#039;s script, the NPC, and then creating a place for him in the world.&lt;br /&gt;
&lt;br /&gt;
First off, go to your definitions directory (probably data/rpg/games/tutorial) and then enter the script subdirectory. You will not want to create a new configuration file and place it at the very end of the others (eg, if the last is named 7.cfg, name yours 8.cfg). In this file, we define how any entities using it will react and interact with the surrounding world. Since we don&amp;#039;t want to bother with that, we will simply include the default NPC script.&lt;br /&gt;
&lt;br /&gt;
Afterwards we can start defining the dialogue. When you&amp;#039;re done the final script should look something like this. Feel free to experiment by writing more dialogue and fleshing out your character&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  include scripts/1 //includes the default NPC script&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;Hello, how are you doing&amp;quot; [ // 0 - it&amp;#039;s good practice to number your entries&lt;br /&gt;
    r_response &amp;quot;I&amp;#039;m well, yourself?&amp;quot; 1 //goes to dialogue #1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1 //closes the dialogue&lt;br /&gt;
  ]&lt;br /&gt;
  &lt;br /&gt;
  r_script_say &amp;quot;I&amp;#039;m glad to hear it&amp;quot; [ // 1&lt;br /&gt;
    r_response &amp;quot;Goodbye&amp;quot; -1&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we will now define a critter to use the script. All critter configuration options are prefixed with r_char and most contain a variant with a _get suffix for retrieving the value. Now create a new cfg file in the critter sub directory, following the same steps as you did for the script to define it&amp;#039;s name. This will probably be 0.cfg.&lt;br /&gt;
&lt;br /&gt;
Consult the configuration reference for a full list of available configuration options, for now, copy the following into critters/0.cfg&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_char_name &amp;quot;Bob&amp;quot;&lt;br /&gt;
  r_char_mdl &amp;quot;ogre&amp;quot;&lt;br /&gt;
  r_char_script 8 //make sure this corresponds with the above script&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, we need to spawn Bob, so start your game and create a critter entity that spawn a critter of type 0. Remember that F1 toggles editmode in the RPG!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  newent critter 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;re done, to test it simply exit editmode and press E while hovering the crosshair over him.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Default Scripts&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The various definition types of the RPG each default to their own individual specialized script. They correspond as follows&lt;br /&gt;
* 0 - null/empty/nothing&lt;br /&gt;
* 1 - Default critter script; primarily initiates dialogue, will in the future control AI logic and stealth abilities&lt;br /&gt;
* 2 - Default item script; mainly implements pickup&lt;br /&gt;
* 3 - Default obstacle script; does nothing&lt;br /&gt;
* 4 - Default container script; will eventually allow you to pick the lock and loot items&lt;br /&gt;
* 5 - Default platform script; does nothing&lt;br /&gt;
* 6 - Default trigger script; toggles triggered state (eg, switches door between open and close)&lt;br /&gt;
&lt;br /&gt;
Note that the player defaults to script 0, and has its script explicitly set to 7. Script 7 contains some basic player logic, mainly it lets you know when you level up.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Definition numbering&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The numbers allows the game to easily and quickly identify and order definitions, unfortunately this is inconvenient to the users since it makes identifying which definition corresponds to an item you&amp;#039;re looking for a bit of a chore. The only thing you need to remember, is that each definition must be assigned number from 0 and up and that there cannot be &amp;#039;&amp;#039;&amp;#039;any&amp;#039;&amp;#039;&amp;#039; empty gaps. Duplicate numbers (eg hex or octal) and non-number names will throw a warning.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 1.cfg  2.cfg  3.cfg  4.cfg  5.cfg&lt;br /&gt;
 # the game will abort with these files&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 0.cfg  1.cfg  2.cfg  3.cfg  4.cfg&lt;br /&gt;
 # the game will start&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Multiple dialogue entry points&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The entry point is defined by the talk signal, by default this simply opens the dialogue at position 0 should it exist. If you&amp;#039;d like to change the entry point you will have to redefine the talk signal for your entity. For example...&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_signal talk [&lt;br /&gt;
    if $cond [&lt;br /&gt;
      r_chat self 0&lt;br /&gt;
    ]&lt;br /&gt;
      r_chat self 2&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add more more conditions and variables and you are allowed the full range of cubescript commands.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Dialogue standards&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
There are no fixed standards, but we recommend the following conventions when writing dialogue for your characters.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  r_script_say &amp;quot;Things the creatures say are simply typed like this, no surrounding quotes&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;If you wish to put *emphasis* on a word, place *&amp;#039;s on both sides]&amp;quot; []&lt;br /&gt;
  r_script_say &amp;quot;[between these brackets, write what your character sees and experiences]&amp;quot; [&lt;br /&gt;
    r_response &amp;quot;[Likewise, place any actions your character takes here]&amp;quot;&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Part 3=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers basic item definitions, trigger basics and crafting.&lt;br /&gt;
&lt;br /&gt;
For this exercise we will craft papyrus sheets, we will write on these to produce our weapon in the next part. This process demands the use of a knife, a hammer and something heavy to compress it while drying. The important part is the materials that are used in the process and those that enable the process, we recommend ignoring the process itself.&lt;br /&gt;
&lt;br /&gt;
So first up, let&amp;#039;s define the ingredients, the tools we&amp;#039;re going to use and the product we&amp;#039;re going to make. If you&amp;#039;ve followed the tutorial thus far, you should still have 0 item definitions, otherwise follow the previously defined rules. Save the following in the items subdirectory. The commands and their effect should be self-explanatory&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus reed&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Freshly harvested from the Papyrus plant, the stem of these reeds have been used for centuries to create a durable writing surface.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Knife&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The blade has seen a lot of use and is missing a few chips, but remains deadly sharp.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Old Mallet&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;The mallet appears to have seen a lot of use, but remains effective for beating things.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Papyrus&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Papyrus reeds have been converted into a durable surface suitable for writing on.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we will define the recipe. A recipe has 3 lists of items, the ingredients, the catalysts and the products. Ingredients are items that are consumed in full to produce the products and catalysts are items that enable the process to happen.&lt;br /&gt;
&lt;br /&gt;
For now, copy the following to &amp;#039;&amp;#039;&amp;#039;recipes/0.cfg&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN //we know the recipe at the start&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 0 10 // 10 x papyrus reeds&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_catalyst 1 1 // 1 x knife&lt;br /&gt;
 r_recipe_add_catalyst 2 1 // 1 x hammer&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 3 1 // 1 x papyrus&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to create the final item, we simply need to spawn them into the world. If you are in a hurry to test it out, use the following commands to spawn them in the world.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent item 0 10 //skip this if you aren&amp;#039;t in a hurry&lt;br /&gt;
 newent item 1 1 //knife&lt;br /&gt;
 newent item 2 1 //hammer&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re still here, we&amp;#039;re now going to make actual harvestable papyrus plants using triggers, since we lack a suitable model we will improvise using one for reeds. First we will define a suitable script. Our trigger&amp;#039;s script will add a random amount between 1-4 reeds to the player&amp;#039;s inventory and then destroy itself. If we wanted, we could toggle a variable and change the model so it looks as though it was harvested and perhaps even respawn it after a few while of game time, but that&amp;#039;s a more advanced topic for another time. So for now, copy the following into &amp;#039;&amp;#039;&amp;#039;scripts/9.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  //papyrus reeds&lt;br /&gt;
  &lt;br /&gt;
  r_script_signal interact [&lt;br /&gt;
    // adds between 1-4 units of papyrus to whoever harvests it&lt;br /&gt;
    r_additem actor 0 (rnd 5 1) &lt;br /&gt;
    // removes itself from the stack&lt;br /&gt;
    r_destroy self&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As for the trigger itself, copy the following into &amp;#039;&amp;#039;&amp;#039;triggers/0.cfg&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_trigger_name &amp;quot;Papyrus plant&amp;quot;&lt;br /&gt;
 r_trigger_mdl &amp;quot;dcp/reed&amp;quot;&lt;br /&gt;
 r_trigger_script 9&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations, just spawn a few of those near a body of water somewhere, and you&amp;#039;ve finish this section of the tutorial. The command is of course as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 newent trigger 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Splitting the process&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The general recommendation is to try and contain the whole process in a single recipe. Rather than splitting it out into many small pieces. As a rule, try to avoid making the player learn and execute the process and let taht be handled via the character&amp;#039;s knowledge. For example, if we wanted to create stew in a more contemporary setting, the recommended recipe would be something like this.&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 3 x Potatoes&lt;br /&gt;
* 1 x Unions&lt;br /&gt;
* 5 x Carrots&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
Likewise, the strongly not recommended series of recipes may look something like this&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Potato&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced potato&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Sliced union&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Diced union&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Carrot&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Knife&lt;br /&gt;
* 1 x Cutting board&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 5 x Sliced carrot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 15 x Sliced Potatoes&lt;br /&gt;
* 25 x Diced Unions&lt;br /&gt;
* 25 x Sliced Carrots&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ingredients&lt;br /&gt;
* 1 x Uncooked Stew&lt;br /&gt;
* 1 x Butane canister&lt;br /&gt;
&lt;br /&gt;
Catalysts&lt;br /&gt;
* 1 x Portable gas cooker&lt;br /&gt;
&lt;br /&gt;
Products&lt;br /&gt;
* 1 x Pot&lt;br /&gt;
* 5 x Stew&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Skilled Craftsmen&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you want to add a recipe that depends on skills to be used, you can use the r_recipe_reqs family of variables to set them. You&amp;#039;re allowed to utilise the full family of stats and skills to define skill requirements for a recipe.&lt;br /&gt;
&lt;br /&gt;
=Part 4=&lt;br /&gt;
&lt;br /&gt;
This part covers covers particle effect definitions, status effect definitions and item usage definitions with the example of a weapon. The player will be able to craft it with the materials from the previous part.&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s dive right into it. We&amp;#039;re going to create 2 items and an additional recipe. For the first item, we need some means of writing on the papyrus we created in the previous session. The second item will be the weapon we will produce, for now we will just create a small skeleton for it. We should currently have 4 items defined, if not adjust numbers accordingly.&lt;br /&gt;
&lt;br /&gt;
4.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Ink Well&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;It is a phial of ink. Paired with a quill these are still very popular writing instruments.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;Upon this scroll of papyrus rest incantations for a magical spell.&amp;quot;&lt;br /&gt;
 r_item_mdl &amp;quot;tentus/moneybag&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next we will define the recipe to produce the weapon, we should currently only have a single recipe, adjust accordingly if this isn&amp;#039;t the case.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_recipe_flags $RECIPE_KNOWN&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_ingredient 3 1 // 1 x papyrus&lt;br /&gt;
 r_recipe_add_ingredient 4 1 // 1 x ink&lt;br /&gt;
 &lt;br /&gt;
 r_recipe_add_product 5 1 // magic arrow scroll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have to deal with the most important part to make any weapons, swords, spells or otherwise. We need a status group to do something. Zero of more status effects comprise each group, and this design decision mainly exists to accommodate spells like polymorph and their respective dispelling. The statuses sub directory should already contain a dummy group, once again, adjust the numbers as required for our own.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //heavy damage&lt;br /&gt;
 r_status_friendly 0 //this is decidedly hostile&lt;br /&gt;
 r_status_addgeneric $STATUS_HEALTH -100 0 // instantly remove 100 HP&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We currently have everything we need to define our weapon/spell, but we unfortunately won&amp;#039;t be able to see the projectile at present due to having no particle effects defined. Projectiles can have up to 3 effects, that is the projectile itself, its trail and the explosion at the end. -1 can be substituted in any of the effect slots to disable emissions for that part. We will define the following 2 effects in the effects subdirectory.&lt;br /&gt;
&lt;br /&gt;
0.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // flying arrow&lt;br /&gt;
 r_effect_mdl &amp;quot;hirato/arrow&amp;quot;&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 // purple magic sparkles&lt;br /&gt;
 r_effect_flags 0&lt;br /&gt;
 r_effect_particle $PART_STEAM&lt;br /&gt;
 r_effect_colour 0x3F003F&lt;br /&gt;
 r_effect_size  0.5&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now have everything we need to define our weapon fully as well as be able to see any of its attacks. To make the weapon usable, we need to define a use case in which it is a weapon. We have 3 possible use cases, use (eg, read, drink), armour and weapon, the last two are implemented and fully functional while the first isn&amp;#039;t. Naturally we want the weapon use case.&lt;br /&gt;
&lt;br /&gt;
So to define our weapon fully, open up items/5.cfg and add the following at the end. Generally speaking you don&amp;#039;t need to define quite as many properties, most of these are here just to be sure things work as expected.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_use_new_weapon // 0 - it&amp;#039;s good practice to number these entries&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available in consume and armour use cases as well&lt;br /&gt;
 r_item_use_name &amp;quot;Magic Arrow&amp;quot;&lt;br /&gt;
 r_item_use_description &amp;quot;An arrow is conjoured from the caster&amp;#039;s finger tip and flung at its target with sheer mental will.&amp;quot;&lt;br /&gt;
 r_item_use_cooldown 1500&lt;br /&gt;
 //increases the strength of the spell with player skill or charging&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 // adds our status effect at 30% efficiency - with the above charge flag that means 30 damge &lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_MAGIC 0.3&lt;br /&gt;
 &lt;br /&gt;
 //these slots are available with armour use cases as well&lt;br /&gt;
 r_item_use_slots $SLOT_LHAND&lt;br /&gt;
 r_item_use_skill $SKILL_MAGIC&lt;br /&gt;
 &lt;br /&gt;
 //these slots are exclusive to weapons&lt;br /&gt;
 r_item_use_pflags $P_TIME&lt;br /&gt;
 r_item_use_angle 0&lt;br /&gt;
 r_item_use_lifetime 1000&lt;br /&gt;
 r_item_use_gravity 0&lt;br /&gt;
 r_item_use_projeffect 0 //substitute with your arrow&amp;#039;s effect&lt;br /&gt;
 r_item_use_traileffect 1 //substitute with your trail&amp;#039;s effect&lt;br /&gt;
 r_item_use_deatheffect -1 //replace with a suitable EoL effect&lt;br /&gt;
 r_item_use_ammo -1 //use mana&lt;br /&gt;
 r_item_use_cost 15 //uses 15 units of mana&lt;br /&gt;
 r_item_use_kickback 10&lt;br /&gt;
 r_item_use_recoil 10&lt;br /&gt;
 r_item_use_target $T_SINGLE&lt;br /&gt;
 r_item_use_speed 1.5 // in 100&amp;#039;s of cubes a second&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! Just spawn the ink well somewhere and craft your weapon, and have some fun. In the next part we will make several mobs for you to use it against.&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Reserved ammo types&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specifying ammo 0 and above for a use case means you&amp;#039;re going to use items from the respective ammo group. In addition there are also 3 additional ammo types that occupy numbers -1, -2 and -3. they are as follows.&lt;br /&gt;
&lt;br /&gt;
* -1 - Mana&lt;br /&gt;
* -2 - Health&lt;br /&gt;
* -3 - Experience&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;$STATUS_HEALTH, $RECIPE_KNOWN, what is all this stuff!?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
These are hard coded RPG constants that are reproduced inside data/rpg/game.cfg and are usually kept in sync. We strongly recommend that you use these constants/variables as opposed to using the numbers directly, this helps ensure future compatibility and makes it easier to understand the intended effect of the definitions if updates are required.&lt;br /&gt;
&lt;br /&gt;
The file contains &amp;#039;&amp;#039;&amp;#039;all&amp;#039;&amp;#039;&amp;#039; of the various flags and numbers that are available in the RPG, so being familiar with them will be a great boon to you if you choose to use sandbox.&lt;br /&gt;
&lt;br /&gt;
=Part 5=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial covers debug settings, waypoints, and basic AI by making a hostile mob for the player to defeat. Before we even consider adding any AI or monsters, we need to canvas our map with waypoints for the AI to follow and get to the player.&lt;br /&gt;
&lt;br /&gt;
[[File:RPG_tutorial_map.jpg|200px|thumb|right|recommended layout for the first tutorial map]]&lt;br /&gt;
&lt;br /&gt;
But before we get to the waypoints, there is a more critical item to consider, we need to shelter the beast first, so that it doesn&amp;#039;t attack the player immediately, specifically so that the player has a chance to build his weapon before taking on the beast. I&amp;#039;d suggest erecting a wall behind Bob&amp;#039;s house, see the screenshot on the right for a recommended layout.&lt;br /&gt;
&lt;br /&gt;
Our second order of business is to then enable the AI debug channel so that we can see the waypoints we&amp;#039;re dropping and then to canvas the area. Considering the terrain will be mostly flat, you may wish to turn on the experimental waypointing method as well, it will speed up the process tremendously. With that said, waypointing is by far the most tedious task to do sufficiently well in the RPG.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 debug 32 //ai debug channel&lt;br /&gt;
 dropwaypoints 1 //required to drop waypoints&lt;br /&gt;
 experimentalwaypoint 1 //method that links to all nearby nodes, as opposed to tracing a path&lt;br /&gt;
 savewaypoints // saves them when you&amp;#039;re done DO NOT FORGET TO DO THIS!!!&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Our first order of business is to make a faction for our mob, at present this is only useful for querying relationships between factions as well as allowing you to hurt each other with friendly fire protection enabled. You may wish to put Bob inside his own faction as well. Copy the following as the definition for the second faction.&lt;br /&gt;
&lt;br /&gt;
1.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_faction_name &amp;quot;Beasts&amp;quot;&lt;br /&gt;
 r_faction_base 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will now define a script for our creature, we want him to attack us if he spots us as well as when we bother or attack him. The ai for now is very basic and will not try to dodge or do anything besides rush in and complete its goal (which is, to kill you). The following will be his script for now.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 //our mob&amp;#039;s script&lt;br /&gt;
 include scripts/1&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal talk [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal hit [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal update [&lt;br /&gt;
   if (r_cansee self player) [&lt;br /&gt;
     r_action_attack self player 1&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
 &lt;br /&gt;
 r_script_signal collide [&lt;br /&gt;
   if (!= (r_get_faction self) (r_get_faction actor)) [&lt;br /&gt;
     r_action_attack self actor&lt;br /&gt;
   ]&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can now define our beast, let&amp;#039;s make him a hungry and aggressive wolf&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_char_name &amp;quot;Wolf&amp;quot;&lt;br /&gt;
 r_char_mdl &amp;quot;rpg/characters/wolf&amp;quot;&lt;br /&gt;
 r_char_script 10&lt;br /&gt;
 r_char_faction 1&lt;br /&gt;
 &lt;br /&gt;
 r_char_base_maxspeed 40 //speed boost&lt;br /&gt;
 r_char_base_jumpvel 80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&amp;#039;ve now done all we need to spawn him, but he won&amp;#039;t pose any threat to us at present. For that we need to define a weapon for him and equip it. Since he&amp;#039;s a wolf, he would probably use his fangs for a short range low damage attack with little cooldown. So let&amp;#039;s define his fangs in the items directory with those properties.&lt;br /&gt;
&lt;br /&gt;
6.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_item_name &amp;quot;Fangs&amp;quot;&lt;br /&gt;
 r_item_description &amp;quot;If you see this, submit a bug report.&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_new_weapon // 0&lt;br /&gt;
 r_item_use_cooldown 100&lt;br /&gt;
 r_item_use_chargeflags $CHARGE_MAG&lt;br /&gt;
 r_item_use_new_status 1 $ATTACK_SLASH .075&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_slots (| $SLOT_LHAND $SLOT_RHAND)&lt;br /&gt;
 r_item_use_skill $SKILL_MELEE&lt;br /&gt;
 &lt;br /&gt;
 r_item_use_range 4&lt;br /&gt;
 r_item_use_angle 8 //degrees&lt;br /&gt;
 r_item_use_lifetime 0&lt;br /&gt;
 r_item_use_cost 0&lt;br /&gt;
 r_item_use_target $T_HORIZ&lt;br /&gt;
 r_item_use_recoil -10&lt;br /&gt;
 r_item_use_projeffect -1&lt;br /&gt;
 r_item_use_traileffect -1&lt;br /&gt;
 r_item_use_deatheffect -1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With that taken care of, we now need to spawn him with the item and equip them. In spite of how wolves normally attack, this will be equipped on his &amp;quot;paws&amp;quot;. So open up his script and append the following onto the end. Also, we will place a &amp;#039;&amp;#039;&amp;#039;location entity&amp;#039;&amp;#039;&amp;#039; somewhere in the map near the wolf, he will wander around near it until he spots the player.&lt;br /&gt;
&lt;br /&gt;
10.cfg&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 r_script_signal spawn [&lt;br /&gt;
   r_action_wander self 0 96 0&lt;br /&gt;
   r_additem self 6 1&lt;br /&gt;
   r_equip self 6 0&lt;br /&gt;
 ]&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Addendum==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Debug flags&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The debug variable is a set of flags, you can toggle most of them from the options menu under the game tab, but here they are, reproduced in full.&lt;br /&gt;
&lt;br /&gt;
* 1 - World - draws misc information on the HUD and prints some information on the map stack&lt;br /&gt;
* 2 - Entity - draws entity pointers above head and prints when more are spawned and destroyed as well as their deaths and a few other things&lt;br /&gt;
* 4 - Configuration - prints what various properties were set to when loading definitions&lt;br /&gt;
* 8 - Projectiles - prints hit testing details and renders a pointer string over the projectile&lt;br /&gt;
* 16 - Script - informs you of most executed commands and any sent and received signals (when verbose)&lt;br /&gt;
* 32 - AI - draws waypoints and pritns any received commands&lt;br /&gt;
* 64 - I/O mainly lets you know what is being read from savegames&lt;br /&gt;
* 128 - Camera, draws cutscene information on the HUD&lt;br /&gt;
* 256 - Verbose, makes the rest spammier&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Particles are everywhere!&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;re being overwhelmed by particles from rendering the waypoints, whether that involves them flickering, or simply bringing performance to a crawl, you can use &amp;#039;&amp;#039;&amp;#039;maxparticledistance&amp;#039;&amp;#039;&amp;#039; to adjust the draw distance, just don&amp;#039;t forget to take note of its original value and change it back afterwards&lt;br /&gt;
&lt;br /&gt;
=Part 6=&lt;br /&gt;
&lt;br /&gt;
This section of the tutorial involves creating a fetch quest, mapflags and teleports&lt;br /&gt;
&lt;br /&gt;
=Part 7=&lt;br /&gt;
&lt;br /&gt;
This part of the tutorial involves the creation of a basic puzzle to open a door as well as overriding the HUD&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	<entry>
		<id>https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_todo&amp;diff=1464</id>
		<title>RPG todo</title>
		<link rel="alternate" type="text/html" href="https://www.sandboxgamemaker.com/wiki/index.php?title=RPG_todo&amp;diff=1464"/>
				<updated>2011-10-06T09:42:07Z</updated>
		
		<summary type="html">&lt;p&gt;Hirato: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Script=&lt;br /&gt;
* Timers&lt;br /&gt;
** copy reference table&lt;br /&gt;
** countdown to 0 before executing.&lt;br /&gt;
** update every frame, but execute only outside of cutscenes.&lt;br /&gt;
&lt;br /&gt;
=Gameplay=&lt;br /&gt;
* hotkeys&lt;br /&gt;
* special item properties&lt;br /&gt;
** money (constant value for all purposes)&lt;br /&gt;
** cursed status&lt;br /&gt;
** unidentified status&lt;br /&gt;
*** hide true power or make it a lot less useful?&lt;br /&gt;
* (maybe?) character generation&lt;br /&gt;
* looting and trading... hardcode references &amp;quot;loot&amp;quot; and &amp;quot;trade&amp;quot;?&lt;br /&gt;
* sneaking/stealth&lt;br /&gt;
** light and visibility&lt;br /&gt;
** silhouettes and light levels?&lt;br /&gt;
** stealing&lt;br /&gt;
* proper friendly fire protection&lt;br /&gt;
** 0 - no protection (default)&lt;br /&gt;
** 1 - prevents you from hurting yourself&lt;br /&gt;
** 2 - 1 + prevents you from hurting allies&lt;br /&gt;
** 3 - allows injury to hostile characters only&lt;br /&gt;
* spell types&lt;br /&gt;
** movement (paralysis counters)&lt;br /&gt;
** vocal (silence counters)&lt;br /&gt;
&lt;br /&gt;
=Logic=&lt;br /&gt;
* the consume use case for books and potions.&lt;br /&gt;
* statusgroups on items&lt;br /&gt;
** temporary spells that alters the properties of the weapon&lt;br /&gt;
** multiple at once with different targets.&lt;br /&gt;
* temporary spell effects for wielded items, &lt;br /&gt;
** multiple status effects on a single use, separate chargeflags, multiplier, duration and element.&lt;br /&gt;
** make sure to use each for the right purpose&lt;br /&gt;
* Projectiles&lt;br /&gt;
** improve ricochet, gravity related stuff is funky&lt;br /&gt;
* target types&lt;br /&gt;
** cone&lt;br /&gt;
** self-area/multi&lt;br /&gt;
* status types&lt;br /&gt;
** dispel - should work on individual effects&lt;br /&gt;
** silence&lt;br /&gt;
** paralysis/stun&lt;br /&gt;
* Expose a tonne of constants to Cubescript for configuration at the game maker&amp;#039;s discretion. These include leveling and power curves&lt;br /&gt;
&lt;br /&gt;
=GUI=&lt;br /&gt;
* inventory&lt;br /&gt;
** item examination&lt;br /&gt;
* status effects&lt;br /&gt;
* trade &lt;br /&gt;
* stats&lt;br /&gt;
* crafting&lt;br /&gt;
* journal&lt;br /&gt;
* newui variants&lt;br /&gt;
&lt;br /&gt;
=Recipes=&lt;br /&gt;
* (maybe) allow in game apparatuses to act as a catalyst&lt;br /&gt;
** (maybe) several catalysts and ingredients list? or just duplicate and alter the recipe?&lt;br /&gt;
&lt;br /&gt;
=AI=&lt;br /&gt;
* queued prioritised actions&lt;br /&gt;
** most important done first&lt;br /&gt;
** multitasking&lt;br /&gt;
* waypoints&lt;br /&gt;
** randomness&lt;br /&gt;
** state - don&amp;#039;t favour waypoints which are in use&lt;br /&gt;
* ai tags&lt;br /&gt;
** identify purpose and effect of entities in game world for the AI (parsing the script for these is simply not practical)&lt;br /&gt;
*** alternatively use simpler more specific types, such as &amp;quot;door&amp;quot;, &amp;quot;container&amp;quot;, &amp;quot;portal&amp;quot; and &amp;quot;mover&amp;quot; as opposed to a singular &amp;quot;object&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=Cutscenes=&lt;br /&gt;
* create a cutscene variant which can&amp;#039;t be skippped (maybe)&lt;br /&gt;
* some sort of skipping bar (1000 ms?) to prevent accidental skips&lt;br /&gt;
&lt;br /&gt;
=Renderer=&lt;br /&gt;
* particles for active spell effects&lt;br /&gt;
* render attachments/equipment&lt;br /&gt;
* animations for weapons&lt;br /&gt;
** generic animations, unarmed strike, melee strike, bow shoot, gun shoot, etc&lt;br /&gt;
&lt;br /&gt;
=Journal=&lt;br /&gt;
* quests&lt;br /&gt;
* log entries&lt;br /&gt;
* sorting and filters&lt;br /&gt;
&lt;br /&gt;
=Sound=&lt;br /&gt;
* sounds while charging spells&lt;br /&gt;
* sounds for projectile firing, travel and death&lt;br /&gt;
* sounds for active statusgroups&lt;br /&gt;
* (maybe) voiced dialogue&lt;br /&gt;
&lt;br /&gt;
=I/O=&lt;br /&gt;
* flat file export of current script/data definitions (maybe)&lt;br /&gt;
** couple with ingame menus for realtime modification (maybe)&lt;br /&gt;
* better range checks and protection&lt;br /&gt;
* save and restore AI directives&lt;br /&gt;
&lt;br /&gt;
=Particles=&lt;br /&gt;
* set particle effects for entity afflicted status effects&lt;br /&gt;
* vary spawned amount of particles depending on distance (few when close, full amount when far away)&lt;br /&gt;
* explicit variable for setting waypoint drawing distance&lt;/div&gt;</summary>
		<author><name>Hirato</name></author>	</entry>

	</feed>