<li><p>The <aclass="reference internal"href="../Components/Accounts.html"><spanclass="doc std std-doc">Account</span></a> represents the real person logging in and has no game-world existence.</p></li>
<li><p>Any <aclass="reference internal"href="../Components/Objects.html"><spanclass="doc std std-doc">Object</span></a> can be puppeted by an Account (with proper permissions).</p></li>
<li><p><aclass="reference internal"href="../Components/Objects.html#characters"><spanclass="std std-doc">Characters</span></a>, <aclass="reference internal"href="../Components/Objects.html#rooms"><spanclass="std std-doc">Rooms</span></a>, and <aclass="reference internal"href="../Components/Objects.html#exits"><spanclass="std std-doc">Exits</span></a> are just
<p>In Evennia, using the <codeclass="docutils literal notranslate"><spanclass="pre">@ic</span></code> command will allow you to puppet a given Object (assuming you have
puppet-access to do so). As mentioned above, the bog-standard Character class is in fact like any
Object: it is auto-puppeted when logging in and just has a command set on it containing the normal
in-game commands, like look, inventory, get and so on.</p>
<div><p>(But, you ask, where did that <codeclass="docutils literal notranslate"><spanclass="pre">@ic</span></code> command come from, if the mech had no commands on it? The
answer is that it came from the Account’s command set. This is important. Without the Account being
the one with the <codeclass="docutils literal notranslate"><spanclass="pre">@ic</span></code> command, we would not have been able to get back out of our mech again.)</p>
<divclass="highlight-python notranslate"><divclass="highlight"><pre><span></span><spanclass="c1"># in a new file mygame/commands/mechcommands.py</span>
<spanclass="sa">f</span><spanclass="s2">"BOOM! The mech fires its gun at </span><spanclass="si">{</span><spanclass="n">target</span><spanclass="o">.</span><spanclass="n">key</span><spanclass="si">}</span><spanclass="s2">"</span>
<p>This is saved as a normal Python module (let’s call it <codeclass="docutils literal notranslate"><spanclass="pre">mechcommands.py</span></code>), in a place Evennia looks
for such modules (<codeclass="docutils literal notranslate"><spanclass="pre">mygame/commands/</span></code>). This command will trigger when the player gives the command
“shoot”, “fire,” or even “fire!” with an exclamation mark. The mech can shoot in the air or at a
target if you give one. In a real game the gun would probably be given a chance to hit and give
damage to the target, but this is enough for now.</p>
<p>We also make a second command for launching missiles (<codeclass="docutils literal notranslate"><spanclass="pre">CmdLaunch</span></code>). To save
space we won’t describe it here; it looks the same except it returns a text
about the missiles being fired and has different <codeclass="docutils literal notranslate"><spanclass="pre">key</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">aliases</span></code>. We leave
that up to you to create as an exercise. You could have it print “WOOSH! The
mech launches missiles against <target>!”, for example.</p>
<p>Now we shove our commands into a command set. A <aclass="reference internal"href="../Components/Command-Sets.html"><spanclass="doc std std-doc">Command Set</span></a> (CmdSet) is a container
<divclass="highlight-python notranslate"><divclass="highlight"><pre><span></span><spanclass="c1"># in the same file mygame/commands/mechcommands.py</span>
<p>There we go, one functioning mech. Try your own <codeclass="docutils literal notranslate"><spanclass="pre">launch</span></code> command and see that it works too. We can
not only walk around as the mech — since the CharacterCmdSet is included in our MechCmdSet, the mech
can also do everything a Character could do, like look around, pick up stuff, and have an inventory.
We could now shoot the gun at a target or try the missile launch command. Once you have your own
<p>A <aclass="reference internal"href="../Components/Typeclasses.html"><spanclass="doc std std-doc">Typeclass</span></a> is a near-normal Python class that stores its existence to the database
<spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">db</span><spanclass="o">.</span><spanclass="n">desc</span><spanclass="o">=</span><spanclass="s2">"This is a huge mech. It has missiles and stuff."</span>
<p>For convenience we include the full contents of the default <codeclass="docutils literal notranslate"><spanclass="pre">CharacterCmdSet</span></code> in there. This will
make a Character’s normal commands available to the mech. We also add the mech-commands from before,
making sure they are stored persistently in the database. The locks specify that anyone can puppet
the meck and no-one can “call” the mech’s Commands from ‘outside’ it - you have to puppet it to be
able to shoot.</p>
<p>That’s it. When Objects of this type are created, they will always start out with the mech’s command
set and the correct lock. We set a default description, but you would probably change this with
<codeclass="docutils literal notranslate"><spanclass="pre">@desc</span></code> to individualize your mechs as you build them.</p>
<p>Back in the game, just exit the old mech (<codeclass="docutils literal notranslate"><spanclass="pre">@ic</span></code> back to your old character) then do</p>
<p>We create a new, bigger mech with an alias bigmech. Note how we give the python-path to our
Typeclass at the end — this tells Evennia to create the new object based on that class (we don’t
have to give the full path in our game dir <codeclass="docutils literal notranslate"><spanclass="pre">typeclasses.mech.Mech</span></code> because Evennia knows to look in
the <codeclass="docutils literal notranslate"><spanclass="pre">typeclasses</span></code> folder already). A shining new mech will appear in the room! Just use</p>
<p>To expand on this you could add more commands to the mech and remove others. Maybe the mech
shouldn’t work just like a Character after all. Maybe it makes loud noises every time it passes from
room to room. Maybe it cannot pick up things without crushing them. Maybe it needs fuel, ammo and
repairs. Maybe you’ll lock it down so it can only be puppeted by emo teenagers.</p>
<p>Having you puppet the mech-object directly is also just one way to implement a giant mech in
Evennia.</p>
<p>For example, you could instead picture a mech as a “vehicle” that you “enter” as your normal
Character (since any Object can move inside another). In that case the “insides” of the mech Object
could be the “cockpit”. The cockpit would have the <codeclass="docutils literal notranslate"><spanclass="pre">MechCommandSet</span></code> stored on itself and all the
shooting goodness would be made available to you only when you enter it.</p>