<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://te4.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=StarKeep</id>
		<title>Tales of Maj'Eyal - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://te4.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=StarKeep"/>
		<link rel="alternate" type="text/html" href="https://te4.org/wiki/Special:Contributions/StarKeep"/>
		<updated>2026-05-26T01:38:04Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12608</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12608"/>
				<updated>2016-09-18T19:28:07Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: Finishing touches. (Changing all uses of 'self' to easier to understand alternatives.)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;Callbacks allow you to execute a batch of code at certain points of the game. Such as when you're healed, when you're taking damage, or when you've moved.&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Callbacks can be used in Talents, Timed Effects, or Items. &lt;br /&gt;
Callbacks only happen if;&lt;br /&gt;
&lt;br /&gt;
An Actor has the Talent learnt, if its an Active or Passive.&lt;br /&gt;
&lt;br /&gt;
An Actor has the Talent sustained, if its a Sustain.&lt;br /&gt;
&lt;br /&gt;
An Actor has the Timed Effect on them.&lt;br /&gt;
&lt;br /&gt;
An Actor has the item equipped.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent, timed effect, or item like you would any function.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after your first two arguments.&lt;br /&gt;
&lt;br /&gt;
Talent callbacks use (self, t)&lt;br /&gt;
&lt;br /&gt;
Timed Effect callbacks use (self, eff)&lt;br /&gt;
&lt;br /&gt;
Item callbacks use (self, who)&lt;br /&gt;
&lt;br /&gt;
In the case of Item callbacks, 'self' refers to the item itself, while 'who' refers to the actor wearing said item.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Provided below is a simple example of a Talent callback.&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
 &lt;br /&gt;
However, converting this into an Item callback is slightly more tricky. First you must change 't' to 'who' (which is the actor wearing the item). You would than need to change all references to 'self' in the code to 'who' to achive the same effect, as 'self' now refers to the item this callback is attached to.&lt;br /&gt;
&lt;br /&gt;
                      callbackOnMeleeAttack = function(self, who, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               who:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, target, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
target(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(summon, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;summon(our summon)&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who we killed)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who hit us?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who failed to hit us?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This callback expects you to return a table. For our example's case, our table will be called 'data'.&lt;br /&gt;
&lt;br /&gt;
You may return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
If stopped is a numerical value, the damage dealt will be set to this value before stopping.&lt;br /&gt;
&lt;br /&gt;
stopped has a higher priority than dam, and dam will not directly impact stopped.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12607</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12607"/>
				<updated>2016-09-18T19:22:38Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: Spacing.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;Callbacks allow you to execute a batch of code at certain points of the game. Such as when you're healed, when you're taking damage, or when you've moved.&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Callbacks can be used in Talents, Timed Effects, or Items. &lt;br /&gt;
Callbacks only happen if;&lt;br /&gt;
&lt;br /&gt;
An Actor has the Talent learnt, if its an Active or Passive.&lt;br /&gt;
&lt;br /&gt;
An Actor has the Talent sustained, if its a Sustain.&lt;br /&gt;
&lt;br /&gt;
An Actor has the Timed Effect on them.&lt;br /&gt;
&lt;br /&gt;
An Actor has the item equipped.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent, timed effect, or item like you would any function.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after your first two arguments.&lt;br /&gt;
&lt;br /&gt;
Talent callbacks use (self, t)&lt;br /&gt;
&lt;br /&gt;
Timed Effect callbacks use (self, eff)&lt;br /&gt;
&lt;br /&gt;
Item callbacks use (self, who)&lt;br /&gt;
&lt;br /&gt;
In the case of Item callbacks, 'self' refers to the item itself, while 'who' refers to the actor wearing said item.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Provided below is a simple example of a Talent callback.&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
 &lt;br /&gt;
However, converting this into an Item callback is slightly more tricky. First you must change 't' to 'who' (which is the actor wearing the item). You would than need to change all references to 'self' in the code to 'who' to achive the same effect, as 'self' now refers to the item this callback is attached to.&lt;br /&gt;
&lt;br /&gt;
                      callbackOnMeleeAttack = function(self, who, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               who:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(summon, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;summon(our summon)&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who we killed)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This callback expects you to return a table. For our example's case, our table will be called 'data'.&lt;br /&gt;
&lt;br /&gt;
You may return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
If stopped is a numerical value, the damage dealt will be set to this value before stopping.&lt;br /&gt;
&lt;br /&gt;
stopped has a higher priority than dam, and dam will not directly impact stopped.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12606</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12606"/>
				<updated>2016-09-18T19:21:46Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;Callbacks allow you to execute a batch of code at certain points of the game. Such as when you're healed, when you're taking damage, or when you've moved.&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Callbacks can be used in Talents, Timed Effects, or Items. &lt;br /&gt;
Callbacks only happen if;&lt;br /&gt;
An Actor has the Talent learnt, if its an Active or Passive.&lt;br /&gt;
An Actor has the Talent sustained, if its a Sustain.&lt;br /&gt;
An Actor has the Timed Effect on them.&lt;br /&gt;
An Actor has the item equipped.&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent, timed effect, or item like you would any function.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after your first two arguments.&lt;br /&gt;
&lt;br /&gt;
Talent callbacks use (self, t)&lt;br /&gt;
&lt;br /&gt;
Timed Effect callbacks use (self, eff)&lt;br /&gt;
&lt;br /&gt;
Item callbacks use (self, who)&lt;br /&gt;
&lt;br /&gt;
In the case of Item callbacks, 'self' refers to the item itself, while 'who' refers to the actor wearing said item.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Provided below is a simple example of a Talent callback.&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
 &lt;br /&gt;
However, converting this into an Item callback is slightly more tricky. First you must change 't' to 'who' (which is the actor wearing the item). You would than need to change all references to 'self' in the code to 'who' to achive the same effect, as 'self' now refers to the item this callback is attached to.&lt;br /&gt;
&lt;br /&gt;
                      callbackOnMeleeAttack = function(self, who, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               who:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(summon, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;summon(our summon)&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who we killed)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This callback expects you to return a table. For our example's case, our table will be called 'data'.&lt;br /&gt;
&lt;br /&gt;
You may return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
If stopped is a numerical value, the damage dealt will be set to this value before stopping.&lt;br /&gt;
&lt;br /&gt;
stopped has a higher priority than dam, and dam will not directly impact stopped.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12605</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12605"/>
				<updated>2016-09-18T19:18:55Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;Callbacks allow you to execute a batch of code at certain points of the game. Such as when you're healed, when you're taking damage, or when you've moved.&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Callbacks can be used in Talents, Timed Effects, or Items. &lt;br /&gt;
Callbacks only happen if an Actor has the Talent learnt, the Timed Effect on them, or the Item equipped.&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent, timed effect, or item like you would any function.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after your first two arguments.&lt;br /&gt;
&lt;br /&gt;
Talent callbacks use (self, t)&lt;br /&gt;
&lt;br /&gt;
Timed Effect callbacks use (self, eff)&lt;br /&gt;
&lt;br /&gt;
Item callbacks use (self, who)&lt;br /&gt;
&lt;br /&gt;
In the case of Item callbacks, 'self' refers to the item itself, while 'who' refers to the actor wearing said item.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Provided below is a simple example of a Talent callback.&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
 &lt;br /&gt;
However, converting this into an Item callback is slightly more tricky. First you must change 't' to 'who' (which is the actor wearing the item). You would than need to change all references to 'self' in the code to 'who' to achive the same effect, as 'self' now refers to the item this callback is attached to.&lt;br /&gt;
&lt;br /&gt;
                      callbackOnMeleeAttack = function(self, who, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               who:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(summon, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;summon(our summon)&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who we killed)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This callback expects you to return a table. For our example's case, our table will be called 'data'.&lt;br /&gt;
&lt;br /&gt;
You may return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
If stopped is a numerical value, the damage dealt will be set to this value before stopping.&lt;br /&gt;
&lt;br /&gt;
stopped has a higher priority than dam, and dam will not directly impact stopped.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12316</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12316"/>
				<updated>2016-07-27T08:54:32Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: Spruced up the Summary; Added more information about Item Callbacks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;Callbacks allow you to execute a batch of code at certain points of the game. Such as when you're healed, when you're taking damage, or when you've moved.&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Callbacks can be used in Talents, Timed Effects, or Items. &lt;br /&gt;
Callbacks only happen if an Actor has the Talent learnt, the Timed Effect on them, or the Item equipped.&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent, timed effect, or item like you would any function.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after your first two arguments.&lt;br /&gt;
&lt;br /&gt;
Talent callbacks use (self, t)&lt;br /&gt;
&lt;br /&gt;
Timed Effect callbacks use (self, eff)&lt;br /&gt;
&lt;br /&gt;
Item callbacks use (self, who)&lt;br /&gt;
&lt;br /&gt;
In the case of Item callbacks, 'self' refers to the item itself, while 'who' refers to the actor wearing said item.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Provided below is a simple example of a Talent callback.&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
 &lt;br /&gt;
However, converting this into an Item callback is slightly more tricky. First you must change 't' to 'who' (which is the actor wearing the item). You would than need to change all references to 'self' in the code to 'who' to achive the same effect, as 'self' now refers to the item this callback is attached to.&lt;br /&gt;
&lt;br /&gt;
                      callbackOnMeleeAttack = function(self, who, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               who:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(self, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to your summon. Do not confuse this with your actual self.&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(self, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to who died. Do not confuse this with your actual, living, self.&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This callback expects you to return a table. For our example's case, our table will be called 'data'.&lt;br /&gt;
&lt;br /&gt;
You may return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
If stopped is a numerical value, the damage dealt will be set to this value before stopping.&lt;br /&gt;
&lt;br /&gt;
stopped has a higher priority than dam, and dam will not directly impact stopped.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12294</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12294"/>
				<updated>2016-07-08T00:12:27Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: Common sense fixes.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A quick description of Callbacks, from a person who knows nothing:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;They are like Superloads or Hooks, but more focused.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent (or timed_effect) just like you would anything else.&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after the normal (self, t) or (self, eff).&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
 You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(self, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to your summon. Do not confuse this with your actual self.&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(self, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to who died. Do not confuse this with your actual, living, self.&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This callback expects you to return a table. For our example's case, our table will be called 'data'.&lt;br /&gt;
&lt;br /&gt;
You may return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
If stopped is a numerical value, the damage dealt will be set to this value before stopping.&lt;br /&gt;
&lt;br /&gt;
stopped has a higher priority than dam, and dam will not directly impact stopped.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12293</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12293"/>
				<updated>2016-07-07T23:57:06Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: Undo revision 12292 by StarKeep (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A quick description of Callbacks, from a person who knows nothing:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;They are like Superloads or Hooks, but more focused.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent (or timed_effect) just like you would anything else.&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after the normal (self, t) or (self, eff).&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
 You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(self, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to your summon. Do not confuse this with your actual self.&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(self, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to who died. Do not confuse this with your actual, living, self.&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: You can return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12292</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12292"/>
				<updated>2016-07-07T23:52:02Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: Clarifications and fixes for callbackOnTakeDamage.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A quick description of Callbacks, from a person who knows nothing:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;They are like Superloads or Hooks, but more focused.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent (or timed_effect) just like you would anything else.&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after the normal (self, t) or (self, eff).&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
 You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(self, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to your summon. Do not confuse this with your actual self.&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(self, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to who died. Do not confuse this with your actual, living, self.&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: You can return either dam or stopped. dam will behave just like you were passing the damage on, while stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
If stopped is a numerical value, the damage dealt will be set to this value before stopping.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=12291</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=12291"/>
				<updated>2016-07-06T20:58:31Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: Fixed argument order in callbackOnMeleeMiss and callbackOnMeleeHit.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A quick description of Callbacks, from a person who knows nothing:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;They are like Superloads or Hooks, but more focused.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent (or timed_effect) just like you would anything else.&lt;br /&gt;
If the Callback has additional arguments, add them onto the end, after the normal (self, t) or (self, eff).&lt;br /&gt;
&lt;br /&gt;
           e.g.     callbackOnMeleeAttack = function(self, t, target, hitted, crit, weapon, damtype, mult, dam) &lt;br /&gt;
                          if hitted and crit then&lt;br /&gt;
                               self:heal(dam/2) &lt;br /&gt;
                          end&lt;br /&gt;
                      end,&lt;br /&gt;
 &lt;br /&gt;
The result of this particular callback is that you would heal yourself for half the damage dealt every time you land a melee attack that crits. &lt;br /&gt;
 You could use the same callback in an effect by replacing 't' (which represents the talent making the call) with 'eff' (which represents the effect making the call).&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(was a move completed? this can be tricky; we may technically 'move' and still be in the same spot)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to, or tried to move to (i.e. if we bump into a wall this will be the x and y of the wall)&lt;br /&gt;
&lt;br /&gt;
*Note* If you want the callback to check if the actor actually moved from one tile to another, make sure you include an if statement that compares the starting location (ox and oy) to the actor's location (self.x and self.y).&lt;br /&gt;
Something like:  ...if not (self.x == ox and self.y == oy) then...&lt;br /&gt;
&amp;lt;/small&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(self, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to your summon. Do not confuse this with your actual self.&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(self, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to who died. Do not confuse this with your actual, living, self.&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam( damage dealt by the attack)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(target, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: target in this case is the enemy making the attack, not the attack's target (which would be you).&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: You can return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=9807</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=9807"/>
				<updated>2015-10-09T03:14:22Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A quick description of Callbacks, from a person who knows nothing:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;They are like Superloads or Hooks, but more focused.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent (or timed_effect) just like you would anything else.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguements, add them onto the end, after the normal (self, t) or (self, eff).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(did we actually move?)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(self, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to your summon. Do not confuse this with your actual self.&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(self, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to who died. Do not confuse this with your actual, living, self.&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(self, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was attacking you. Do not confuse this with yourself.&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(self, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was attacking you. Do not confuse this with yourself.&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(type, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: type refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: You can return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Addons&amp;diff=9763</id>
		<title>Addons</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Addons&amp;diff=9763"/>
				<updated>2015-08-11T06:57:43Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: /* Grammar and Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development]][[Category:Addons]]&lt;br /&gt;
Addons are way for third parties to modify existing modules inside t-engine. Since the game Tales of Maj'Eyal is a t-engine module, this is how you write addons for ToME, just like the ones in the Steam Workshop.&lt;br /&gt;
&lt;br /&gt;
==Intro==&lt;br /&gt;
&lt;br /&gt;
You're making an addon. The addon is named &amp;quot;coolstuff&amp;quot;. The first thing you do is make a directory &amp;quot;tome-coolstuff&amp;quot; inside your Steam install of ToME. On my mac, that path is:&lt;br /&gt;
 ~/Library/Application Support/Steam/SteamApps/common/TalesMajEyal/game/addons/&lt;br /&gt;
&lt;br /&gt;
And on Windows, it's usually something like&lt;br /&gt;
 C:\Program Files (x86)\Steam\SteamApps\common\TalesMajEyal\game\addons&lt;br /&gt;
&lt;br /&gt;
On Linux, the path is&lt;br /&gt;
 ~/.steam/steam/SteamApps/common/TalesMajEyal/game/addons&lt;br /&gt;
&lt;br /&gt;
Your addons directory should have these files in it already:&lt;br /&gt;
 tome-addon-dev.teaa&lt;br /&gt;
 tome-items-vault.teaa&lt;br /&gt;
 tome-stone-wardens.teaa&lt;br /&gt;
&lt;br /&gt;
If you can't find the directory, search for one of those file names.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
&lt;br /&gt;
Every addon has an &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file. The &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file looks like this:&lt;br /&gt;
&lt;br /&gt;
 -- My Cool Addon&lt;br /&gt;
 -- tome-coolstuff/init.lua&lt;br /&gt;
 &lt;br /&gt;
 long_name = &amp;quot;My Awesome Addon&amp;quot;&lt;br /&gt;
 short_name = &amp;quot;coolstuff&amp;quot; -- Determins the name of your addon's file.&lt;br /&gt;
 for_module = &amp;quot;tome&amp;quot;&lt;br /&gt;
 version = { 1, 3, 1 }&lt;br /&gt;
 addon_version = { 1, 0, 0 }&lt;br /&gt;
 weight = 100 -- The lower this value, the sooner your addon will load.&lt;br /&gt;
 author = { 'coolguy@invalid.com' }&lt;br /&gt;
 homepage = 'iamsocool.geocities.com'&lt;br /&gt;
 description = [[Oh my god this stuff is so totally cool.&lt;br /&gt;
 Holy crap I mean it's really super cool, like, wow.&lt;br /&gt;
 ]] -- the [[ ]] things are like quote marks that can span multiple lines&lt;br /&gt;
 tags = {'cool', &amp;quot;stuff&amp;quot;, 'cool stuff'} -- tags MUST immediately follow description&lt;br /&gt;
 &lt;br /&gt;
 hooks = true&lt;br /&gt;
 overload = true&lt;br /&gt;
 superload = false&lt;br /&gt;
 data = true&lt;br /&gt;
&lt;br /&gt;
Those last four are super important, because they determine what directories in your addon ToME will look at.&lt;br /&gt;
&lt;br /&gt;
===Directory Structure===&lt;br /&gt;
&lt;br /&gt;
* '''overload''': Files in this directory will automatically replace files in the base game. This is very powerful but also incredibly dangerous. (Of course, replacing things like icons is less dangerous than replacing code.)&lt;br /&gt;
* '''superload''': Files in this directory will be read and executed after the base game's file of the same name. This is very powerful but much less dangerous. This is a great way to add content (like new Artifact items) or tweak content (modify a talent's cost or requirements) without accidentally stepping on other tweaks or future content updates.&lt;br /&gt;
* '''data''': Files in this directory will just sit there and be ignored unless you explicitly tell the game to read them. Files in this area live in their own &amp;quot;namespace&amp;quot; and filenames here will never interfere with other addons or the base game. This is a great place to put new classes, talent trees, or races.&lt;br /&gt;
* '''hooks''': Only one file in this directory is automatically executed: &amp;lt;nowiki&amp;gt;load.lua&amp;lt;/nowiki&amp;gt;. This file is a great way to get your &amp;quot;data&amp;quot; files executed at the proper time. It's also a way to augment some parts of the game which specifically support hooks: the Example module shows how the &amp;quot;Actor:takeHit&amp;quot; function is hooked to make the tourist take no damage.  You can also use hooks to load add-on data in to the module, eg. new talents. Find a list of available hooks [[hooks|here]].&lt;br /&gt;
&lt;br /&gt;
The Example addon can be found here: http://te4.org/dl/tmp/tome-example.teaa&lt;br /&gt;
&lt;br /&gt;
A .teaa file is simply a renamed zip that contains the whole addon, so feel free to rename and unzip your favorite addon to see a living example of all the stuff discussed in this article. The &amp;lt;nowiki&amp;gt;tome-example.teaa&amp;lt;/nowiki&amp;gt; addon illustrates how to add a new class, new talents, new timed effects and how to hook onto a few useful locations in the code. (Note that it's a bit old, though.)  When zipping, make sure to zip the files but not the folder.  For example, tome-addonname.zip/init.lua, not tome-addonname.zip/tome-addonname/init.lua.&lt;br /&gt;
&lt;br /&gt;
You can also just put a folder 'tome-addonname' in addons and it will be loaded directly, no need to zip or rename.&lt;br /&gt;
&lt;br /&gt;
== Grammar and Syntax ==&lt;br /&gt;
* The addon folder must be in the format &amp;lt;nowiki&amp;gt;[ModuleName]-[AddonShortName]&amp;lt;/nowiki&amp;gt;. For you, that means &amp;lt;nowiki&amp;gt;tome-coolstuff&amp;lt;/nowiki&amp;gt; is your folder name.&lt;br /&gt;
&lt;br /&gt;
===Overloading===&lt;br /&gt;
Each &amp;lt;nowiki&amp;gt;.teaa&amp;lt;/nowiki&amp;gt; file is just a zip file. The main ToME game code is stored in &amp;lt;nowiki&amp;gt;game/modules/tome.team&amp;lt;/nowiki&amp;gt;, and it is also just a renamed zip file.&lt;br /&gt;
&lt;br /&gt;
Copy &amp;lt;nowiki&amp;gt;tome.team&amp;lt;/nowiki&amp;gt; somewhere, rename it to &amp;lt;nowiki&amp;gt;tome-1.1.5.zip&amp;lt;/nowiki&amp;gt; and unzip it.&lt;br /&gt;
&lt;br /&gt;
You'll see two directories: &amp;quot;data&amp;quot; and &amp;quot;mod&amp;quot;. Most of the stuff you'll want to mess with at first is in &amp;quot;data&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When you use overload to replace a file, the path and name must match exactly the structure in &amp;lt;nowiki&amp;gt;tome.team&amp;lt;/nowiki&amp;gt;. So for example, to replace the types of leather boots in the game, I'd look in the unzipped ToME code and find:&lt;br /&gt;
 tome-1.1.5/data/general/objects/leather-boots.lua&lt;br /&gt;
... and so to overload that, I'd create a file in my addon:&lt;br /&gt;
 tome-coolstuff/overload/data/general/objects/leather-boots.lua&lt;br /&gt;
&lt;br /&gt;
===Superloading===&lt;br /&gt;
&lt;br /&gt;
Just like overloading, superloading requires that you know the file structure of the game so you can make your files get read and executed at the right time. When the game reads in your superload file, you can get access to the previous file's contents using the &amp;lt;nowiki&amp;gt;loadPrevious(...)&amp;lt;/nowiki&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
For example, if we wanted to add a new boot ego, we could do something like this. First, we'd find the boot ego code:&lt;br /&gt;
 data/general/objects/egos/light-boots.lua&lt;br /&gt;
&lt;br /&gt;
Next, we'd make a file in our &amp;lt;nowiki&amp;gt;superload&amp;lt;/nowiki&amp;gt; directory:&lt;br /&gt;
 tome-coolstuff/superload/data/general/objects/egos/light-boots.lua&lt;br /&gt;
&lt;br /&gt;
... and we'd make sure that our &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file had the line:&lt;br /&gt;
 superload = true&lt;br /&gt;
&lt;br /&gt;
We're ready to add the boot ego!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 local _M = loadPrevious(...)&lt;br /&gt;
 &lt;br /&gt;
 newEntity{&lt;br /&gt;
 	power_source = {arcane=true},&lt;br /&gt;
 	name = &amp;quot; of sensing&amp;quot;, suffix=true, instant_resolve=true,&lt;br /&gt;
 	keywords = {sensing=true},&lt;br /&gt;
 	level_range = {1, 50},&lt;br /&gt;
 	rarity = 4,&lt;br /&gt;
 	cost = 2,&lt;br /&gt;
 	wielder = {&lt;br /&gt;
 		see_invisible = resolvers.mbonus_material(20, 5),&lt;br /&gt;
 		see_stealth = resolvers.mbonus_material(20, 5),&lt;br /&gt;
 		blind_immune = resolvers.mbonus_material(30, 20, function(e, v) v=v/100 return 0, v end),&lt;br /&gt;
 	},&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 return _M&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Modifying mod Stuff====&lt;br /&gt;
&lt;br /&gt;
Hold on, that example still didn't use _M at all! So what is _M for? Since most things in the &amp;lt;nowiki&amp;gt;data&amp;lt;/nowiki&amp;gt; directory are stored in easily accessible structures, you don't need _M to get them. _M is generally used for stuff in the &amp;lt;nowiki&amp;gt;mod&amp;lt;/nowiki&amp;gt; directory: the most dangerous stuff to modify. Here's an example which modifies the &amp;quot;levelup&amp;quot; function in &amp;lt;nowiki&amp;gt;mod/Actor.lua&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 local _M = loadPrevious(...)&lt;br /&gt;
 local base_levelup = _M.levelup&lt;br /&gt;
 &lt;br /&gt;
 function _M:levelup()&lt;br /&gt;
   -- Do stuff &amp;quot;before&amp;quot; loading the original file&lt;br /&gt;
 &lt;br /&gt;
   -- execute the original function&lt;br /&gt;
   local retval = base_levelup(self)&lt;br /&gt;
 &lt;br /&gt;
   -- Do stuff &amp;quot;after&amp;quot; loading the original file&lt;br /&gt;
 &lt;br /&gt;
   -- return whatever the original function would have returned&lt;br /&gt;
   return retval&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 return _M&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Uploading your Addon==&lt;br /&gt;
&lt;br /&gt;
You've been playing around with your addon, making changes and copying stuff from other popular addons. You've tested your stuff, and you're pretty satisfied that it won't crash the game. Good job! Now you want to share your work.&lt;br /&gt;
&lt;br /&gt;
* In days of yore, you needed to post in this thread to be granted addon upload powers by DarkGod: http://forums.te4.org/viewtopic.php?f=50&amp;amp;t=31374&lt;br /&gt;
** If you have any trouble uploading, make a post in that thread.&lt;br /&gt;
* Main Menu -&amp;gt; Options -&amp;gt; Developer Mode (bottom option)&lt;br /&gt;
* Start a new game.&lt;br /&gt;
** Note that being in Developer Mode puts an extra screen between &amp;quot;New Game&amp;quot; and building a character. Pick the top option (&amp;quot;ToME&amp;quot;).&lt;br /&gt;
* Hit ctrl+a and pick the bottom option (just hit the up arrow)&lt;br /&gt;
* MD5s are now calculated automatically. You will probably never need to get an MD5. Ignore that unless you know why you need one.&lt;br /&gt;
* You will only need to register your addon ONCE, so after you do that the first time, you can ignore that option too.&lt;br /&gt;
* If you've already registered your addon, pick &amp;quot;Publish Addon to te4.org&amp;quot;. This is the option you'll pick over and over as you create new versions.&lt;br /&gt;
* If you're using Steam, then after you upload to te4.org, hit ctrl+d again and this time pick &amp;quot;Publish Addon to Steam Workshop&amp;quot;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Addons&amp;diff=9762</id>
		<title>Addons</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Addons&amp;diff=9762"/>
				<updated>2015-08-11T06:57:18Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: /* Grammar and Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development]][[Category:Addons]]&lt;br /&gt;
Addons are way for third parties to modify existing modules inside t-engine. Since the game Tales of Maj'Eyal is a t-engine module, this is how you write addons for ToME, just like the ones in the Steam Workshop.&lt;br /&gt;
&lt;br /&gt;
==Intro==&lt;br /&gt;
&lt;br /&gt;
You're making an addon. The addon is named &amp;quot;coolstuff&amp;quot;. The first thing you do is make a directory &amp;quot;tome-coolstuff&amp;quot; inside your Steam install of ToME. On my mac, that path is:&lt;br /&gt;
 ~/Library/Application Support/Steam/SteamApps/common/TalesMajEyal/game/addons/&lt;br /&gt;
&lt;br /&gt;
And on Windows, it's usually something like&lt;br /&gt;
 C:\Program Files (x86)\Steam\SteamApps\common\TalesMajEyal\game\addons&lt;br /&gt;
&lt;br /&gt;
On Linux, the path is&lt;br /&gt;
 ~/.steam/steam/SteamApps/common/TalesMajEyal/game/addons&lt;br /&gt;
&lt;br /&gt;
Your addons directory should have these files in it already:&lt;br /&gt;
 tome-addon-dev.teaa&lt;br /&gt;
 tome-items-vault.teaa&lt;br /&gt;
 tome-stone-wardens.teaa&lt;br /&gt;
&lt;br /&gt;
If you can't find the directory, search for one of those file names.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
&lt;br /&gt;
Every addon has an &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file. The &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file looks like this:&lt;br /&gt;
&lt;br /&gt;
 -- My Cool Addon&lt;br /&gt;
 -- tome-coolstuff/init.lua&lt;br /&gt;
 &lt;br /&gt;
 long_name = &amp;quot;My Awesome Addon&amp;quot;&lt;br /&gt;
 short_name = &amp;quot;coolstuff&amp;quot; -- Determins the name of your addon's file.&lt;br /&gt;
 for_module = &amp;quot;tome&amp;quot;&lt;br /&gt;
 version = { 1, 3, 1 }&lt;br /&gt;
 addon_version = { 1, 0, 0 }&lt;br /&gt;
 weight = 100 -- The lower this value, the sooner your addon will load.&lt;br /&gt;
 author = { 'coolguy@invalid.com' }&lt;br /&gt;
 homepage = 'iamsocool.geocities.com'&lt;br /&gt;
 description = [[Oh my god this stuff is so totally cool.&lt;br /&gt;
 Holy crap I mean it's really super cool, like, wow.&lt;br /&gt;
 ]] -- the [[ ]] things are like quote marks that can span multiple lines&lt;br /&gt;
 tags = {'cool', &amp;quot;stuff&amp;quot;, 'cool stuff'} -- tags MUST immediately follow description&lt;br /&gt;
 &lt;br /&gt;
 hooks = true&lt;br /&gt;
 overload = true&lt;br /&gt;
 superload = false&lt;br /&gt;
 data = true&lt;br /&gt;
&lt;br /&gt;
Those last four are super important, because they determine what directories in your addon ToME will look at.&lt;br /&gt;
&lt;br /&gt;
===Directory Structure===&lt;br /&gt;
&lt;br /&gt;
* '''overload''': Files in this directory will automatically replace files in the base game. This is very powerful but also incredibly dangerous. (Of course, replacing things like icons is less dangerous than replacing code.)&lt;br /&gt;
* '''superload''': Files in this directory will be read and executed after the base game's file of the same name. This is very powerful but much less dangerous. This is a great way to add content (like new Artifact items) or tweak content (modify a talent's cost or requirements) without accidentally stepping on other tweaks or future content updates.&lt;br /&gt;
* '''data''': Files in this directory will just sit there and be ignored unless you explicitly tell the game to read them. Files in this area live in their own &amp;quot;namespace&amp;quot; and filenames here will never interfere with other addons or the base game. This is a great place to put new classes, talent trees, or races.&lt;br /&gt;
* '''hooks''': Only one file in this directory is automatically executed: &amp;lt;nowiki&amp;gt;load.lua&amp;lt;/nowiki&amp;gt;. This file is a great way to get your &amp;quot;data&amp;quot; files executed at the proper time. It's also a way to augment some parts of the game which specifically support hooks: the Example module shows how the &amp;quot;Actor:takeHit&amp;quot; function is hooked to make the tourist take no damage.  You can also use hooks to load add-on data in to the module, eg. new talents. Find a list of available hooks [[hooks|here]].&lt;br /&gt;
&lt;br /&gt;
The Example addon can be found here: http://te4.org/dl/tmp/tome-example.teaa&lt;br /&gt;
&lt;br /&gt;
A .teaa file is simply a renamed zip that contains the whole addon, so feel free to rename and unzip your favorite addon to see a living example of all the stuff discussed in this article. The &amp;lt;nowiki&amp;gt;tome-example.teaa&amp;lt;/nowiki&amp;gt; addon illustrates how to add a new class, new talents, new timed effects and how to hook onto a few useful locations in the code. (Note that it's a bit old, though.)  When zipping, make sure to zip the files but not the folder.  For example, tome-addonname.zip/init.lua, not tome-addonname.zip/tome-addonname/init.lua.&lt;br /&gt;
&lt;br /&gt;
You can also just put a folder 'tome-addonname' in addons and it will be loaded directly, no need to zip or rename.&lt;br /&gt;
&lt;br /&gt;
== Grammar and Syntax ==&lt;br /&gt;
* The addon folder must be in the format &amp;lt;nowiki&amp;gt;[ModuleName]-[AddonShortName]&amp;lt;/nowiki&amp;gt;. For you, that means &amp;lt;nowiki&amp;gt;tome-coolstuff&amp;lt;/nowiki&amp;gt; is your folder name.&lt;br /&gt;
* The short_name in init.lua must match the &amp;lt;nowiki&amp;gt;[AddonShortName]&amp;lt;/nowiki&amp;gt;. For you, that means &amp;lt;nowiki&amp;gt;coolstuff&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Overloading===&lt;br /&gt;
Each &amp;lt;nowiki&amp;gt;.teaa&amp;lt;/nowiki&amp;gt; file is just a zip file. The main ToME game code is stored in &amp;lt;nowiki&amp;gt;game/modules/tome.team&amp;lt;/nowiki&amp;gt;, and it is also just a renamed zip file.&lt;br /&gt;
&lt;br /&gt;
Copy &amp;lt;nowiki&amp;gt;tome.team&amp;lt;/nowiki&amp;gt; somewhere, rename it to &amp;lt;nowiki&amp;gt;tome-1.1.5.zip&amp;lt;/nowiki&amp;gt; and unzip it.&lt;br /&gt;
&lt;br /&gt;
You'll see two directories: &amp;quot;data&amp;quot; and &amp;quot;mod&amp;quot;. Most of the stuff you'll want to mess with at first is in &amp;quot;data&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When you use overload to replace a file, the path and name must match exactly the structure in &amp;lt;nowiki&amp;gt;tome.team&amp;lt;/nowiki&amp;gt;. So for example, to replace the types of leather boots in the game, I'd look in the unzipped ToME code and find:&lt;br /&gt;
 tome-1.1.5/data/general/objects/leather-boots.lua&lt;br /&gt;
... and so to overload that, I'd create a file in my addon:&lt;br /&gt;
 tome-coolstuff/overload/data/general/objects/leather-boots.lua&lt;br /&gt;
&lt;br /&gt;
===Superloading===&lt;br /&gt;
&lt;br /&gt;
Just like overloading, superloading requires that you know the file structure of the game so you can make your files get read and executed at the right time. When the game reads in your superload file, you can get access to the previous file's contents using the &amp;lt;nowiki&amp;gt;loadPrevious(...)&amp;lt;/nowiki&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
For example, if we wanted to add a new boot ego, we could do something like this. First, we'd find the boot ego code:&lt;br /&gt;
 data/general/objects/egos/light-boots.lua&lt;br /&gt;
&lt;br /&gt;
Next, we'd make a file in our &amp;lt;nowiki&amp;gt;superload&amp;lt;/nowiki&amp;gt; directory:&lt;br /&gt;
 tome-coolstuff/superload/data/general/objects/egos/light-boots.lua&lt;br /&gt;
&lt;br /&gt;
... and we'd make sure that our &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file had the line:&lt;br /&gt;
 superload = true&lt;br /&gt;
&lt;br /&gt;
We're ready to add the boot ego!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 local _M = loadPrevious(...)&lt;br /&gt;
 &lt;br /&gt;
 newEntity{&lt;br /&gt;
 	power_source = {arcane=true},&lt;br /&gt;
 	name = &amp;quot; of sensing&amp;quot;, suffix=true, instant_resolve=true,&lt;br /&gt;
 	keywords = {sensing=true},&lt;br /&gt;
 	level_range = {1, 50},&lt;br /&gt;
 	rarity = 4,&lt;br /&gt;
 	cost = 2,&lt;br /&gt;
 	wielder = {&lt;br /&gt;
 		see_invisible = resolvers.mbonus_material(20, 5),&lt;br /&gt;
 		see_stealth = resolvers.mbonus_material(20, 5),&lt;br /&gt;
 		blind_immune = resolvers.mbonus_material(30, 20, function(e, v) v=v/100 return 0, v end),&lt;br /&gt;
 	},&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 return _M&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Modifying mod Stuff====&lt;br /&gt;
&lt;br /&gt;
Hold on, that example still didn't use _M at all! So what is _M for? Since most things in the &amp;lt;nowiki&amp;gt;data&amp;lt;/nowiki&amp;gt; directory are stored in easily accessible structures, you don't need _M to get them. _M is generally used for stuff in the &amp;lt;nowiki&amp;gt;mod&amp;lt;/nowiki&amp;gt; directory: the most dangerous stuff to modify. Here's an example which modifies the &amp;quot;levelup&amp;quot; function in &amp;lt;nowiki&amp;gt;mod/Actor.lua&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 local _M = loadPrevious(...)&lt;br /&gt;
 local base_levelup = _M.levelup&lt;br /&gt;
 &lt;br /&gt;
 function _M:levelup()&lt;br /&gt;
   -- Do stuff &amp;quot;before&amp;quot; loading the original file&lt;br /&gt;
 &lt;br /&gt;
   -- execute the original function&lt;br /&gt;
   local retval = base_levelup(self)&lt;br /&gt;
 &lt;br /&gt;
   -- Do stuff &amp;quot;after&amp;quot; loading the original file&lt;br /&gt;
 &lt;br /&gt;
   -- return whatever the original function would have returned&lt;br /&gt;
   return retval&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 return _M&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Uploading your Addon==&lt;br /&gt;
&lt;br /&gt;
You've been playing around with your addon, making changes and copying stuff from other popular addons. You've tested your stuff, and you're pretty satisfied that it won't crash the game. Good job! Now you want to share your work.&lt;br /&gt;
&lt;br /&gt;
* In days of yore, you needed to post in this thread to be granted addon upload powers by DarkGod: http://forums.te4.org/viewtopic.php?f=50&amp;amp;t=31374&lt;br /&gt;
** If you have any trouble uploading, make a post in that thread.&lt;br /&gt;
* Main Menu -&amp;gt; Options -&amp;gt; Developer Mode (bottom option)&lt;br /&gt;
* Start a new game.&lt;br /&gt;
** Note that being in Developer Mode puts an extra screen between &amp;quot;New Game&amp;quot; and building a character. Pick the top option (&amp;quot;ToME&amp;quot;).&lt;br /&gt;
* Hit ctrl+a and pick the bottom option (just hit the up arrow)&lt;br /&gt;
* MD5s are now calculated automatically. You will probably never need to get an MD5. Ignore that unless you know why you need one.&lt;br /&gt;
* You will only need to register your addon ONCE, so after you do that the first time, you can ignore that option too.&lt;br /&gt;
* If you've already registered your addon, pick &amp;quot;Publish Addon to te4.org&amp;quot;. This is the option you'll pick over and over as you create new versions.&lt;br /&gt;
* If you're using Steam, then after you upload to te4.org, hit ctrl+d again and this time pick &amp;quot;Publish Addon to Steam Workshop&amp;quot;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Addons&amp;diff=9761</id>
		<title>Addons</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Addons&amp;diff=9761"/>
				<updated>2015-08-11T06:54:31Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: /* Getting Started */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development]][[Category:Addons]]&lt;br /&gt;
Addons are way for third parties to modify existing modules inside t-engine. Since the game Tales of Maj'Eyal is a t-engine module, this is how you write addons for ToME, just like the ones in the Steam Workshop.&lt;br /&gt;
&lt;br /&gt;
==Intro==&lt;br /&gt;
&lt;br /&gt;
You're making an addon. The addon is named &amp;quot;coolstuff&amp;quot;. The first thing you do is make a directory &amp;quot;tome-coolstuff&amp;quot; inside your Steam install of ToME. On my mac, that path is:&lt;br /&gt;
 ~/Library/Application Support/Steam/SteamApps/common/TalesMajEyal/game/addons/&lt;br /&gt;
&lt;br /&gt;
And on Windows, it's usually something like&lt;br /&gt;
 C:\Program Files (x86)\Steam\SteamApps\common\TalesMajEyal\game\addons&lt;br /&gt;
&lt;br /&gt;
On Linux, the path is&lt;br /&gt;
 ~/.steam/steam/SteamApps/common/TalesMajEyal/game/addons&lt;br /&gt;
&lt;br /&gt;
Your addons directory should have these files in it already:&lt;br /&gt;
 tome-addon-dev.teaa&lt;br /&gt;
 tome-items-vault.teaa&lt;br /&gt;
 tome-stone-wardens.teaa&lt;br /&gt;
&lt;br /&gt;
If you can't find the directory, search for one of those file names.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
&lt;br /&gt;
Every addon has an &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file. The &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file looks like this:&lt;br /&gt;
&lt;br /&gt;
 -- My Cool Addon&lt;br /&gt;
 -- tome-coolstuff/init.lua&lt;br /&gt;
 &lt;br /&gt;
 long_name = &amp;quot;My Awesome Addon&amp;quot;&lt;br /&gt;
 short_name = &amp;quot;coolstuff&amp;quot; -- Determins the name of your addon's file.&lt;br /&gt;
 for_module = &amp;quot;tome&amp;quot;&lt;br /&gt;
 version = { 1, 3, 1 }&lt;br /&gt;
 addon_version = { 1, 0, 0 }&lt;br /&gt;
 weight = 100 -- The lower this value, the sooner your addon will load.&lt;br /&gt;
 author = { 'coolguy@invalid.com' }&lt;br /&gt;
 homepage = 'iamsocool.geocities.com'&lt;br /&gt;
 description = [[Oh my god this stuff is so totally cool.&lt;br /&gt;
 Holy crap I mean it's really super cool, like, wow.&lt;br /&gt;
 ]] -- the [[ ]] things are like quote marks that can span multiple lines&lt;br /&gt;
 tags = {'cool', &amp;quot;stuff&amp;quot;, 'cool stuff'} -- tags MUST immediately follow description&lt;br /&gt;
 &lt;br /&gt;
 hooks = true&lt;br /&gt;
 overload = true&lt;br /&gt;
 superload = false&lt;br /&gt;
 data = true&lt;br /&gt;
&lt;br /&gt;
Those last four are super important, because they determine what directories in your addon ToME will look at.&lt;br /&gt;
&lt;br /&gt;
===Directory Structure===&lt;br /&gt;
&lt;br /&gt;
* '''overload''': Files in this directory will automatically replace files in the base game. This is very powerful but also incredibly dangerous. (Of course, replacing things like icons is less dangerous than replacing code.)&lt;br /&gt;
* '''superload''': Files in this directory will be read and executed after the base game's file of the same name. This is very powerful but much less dangerous. This is a great way to add content (like new Artifact items) or tweak content (modify a talent's cost or requirements) without accidentally stepping on other tweaks or future content updates.&lt;br /&gt;
* '''data''': Files in this directory will just sit there and be ignored unless you explicitly tell the game to read them. Files in this area live in their own &amp;quot;namespace&amp;quot; and filenames here will never interfere with other addons or the base game. This is a great place to put new classes, talent trees, or races.&lt;br /&gt;
* '''hooks''': Only one file in this directory is automatically executed: &amp;lt;nowiki&amp;gt;load.lua&amp;lt;/nowiki&amp;gt;. This file is a great way to get your &amp;quot;data&amp;quot; files executed at the proper time. It's also a way to augment some parts of the game which specifically support hooks: the Example module shows how the &amp;quot;Actor:takeHit&amp;quot; function is hooked to make the tourist take no damage.  You can also use hooks to load add-on data in to the module, eg. new talents. Find a list of available hooks [[hooks|here]].&lt;br /&gt;
&lt;br /&gt;
The Example addon can be found here: http://te4.org/dl/tmp/tome-example.teaa&lt;br /&gt;
&lt;br /&gt;
A .teaa file is simply a renamed zip that contains the whole addon, so feel free to rename and unzip your favorite addon to see a living example of all the stuff discussed in this article. The &amp;lt;nowiki&amp;gt;tome-example.teaa&amp;lt;/nowiki&amp;gt; addon illustrates how to add a new class, new talents, new timed effects and how to hook onto a few useful locations in the code. (Note that it's a bit old, though.)  When zipping, make sure to zip the files but not the folder.  For example, tome-addonname.zip/init.lua, not tome-addonname.zip/tome-addonname/init.lua.&lt;br /&gt;
&lt;br /&gt;
You can also just put a folder 'tome-addonname' in addons and it will be loaded directly, no need to zip or rename.&lt;br /&gt;
&lt;br /&gt;
== Grammar and Syntax ==&lt;br /&gt;
* The addon folder must be in the format &amp;lt;nowiki&amp;gt;[ModuleName]-[AddonName]&amp;lt;/nowiki&amp;gt;. For you, that means &amp;lt;nowiki&amp;gt;tome-coolstuff&amp;lt;/nowiki&amp;gt; is your folder name.&lt;br /&gt;
* The short_name in init.lua must match the &amp;lt;nowiki&amp;gt;[AddonName]&amp;lt;/nowiki&amp;gt;. For you, that means &amp;lt;nowiki&amp;gt;coolstuff&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Overloading===&lt;br /&gt;
Each &amp;lt;nowiki&amp;gt;.teaa&amp;lt;/nowiki&amp;gt; file is just a zip file. The main ToME game code is stored in &amp;lt;nowiki&amp;gt;game/modules/tome.team&amp;lt;/nowiki&amp;gt;, and it is also just a renamed zip file.&lt;br /&gt;
&lt;br /&gt;
Copy &amp;lt;nowiki&amp;gt;tome.team&amp;lt;/nowiki&amp;gt; somewhere, rename it to &amp;lt;nowiki&amp;gt;tome-1.1.5.zip&amp;lt;/nowiki&amp;gt; and unzip it.&lt;br /&gt;
&lt;br /&gt;
You'll see two directories: &amp;quot;data&amp;quot; and &amp;quot;mod&amp;quot;. Most of the stuff you'll want to mess with at first is in &amp;quot;data&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When you use overload to replace a file, the path and name must match exactly the structure in &amp;lt;nowiki&amp;gt;tome.team&amp;lt;/nowiki&amp;gt;. So for example, to replace the types of leather boots in the game, I'd look in the unzipped ToME code and find:&lt;br /&gt;
 tome-1.1.5/data/general/objects/leather-boots.lua&lt;br /&gt;
... and so to overload that, I'd create a file in my addon:&lt;br /&gt;
 tome-coolstuff/overload/data/general/objects/leather-boots.lua&lt;br /&gt;
&lt;br /&gt;
===Superloading===&lt;br /&gt;
&lt;br /&gt;
Just like overloading, superloading requires that you know the file structure of the game so you can make your files get read and executed at the right time. When the game reads in your superload file, you can get access to the previous file's contents using the &amp;lt;nowiki&amp;gt;loadPrevious(...)&amp;lt;/nowiki&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
For example, if we wanted to add a new boot ego, we could do something like this. First, we'd find the boot ego code:&lt;br /&gt;
 data/general/objects/egos/light-boots.lua&lt;br /&gt;
&lt;br /&gt;
Next, we'd make a file in our &amp;lt;nowiki&amp;gt;superload&amp;lt;/nowiki&amp;gt; directory:&lt;br /&gt;
 tome-coolstuff/superload/data/general/objects/egos/light-boots.lua&lt;br /&gt;
&lt;br /&gt;
... and we'd make sure that our &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file had the line:&lt;br /&gt;
 superload = true&lt;br /&gt;
&lt;br /&gt;
We're ready to add the boot ego!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 local _M = loadPrevious(...)&lt;br /&gt;
 &lt;br /&gt;
 newEntity{&lt;br /&gt;
 	power_source = {arcane=true},&lt;br /&gt;
 	name = &amp;quot; of sensing&amp;quot;, suffix=true, instant_resolve=true,&lt;br /&gt;
 	keywords = {sensing=true},&lt;br /&gt;
 	level_range = {1, 50},&lt;br /&gt;
 	rarity = 4,&lt;br /&gt;
 	cost = 2,&lt;br /&gt;
 	wielder = {&lt;br /&gt;
 		see_invisible = resolvers.mbonus_material(20, 5),&lt;br /&gt;
 		see_stealth = resolvers.mbonus_material(20, 5),&lt;br /&gt;
 		blind_immune = resolvers.mbonus_material(30, 20, function(e, v) v=v/100 return 0, v end),&lt;br /&gt;
 	},&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 return _M&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Modifying mod Stuff====&lt;br /&gt;
&lt;br /&gt;
Hold on, that example still didn't use _M at all! So what is _M for? Since most things in the &amp;lt;nowiki&amp;gt;data&amp;lt;/nowiki&amp;gt; directory are stored in easily accessible structures, you don't need _M to get them. _M is generally used for stuff in the &amp;lt;nowiki&amp;gt;mod&amp;lt;/nowiki&amp;gt; directory: the most dangerous stuff to modify. Here's an example which modifies the &amp;quot;levelup&amp;quot; function in &amp;lt;nowiki&amp;gt;mod/Actor.lua&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 local _M = loadPrevious(...)&lt;br /&gt;
 local base_levelup = _M.levelup&lt;br /&gt;
 &lt;br /&gt;
 function _M:levelup()&lt;br /&gt;
   -- Do stuff &amp;quot;before&amp;quot; loading the original file&lt;br /&gt;
 &lt;br /&gt;
   -- execute the original function&lt;br /&gt;
   local retval = base_levelup(self)&lt;br /&gt;
 &lt;br /&gt;
   -- Do stuff &amp;quot;after&amp;quot; loading the original file&lt;br /&gt;
 &lt;br /&gt;
   -- return whatever the original function would have returned&lt;br /&gt;
   return retval&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 return _M&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Uploading your Addon==&lt;br /&gt;
&lt;br /&gt;
You've been playing around with your addon, making changes and copying stuff from other popular addons. You've tested your stuff, and you're pretty satisfied that it won't crash the game. Good job! Now you want to share your work.&lt;br /&gt;
&lt;br /&gt;
* In days of yore, you needed to post in this thread to be granted addon upload powers by DarkGod: http://forums.te4.org/viewtopic.php?f=50&amp;amp;t=31374&lt;br /&gt;
** If you have any trouble uploading, make a post in that thread.&lt;br /&gt;
* Main Menu -&amp;gt; Options -&amp;gt; Developer Mode (bottom option)&lt;br /&gt;
* Start a new game.&lt;br /&gt;
** Note that being in Developer Mode puts an extra screen between &amp;quot;New Game&amp;quot; and building a character. Pick the top option (&amp;quot;ToME&amp;quot;).&lt;br /&gt;
* Hit ctrl+a and pick the bottom option (just hit the up arrow)&lt;br /&gt;
* MD5s are now calculated automatically. You will probably never need to get an MD5. Ignore that unless you know why you need one.&lt;br /&gt;
* You will only need to register your addon ONCE, so after you do that the first time, you can ignore that option too.&lt;br /&gt;
* If you've already registered your addon, pick &amp;quot;Publish Addon to te4.org&amp;quot;. This is the option you'll pick over and over as you create new versions.&lt;br /&gt;
* If you're using Steam, then after you upload to te4.org, hit ctrl+d again and this time pick &amp;quot;Publish Addon to Steam Workshop&amp;quot;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Addons&amp;diff=9706</id>
		<title>Addons</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Addons&amp;diff=9706"/>
				<updated>2015-04-26T22:51:50Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: Removed a bad example.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Development]][[Category:Addons]]&lt;br /&gt;
Addons are way for third parties to modify existing modules inside t-engine. Since the game Tales of Maj'Eyal is a t-engine module, this is how you write addons for ToME, just like the ones in the Steam Workshop.&lt;br /&gt;
&lt;br /&gt;
==Intro==&lt;br /&gt;
&lt;br /&gt;
You're making an addon. The addon is named &amp;quot;coolstuff&amp;quot;. The first thing you do is make a directory &amp;quot;tome-coolstuff&amp;quot; inside your Steam install of ToME. On my mac, that path is:&lt;br /&gt;
 ~/Library/Application Support/Steam/SteamApps/common/TalesMajEyal/game/addons/&lt;br /&gt;
&lt;br /&gt;
And on Windows, it's usually something like&lt;br /&gt;
 C:\Program Files (x86)\Steam\SteamApps\common\TalesMajEyal\game\addons&lt;br /&gt;
&lt;br /&gt;
On Linux, the path is&lt;br /&gt;
 ~/.steam/steam/SteamApps/common/TalesMajEyal/game/addons&lt;br /&gt;
&lt;br /&gt;
Your addons directory should have these files in it already:&lt;br /&gt;
 tome-addon-dev.teaa&lt;br /&gt;
 tome-items-vault.teaa&lt;br /&gt;
 tome-stone-wardens.teaa&lt;br /&gt;
&lt;br /&gt;
If you can't find the directory, search for one of those file names.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Getting Started===&lt;br /&gt;
&lt;br /&gt;
Every addon has an &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file. The &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file looks like this:&lt;br /&gt;
&lt;br /&gt;
 -- My Cool Addon&lt;br /&gt;
 -- tome-coolstuff/init.lua&lt;br /&gt;
 &lt;br /&gt;
 long_name = &amp;quot;My Awesome Addon&amp;quot;&lt;br /&gt;
 short_name = &amp;quot;coolstuff&amp;quot;&lt;br /&gt;
 for_module = &amp;quot;tome&amp;quot;&lt;br /&gt;
 version = { 1, 1, 6 }&lt;br /&gt;
 weight = 100&lt;br /&gt;
 author = { 'coolguy@invalid.com' }&lt;br /&gt;
 homepage = 'iamsocool.geocities.com'&lt;br /&gt;
 description = [[Oh my god this stuff is so totally cool.&lt;br /&gt;
 Holy crap I mean it's really super cool, like, wow.&lt;br /&gt;
 ]] -- the [[ ]] things are like quote marks that can span multiple lines&lt;br /&gt;
 tags = {'cool', &amp;quot;stuff&amp;quot;, 'cool stuff'} -- tags MUST immediately follow description&lt;br /&gt;
 &lt;br /&gt;
 hooks = true&lt;br /&gt;
 overload = true&lt;br /&gt;
 superload = false&lt;br /&gt;
 data = true&lt;br /&gt;
&lt;br /&gt;
Those last four are super important, because they determine what directories in your addon ToME will look at.&lt;br /&gt;
&lt;br /&gt;
===Directory Structure===&lt;br /&gt;
&lt;br /&gt;
* '''overload''': Files in this directory will automatically replace files in the base game. This is very powerful but also incredibly dangerous. (Of course, replacing things like icons is less dangerous than replacing code.)&lt;br /&gt;
* '''superload''': Files in this directory will be read and executed after the base game's file of the same name. This is very powerful but much less dangerous. This is a great way to add content (like new Artifact items) or tweak content (modify a talent's cost or requirements) without accidentally stepping on other tweaks or future content updates.&lt;br /&gt;
* '''data''': Files in this directory will just sit there and be ignored unless you explicitly tell the game to read them. Files in this area live in their own &amp;quot;namespace&amp;quot; and filenames here will never interfere with other addons or the base game. This is a great place to put new classes, talent trees, or races.&lt;br /&gt;
* '''hooks''': Only one file in this directory is automatically executed: &amp;lt;nowiki&amp;gt;load.lua&amp;lt;/nowiki&amp;gt;. This file is a great way to get your &amp;quot;data&amp;quot; files executed at the proper time. It's also a way to augment some parts of the game which specifically support hooks: the Example module shows how the &amp;quot;Actor:takeHit&amp;quot; function is hooked to make the tourist take no damage.  You can also use hooks to load add-on data in to the module, eg. new talents. Find a list of available hooks [[hooks|here]].&lt;br /&gt;
&lt;br /&gt;
The Example addon can be found here: http://te4.org/dl/tmp/tome-example.teaa&lt;br /&gt;
&lt;br /&gt;
A .teaa file is simply a renamed zip that contains the whole addon, so feel free to rename and unzip your favorite addon to see a living example of all the stuff discussed in this article. The &amp;lt;nowiki&amp;gt;tome-example.teaa&amp;lt;/nowiki&amp;gt; addon illustrates how to add a new class, new talents, new timed effects and how to hook onto a few useful locations in the code. (Note that it's a bit old, though.)  When zipping, make sure to zip the files but not the folder.  For example, tome-addonname.zip/init.lua, not tome-addonname.zip/tome-addonname/init.lua.&lt;br /&gt;
&lt;br /&gt;
You can also just put a folder 'tome-addonname' in addons and it will be loaded directly, no need to zip or rename.&lt;br /&gt;
&lt;br /&gt;
== Grammar and Syntax ==&lt;br /&gt;
* The addon folder must be in the format &amp;lt;nowiki&amp;gt;[ModuleName]-[AddonName]&amp;lt;/nowiki&amp;gt;. For you, that means &amp;lt;nowiki&amp;gt;tome-coolstuff&amp;lt;/nowiki&amp;gt; is your folder name.&lt;br /&gt;
* The short_name in init.lua must match the &amp;lt;nowiki&amp;gt;[AddonName]&amp;lt;/nowiki&amp;gt;. For you, that means &amp;lt;nowiki&amp;gt;coolstuff&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Overloading===&lt;br /&gt;
Each &amp;lt;nowiki&amp;gt;.teaa&amp;lt;/nowiki&amp;gt; file is just a zip file. The main ToME game code is stored in &amp;lt;nowiki&amp;gt;game/modules/tome.team&amp;lt;/nowiki&amp;gt;, and it is also just a renamed zip file.&lt;br /&gt;
&lt;br /&gt;
Copy &amp;lt;nowiki&amp;gt;tome.team&amp;lt;/nowiki&amp;gt; somewhere, rename it to &amp;lt;nowiki&amp;gt;tome-1.1.5.zip&amp;lt;/nowiki&amp;gt; and unzip it.&lt;br /&gt;
&lt;br /&gt;
You'll see two directories: &amp;quot;data&amp;quot; and &amp;quot;mod&amp;quot;. Most of the stuff you'll want to mess with at first is in &amp;quot;data&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
When you use overload to replace a file, the path and name must match exactly the structure in &amp;lt;nowiki&amp;gt;tome.team&amp;lt;/nowiki&amp;gt;. So for example, to replace the types of leather boots in the game, I'd look in the unzipped ToME code and find:&lt;br /&gt;
 tome-1.1.5/data/general/objects/leather-boots.lua&lt;br /&gt;
... and so to overload that, I'd create a file in my addon:&lt;br /&gt;
 tome-coolstuff/overload/data/general/objects/leather-boots.lua&lt;br /&gt;
&lt;br /&gt;
===Superloading===&lt;br /&gt;
&lt;br /&gt;
Just like overloading, superloading requires that you know the file structure of the game so you can make your files get read and executed at the right time. When the game reads in your superload file, you can get access to the previous file's contents using the &amp;lt;nowiki&amp;gt;loadPrevious(...)&amp;lt;/nowiki&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
For example, if we wanted to add a new boot ego, we could do something like this. First, we'd find the boot ego code:&lt;br /&gt;
 data/general/objects/egos/light-boots.lua&lt;br /&gt;
&lt;br /&gt;
Next, we'd make a file in our &amp;lt;nowiki&amp;gt;superload&amp;lt;/nowiki&amp;gt; directory:&lt;br /&gt;
 tome-coolstuff/superload/data/general/objects/egos/light-boots.lua&lt;br /&gt;
&lt;br /&gt;
... and we'd make sure that our &amp;lt;nowiki&amp;gt;init.lua&amp;lt;/nowiki&amp;gt; file had the line:&lt;br /&gt;
 superload = true&lt;br /&gt;
&lt;br /&gt;
We're ready to add the boot ego!&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 local _M = loadPrevious(...)&lt;br /&gt;
 &lt;br /&gt;
 newEntity{&lt;br /&gt;
 	power_source = {arcane=true},&lt;br /&gt;
 	name = &amp;quot; of sensing&amp;quot;, suffix=true, instant_resolve=true,&lt;br /&gt;
 	keywords = {sensing=true},&lt;br /&gt;
 	level_range = {1, 50},&lt;br /&gt;
 	rarity = 4,&lt;br /&gt;
 	cost = 2,&lt;br /&gt;
 	wielder = {&lt;br /&gt;
 		see_invisible = resolvers.mbonus_material(20, 5),&lt;br /&gt;
 		see_stealth = resolvers.mbonus_material(20, 5),&lt;br /&gt;
 		blind_immune = resolvers.mbonus_material(30, 20, function(e, v) v=v/100 return 0, v end),&lt;br /&gt;
 	},&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 return _M&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Modifying mod Stuff====&lt;br /&gt;
&lt;br /&gt;
Hold on, that example still didn't use _M at all! So what is _M for? Since most things in the &amp;lt;nowiki&amp;gt;data&amp;lt;/nowiki&amp;gt; directory are stored in easily accessible structures, you don't need _M to get them. _M is generally used for stuff in the &amp;lt;nowiki&amp;gt;mod&amp;lt;/nowiki&amp;gt; directory: the most dangerous stuff to modify. Here's an example which modifies the &amp;quot;levelup&amp;quot; function in &amp;lt;nowiki&amp;gt;mod/Actor.lua&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 local _M = loadPrevious(...)&lt;br /&gt;
 local base_levelup = _M.levelup&lt;br /&gt;
 &lt;br /&gt;
 function _M:levelup()&lt;br /&gt;
   -- Do stuff &amp;quot;before&amp;quot; loading the original file&lt;br /&gt;
 &lt;br /&gt;
   -- execute the original function&lt;br /&gt;
   local retval = base_levelup(self)&lt;br /&gt;
 &lt;br /&gt;
   -- Do stuff &amp;quot;after&amp;quot; loading the original file&lt;br /&gt;
 &lt;br /&gt;
   -- return whatever the original function would have returned&lt;br /&gt;
   return retval&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 return _M&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Uploading your Addon==&lt;br /&gt;
&lt;br /&gt;
You've been playing around with your addon, making changes and copying stuff from other popular addons. You've tested your stuff, and you're pretty satisfied that it won't crash the game. Good job! Now you want to share your work.&lt;br /&gt;
&lt;br /&gt;
* In days of yore, you needed to post in this thread to be granted addon upload powers by DarkGod: http://forums.te4.org/viewtopic.php?f=50&amp;amp;t=31374&lt;br /&gt;
** If you have any trouble uploading, make a post in that thread.&lt;br /&gt;
* Main Menu -&amp;gt; Options -&amp;gt; Developer Mode (bottom option)&lt;br /&gt;
* Start a new game.&lt;br /&gt;
** Note that being in Developer Mode puts an extra screen between &amp;quot;New Game&amp;quot; and building a character. Pick the top option (&amp;quot;ToME&amp;quot;).&lt;br /&gt;
* Hit ctrl+a and pick the bottom option (just hit the up arrow)&lt;br /&gt;
* MD5s are now calculated automatically. You will probably never need to get an MD5. Ignore that unless you know why you need one.&lt;br /&gt;
* You will only need to register your addon ONCE, so after you do that the first time, you can ignore that option too.&lt;br /&gt;
* If you've already registered your addon, pick &amp;quot;Publish Addon to te4.org&amp;quot;. This is the option you'll pick over and over as you create new versions.&lt;br /&gt;
* If you're using Steam, then after you upload to te4.org, hit ctrl+d again and this time pick &amp;quot;Publish Addon to Steam Workshop&amp;quot;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=9635</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=9635"/>
				<updated>2015-04-02T13:12:28Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A quick description of Callbacks, from a person who knows nothing:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;They are like Superloads or Hooks, but more focused.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent (or timed_effect) just like you would anything else.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguements, add them onto the end, after the normal (self, t) or (self, eff).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(did we actually move?)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(self, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to your summon. Do not confuse this with your actual self.&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(self, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to who died. Do not confuse this with your actual, living, self.&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(self, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was attacking you. Do not confuse this with yourself.&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(self, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was attacking you. Do not confuse this with yourself.&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(&amp;quot;type&amp;quot;, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: &amp;quot;type&amp;quot; refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(status)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: status can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: You can return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Callback&amp;diff=9607</id>
		<title>Callback</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Callback&amp;diff=9607"/>
				<updated>2015-03-08T06:08:38Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A quick description of Callbacks, from a person who knows nothing:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;They are like Superloads or Hooks, but more focused.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To use a Callback, simply insert one into your talent (or timed_effect) just like you would anything else.&lt;br /&gt;
&lt;br /&gt;
If the Callback has additional arguements, add them onto the end, after the normal (self, t) or (self, eff).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
List of callbacks in 1.2.5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Actor.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called once per global turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnActBase()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor begins their turn.&lt;br /&gt;
&lt;br /&gt;
callbackOnAct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor moves.&lt;br /&gt;
&lt;br /&gt;
callbackOnMove(moved, force, ox, oy, x, y)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;moved(did we actually move?)&lt;br /&gt;
&lt;br /&gt;
force(did somebody force us to move?)&lt;br /&gt;
&lt;br /&gt;
ox, oy(our starting location)&lt;br /&gt;
&lt;br /&gt;
x, y(where we moved to&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor is healed.&lt;br /&gt;
&lt;br /&gt;
callbackOnHeal(value, src)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;value(amount healed)&lt;br /&gt;
&lt;br /&gt;
src(source of the healing)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes damage. This happens at the end of onTakeHit, and right before the damage is actually dealt.&lt;br /&gt;
&lt;br /&gt;
callbackOnHit(cb, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: This passes along the damage dealt under cb.value. Make any changes you want to cb.value, than return cb, if you wish to change the damage dealt.&lt;br /&gt;
&lt;br /&gt;
src(source of the damage)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor deals damage.&lt;br /&gt;
&lt;br /&gt;
callbackOnDealDamage(val, self, dead, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;val(damage dealt)&lt;br /&gt;
&lt;br /&gt;
self(who you're hitting)&lt;br /&gt;
&lt;br /&gt;
dead(did the attack kill your target?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnDeath(src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;src(who killed us?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a Summon of an Actor dies.&lt;br /&gt;
&lt;br /&gt;
callbackOnSummonDeath(self, src, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to your summon. Do not confuse this with your actual self.&lt;br /&gt;
&lt;br /&gt;
src(who killed our summon?)&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor kills something.&lt;br /&gt;
&lt;br /&gt;
callbackOnKill(self, death_note)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is referring to who died. Do not confuse this with your actual, living, self.&lt;br /&gt;
&lt;br /&gt;
death_note()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor has a stat changed.&lt;br /&gt;
&lt;br /&gt;
callbackOnStatChange(stat, v)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;stat(the stat that was changed)&lt;br /&gt;
&lt;br /&gt;
v(the value of the change)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor wears something.&lt;br /&gt;
&lt;br /&gt;
callbackOnWear(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object worn)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an Actor takes something off.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeoff(o, bypass_set)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;o(the object removed)&lt;br /&gt;
&lt;br /&gt;
bypass_set()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a magical or natural talent fails to activate.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentDisturbed(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that failed)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called after a talent is used.&lt;br /&gt;
&lt;br /&gt;
callbackOnTalentPost(ab, ret, silent)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was used)&lt;br /&gt;
&lt;br /&gt;
ret(whatever the talent returned)&lt;br /&gt;
&lt;br /&gt;
Special note: Unless we are a sustain, we will fail if our talent returns anything but true.&lt;br /&gt;
&lt;br /&gt;
silent()&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a sustain deactivates due to talent usage.&lt;br /&gt;
&lt;br /&gt;
callbackBreakOnTalent(ab)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;ab(the talent that was deactivated)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a temporary effect tries to be applied.&lt;br /&gt;
&lt;br /&gt;
callbackOnTemporaryEffect(eff_id, e, p)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;eff_id(the effect id)&lt;br /&gt;
&lt;br /&gt;
e(the base effect info, as shown in its timed_effect file)&lt;br /&gt;
&lt;br /&gt;
p(the effect being applied, such as duration)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Archery.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack hits us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryHit(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack misses us.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryMiss(self)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was shooting at you. Do not confuse this with yourself.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an archery attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnArcheryAttack(target, hitted, crit, weapon, ammo, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
ammo(our ammo)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Combat.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy hits us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeHit(self, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was attacking you. Do not confuse this with yourself.&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever an enemy misses us with a melee attack.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeMiss(self, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: self in this case is whoever was attacking you. Do not confuse this with yourself.&lt;br /&gt;
&lt;br /&gt;
dam(our damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever a melee attack happens.&lt;br /&gt;
&lt;br /&gt;
callbackOnMeleeAttack(target, hitted, crit, weapon, damtype, mult, dam)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;target(who is being hit?)&lt;br /&gt;
&lt;br /&gt;
hitted(did we hit?)&lt;br /&gt;
&lt;br /&gt;
crit(did we crit?)&lt;br /&gt;
&lt;br /&gt;
weapon(our weapon)&lt;br /&gt;
&lt;br /&gt;
damtype(what type of damage did we do?)&lt;br /&gt;
&lt;br /&gt;
mult(our damage multiplier)&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we crit.&lt;br /&gt;
&lt;br /&gt;
callbackOnCrit(&amp;quot;type&amp;quot;, dam, chance, target)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: &amp;quot;type&amp;quot; refers to either &amp;quot;physical&amp;quot; &amp;quot;spell&amp;quot; or &amp;quot;mind&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Special note 2: Only &amp;quot;physical&amp;quot; also returns a target along with it. Spell and mind do not.&lt;br /&gt;
&lt;br /&gt;
dam(the damage dealt)&lt;br /&gt;
&lt;br /&gt;
chance(the chance of the crit happening)&lt;br /&gt;
&lt;br /&gt;
target(who did we hit?)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Player.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we try to rest.&lt;br /&gt;
&lt;br /&gt;
callbackOnRest(&amp;quot;special&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: &amp;quot;special&amp;quot; can either return &amp;quot;start&amp;quot; &amp;quot;stop&amp;quot; or &amp;quot;check&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;start&amp;quot; and &amp;quot;stop&amp;quot; simply allow you to do whatever you wish.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;check&amp;quot; will ask you to return either true or false. True will stop resting from ending.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called whenever we run. (shift + direction)&lt;br /&gt;
&lt;br /&gt;
callbackOnRun()&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: We will be unable to run if True is returned.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''damage_types.lua'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Called before we take damage. We can completely stop damage from ever happening from here.&lt;br /&gt;
&lt;br /&gt;
callbackOnTakeDamage(src, x, y, type, dam, tmp, no_martyr)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;Special note: You can return either data.dam or data.stopped. data.dam will behave just like you were passing the damage on, while data.stopped will stop the damage completely.&lt;br /&gt;
&lt;br /&gt;
src(who is hitting us)&lt;br /&gt;
&lt;br /&gt;
x, y(where is the damage happening?)&lt;br /&gt;
&lt;br /&gt;
type(what damage type is hitting us?)&lt;br /&gt;
&lt;br /&gt;
dam(how much are we being hit for?)&lt;br /&gt;
&lt;br /&gt;
tmp()&lt;br /&gt;
&lt;br /&gt;
no_martyr(set to true if your effect has the slightest chance of looping forever, usually due to dealing damage back)&amp;lt;/small&amp;gt;&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	<entry>
		<id>https://te4.org/w/index.php?title=Debugging&amp;diff=6226</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://te4.org/w/index.php?title=Debugging&amp;diff=6226"/>
				<updated>2013-11-08T05:02:16Z</updated>
		
		<summary type="html">&lt;p&gt;StarKeep: /* Lua console */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Debugging: Figuring out what went wrong ===&lt;br /&gt;
&lt;br /&gt;
==== Updating your configuration ====&lt;br /&gt;
Enabling cheat/development mode will grant you access to the internal Lua console and some additional dialogs/options useful for debugging.  It will stop you from uploading characters online, though, but you can always turn this mode off.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Navigate to the corresponding configuration directory (replace HOME with your home directory).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
| Windows || HOME\T-Engine\4.0\settings &lt;br /&gt;
|-&lt;br /&gt;
| Linux || HOME/.t-egine/4.0/settings &lt;br /&gt;
|-&lt;br /&gt;
| Mac OSX || HOME\Library\Application Support\T-Engine\4.0\settings &lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a file called ''cheat.cfg'' in that directory, and put the following text in that file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 cheat = true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
To turn cheat/development mode off, just change ''true'' to ''false'' or delete the ''cheat.cfg'' file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Inside of ToME ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key Shortcut !! Result&lt;br /&gt;
|-&lt;br /&gt;
| Ctrl+L || Lua console &lt;br /&gt;
|-&lt;br /&gt;
| Ctrl+A || Debug dialog &lt;br /&gt;
|-&lt;br /&gt;
| Ctrl+S || save the game &lt;br /&gt;
|-&lt;br /&gt;
| Ctrl+Alt+Shift+R || Reload the last save &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
NOTE: The keybinding may not be set, in this case you have to bind it yourself first.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Lua console ====&lt;br /&gt;
&lt;br /&gt;
Summary of features:&lt;br /&gt;
* Inspect values and execute code&lt;br /&gt;
* Cursor positioning&lt;br /&gt;
* Tab auto-completion&lt;br /&gt;
* Copy and paste with system clipboard&lt;br /&gt;
&lt;br /&gt;
The Lua console drops you into the global namespace and gives you access to [[t4modules engine structure|the engine]].  If you want to inspect values, start the line with an equal sign.  For example, say you want to inspect the player:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
=game.player&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The console has cursor positioning so you can use the Left and Right arrows, as well as Home and End to move to the beginning and end of the current line, respectively.  You can paste the clipboard's contents to the cursor position with Ctrl+V (note, not Apple+V on Mac).  The current line can be copied to the clipboard with Ctrl+C (again, not Apple+C).&lt;br /&gt;
&lt;br /&gt;
Here are some useful commands to know.&lt;br /&gt;
;Level up to level 50&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player:forceLevelup(50)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Remove godmode invulnerability&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.invulnerable=0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Change your damage bonus&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.inc_damage.all=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Change your resistance&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.resists.all=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Learn a new talent (1 level in Slash in the example)&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player:learnTalent(game.player.T_SLASH, true, 1)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Change category mastery&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player:setTalentTypeMastery(&amp;quot;cunning/survival&amp;quot;, 1.5)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Change base stat - up to 100 max (reduce strength by 20 in the example)&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player:incStat(&amp;quot;str&amp;quot;, -20)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Change stat bonus (set Cunning bonus to 50 in the example)&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.inc_stats[game.player.STAT_CUN] = 50&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Apply an effect on the player (frozen for 10 turns)&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player:setEffect(game.player.EFF_FROZEN, 10, {})&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Change your max HP&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.max_life=1&lt;br /&gt;
game.player:resetToFull()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Teleport (to the Assassin Lord)&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game:changeLevel(2,&amp;quot;thieves-tunnels&amp;quot;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Add 5000 gold&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player:incMoney(5000)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Give yourself 10 unassigned class skills&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.unused_talents=10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Give yourself 10 unused stat points&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.unused_stats=10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Give yourself an extra stat point each level (default=3)&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.stats_per_level=4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Give yourself 10 unused generic points&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.unused_generics=10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Give yourself 10 unused category points&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.unused_talents_types=10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
;Give yourself 10 lives:&lt;br /&gt;
: &amp;lt;code&amp;gt;&lt;br /&gt;
game.player.easy_mode_lifes=10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Output log text to file immediately (Only needed on Windows) ===&lt;br /&gt;
&lt;br /&gt;
Without this, you have to close the game for the log file to be updated!&lt;br /&gt;
&lt;br /&gt;
Instructions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a shortcut to t-engine.exe.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Right-click the shortcut and select Properties.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add the command to the end of the &amp;quot;Target&amp;quot; line:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
--flush-stdout&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The end of the Target line should look like this then: &amp;lt;pre&amp;gt;\t-engine.exe --flush-stdout&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be used in combination with a [http://en.wikipedia.org/wiki/Tail_(Unix) tail] program that shows the content of the log file in realtime.&lt;br /&gt;
&lt;br /&gt;
=== Load module and create character on startup ===&lt;br /&gt;
&lt;br /&gt;
You can create a character once then use the premade from the command line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
t-engine -Mtome -n -E&amp;quot;auto_quickbirth='player'&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
if your premade was named &amp;quot;player.&amp;quot;  (Or create a shortcut in Windows, similarly to the instructions above for outputting log text to a file.)&lt;/div&gt;</summary>
		<author><name>StarKeep</name></author>	</entry>

	</feed>