<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.heroesofhammerwatch.com/index.php?action=history&amp;feed=atom&amp;title=Classmaps</id>
	<title>Classmaps - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.heroesofhammerwatch.com/index.php?action=history&amp;feed=atom&amp;title=Classmaps"/>
	<link rel="alternate" type="text/html" href="https://wiki.heroesofhammerwatch.com/index.php?title=Classmaps&amp;action=history"/>
	<updated>2026-08-09T12:51:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.heroesofhammerwatch.com/index.php?title=Classmaps&amp;diff=1688&amp;oldid=prev</id>
		<title>Miss at 12:41, 15 March 2019</title>
		<link rel="alternate" type="text/html" href="https://wiki.heroesofhammerwatch.com/index.php?title=Classmaps&amp;diff=1688&amp;oldid=prev"/>
		<updated>2019-03-15T12:41:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:41, 15 March 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l30&quot; &gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      // function here:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      // function here:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      //&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      //&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      //   Player::Damage(dmg, pos, dir);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      //   &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;return &lt;/ins&gt;Player::Damage(dmg, pos, dir);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      return 0;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      return 0;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key hohmediawiki?h35303030a2ab-hiwrfuej_:diff::1.12:old-1687:rev-1688 --&gt;
&lt;/table&gt;</summary>
		<author><name>Miss</name></author>
	</entry>
	<entry>
		<id>https://wiki.heroesofhammerwatch.com/index.php?title=Classmaps&amp;diff=1687&amp;oldid=prev</id>
		<title>Miss: Created page with &quot;Classmaps can be used by mods to hook into class instantiation from scripts and engine by dynamically changing the type of the class that is being instantiated. This means tha...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.heroesofhammerwatch.com/index.php?title=Classmaps&amp;diff=1687&amp;oldid=prev"/>
		<updated>2019-03-15T12:35:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Classmaps can be used by mods to hook into class instantiation from scripts and engine by dynamically changing the type of the class that is being instantiated. This means tha...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Classmaps can be used by mods to hook into class instantiation from scripts and engine by dynamically changing the type of the class that is being instantiated. This means that certain classes can be inherited from with your own code, potentially having to avoid overwriting a file.&lt;br /&gt;
&lt;br /&gt;
Definitions for classmaps exist within [[info.xml]], and range from 3 different types of mappings:&lt;br /&gt;
&lt;br /&gt;
* Behaviors: Classes that are used as behaviors on units, such as &amp;lt;code&amp;gt;Player&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CompositeActorBehavior&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Pickup&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
* Gamemodes: Classes that are gamemodes, such as &amp;lt;code&amp;gt;RandomLevel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Town&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BossLevel&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
* Scripts: Classes instantiated in scripts via &amp;lt;code&amp;gt;InstantiateClass&amp;lt;/code&amp;gt;, such as modifiers, actions, effects, movements, skills, upgrades, shops, interfaces, etc.&lt;br /&gt;
&lt;br /&gt;
You define a mapping by providing 2 class names, a &amp;quot;from&amp;quot; name and a &amp;quot;to&amp;quot; name. For example, to map the &amp;lt;code&amp;gt;Player&amp;lt;/code&amp;gt; class to your own &amp;lt;code&amp;gt;MyPlayer&amp;lt;/code&amp;gt; class, you would put this in your info.xml file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;dict name=&amp;quot;classmaps&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;array name=&amp;quot;behaviors&amp;quot;&amp;gt;&lt;br /&gt;
     &amp;lt;array&amp;gt;&amp;lt;string&amp;gt;Player&amp;lt;/string&amp;gt;&amp;lt;string&amp;gt;MyPlayer&amp;lt;/string&amp;gt;&amp;lt;/array&amp;gt;&lt;br /&gt;
   &amp;lt;/array&amp;gt;&lt;br /&gt;
 &amp;lt;/dict&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We use the &amp;lt;code&amp;gt;behaviors&amp;lt;/code&amp;gt; mapping here because &amp;lt;code&amp;gt;Player&amp;lt;/code&amp;gt; is a unit behavior. Typically, when you make class mappings, you'll want to inherit from the original class in order to change or add code. For example, in the above example of the custom player class, we can make the player never take any damage by overriding the Damage function:&lt;br /&gt;
&lt;br /&gt;
 class MyPlayer : Player&lt;br /&gt;
 {&lt;br /&gt;
   MyPlayer(UnitPtr unit, SValue&amp;amp; params)&lt;br /&gt;
   {&lt;br /&gt;
     super(unit, params);&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   int Damage(DamageInfo dmg, vec2 pos, vec2 dir) override&lt;br /&gt;
   {&lt;br /&gt;
     // Just return 0! If we did want to do damage and just&lt;br /&gt;
     // wanted to use this as a hook, we could call the base&lt;br /&gt;
     // function here:&lt;br /&gt;
     //&lt;br /&gt;
     //   Player::Damage(dmg, pos, dir);&lt;br /&gt;
 &lt;br /&gt;
     return 0;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Note that the constructor there is required (as well as the super call inside of it) in order for the class to properly be instantiated.&lt;/div&gt;</summary>
		<author><name>Miss</name></author>
	</entry>
</feed>