This repository was archived by the owner on Mar 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRPGFigurine.html
More file actions
65 lines (63 loc) · 3.72 KB
/
RPGFigurine.html
File metadata and controls
65 lines (63 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
RPGFigurine is a special <a href="http://berserk-games.com/knowledgebase/object">Object</a> type that has access to animations for RPG Figurines from the RPG Kit. Once you have a reference to an <a href="http://berserk-games.com/knowledgebase/object">Object</a> you can call these functions like this: <font face="monospace">obj.RPGFigurine.attack()</font>.
Using the RPGFigurine events:
<blockquote><font face="monospace">
elf_guid = "7d884d"
elf = {}
knight_guid = "d08759"
knight = {}
ogre_guid = "604e4b"
ogre = {}
function onLoad()
elf = getObjectFromGUID(elf_guid)
knight = getObjectFromGUID(knight_guid)
ogre = getObjectFromGUID(ogre_guid)
<br />
function ogre.RPGFigurine.onAttack(hit_list)
for i, v in ipairs(hit_list) do
print('Ogre attacked ' .. i .. ': ' .. v.name)
end
end
<br />
function elf.RPGFigurine.onHit(attacker)
print('Elf hit by ' .. attacker.name)
end
<br />
function knight.RPGFigurine.onHit(attacker)
print('Knight hit by ' .. attacker.name)
end
end
</font></blockquote>
<a class="anchor" name="Functions"></a>
<table width="100%">
<caption><strong><h3>Functions</h3></strong></caption>
<tr>
<th class="table_column_rv">Return Value</th>
<th class="table_column_fn">Function Name</th>
<th>Description</th>
</tr>
<tr>
<td><font face="monospace">bool</font></td>
<td><font face="monospace">attack()</font></td>
<td><a class="anchor" name="attack"></a>Plays a random attack animation.</td>
</tr>
<tr>
<td><font face="monospace">bool</font></td>
<td><font face="monospace">changeMode()</font></td>
<td><a class="anchor" name="changeMode"></a>Changes the RPG Figurine's current mode. This can either be a different idle animation or changing held weapons depending on the RPG Figurine.</td>
</tr>
<tr>
<td><font face="monospace">bool</font></td>
<td><font face="monospace">die()</font></td>
<td><a class="anchor" name="die"></a>Plays the death animation. Call <font face="monospace">die()</font> again to reset the RPG Figurine.</td>
</tr>
<tr>
<td><font face="monospace">none</font></td>
<td><font face="monospace">onAttack(Table hit_list)</font></td>
<td><a class="anchor" name="onAttack"></a>This function is called, if it exists in your script, when this RPGFigurine attacks another RPGFigurine. The parameter <font face="monospace">hit_list</font> will be an indexed list of all the RPGFigurines that were hit during the attack. This function should be defined after a reference is retrieved to the RPGFigurine - see example above defining the <font face="monospace">onAttack()</font> inside of the <a href="http://berserk-games.com/knowledgebase/api/#onLoad"><font face="monospace">onLoad()</font></a> function.</td>
</tr>
<tr>
<td><font face="monospace">none</font></td>
<td><font face="monospace">onHit(<a href="http://berserk-games.com/knowledgebase/object">Object</a> attacker)</font></td>
<td><a class="anchor" name="onHit"></a>This function is called, if it exists in your script, when this RPGFigurine is attacked by another RPGFigurine. This function should be defined after a reference is retrieved to the RPGFigurine - see example above defining the <font face="monospace">onHit()</font> inside of the <a href="http://berserk-games.com/knowledgebase/api/#onLoad"><font face="monospace">onLoad()</font></a> function.</td>
</tr>
</table>