summaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/permissions.xml4
-rw-r--r--example/scripts/special_actions.lua33
-rw-r--r--example/specials.xml27
3 files changed, 37 insertions, 27 deletions
diff --git a/example/permissions.xml b/example/permissions.xml
index e661586..4c46af1 100644
--- a/example/permissions.xml
+++ b/example/permissions.xml
@@ -25,6 +25,10 @@
<allow>@killmonsters</allow>
<allow>@getpos</allow>
<allow>@effect</allow>
+ <allow>@givespecial</allow>
+ <allow>@takespecial</allow>
+ <allow>@rechargespecial</allow>
+ <allow>@listspecials</allow>
</class>
<class level="4">
<alias>gm</alias>
diff --git a/example/scripts/special_actions.lua b/example/scripts/special_actions.lua
index 25619f4..6070ecd 100644
--- a/example/scripts/special_actions.lua
+++ b/example/scripts/special_actions.lua
@@ -8,28 +8,15 @@
--]]
-local specialCost = {}
-specialCost[1] = 50
-specialCost[2] = 250
-specialCost[3] = 1000
+local spell1 = get_special_info("Magic_Test Spell 1")
+spell1:on_use(function(user, target, specialid)
+ target = target or user
+ being_say(target, "Kaaame...Haaame... HAAAAAA!")
+ chr_set_special_mana(user, specialid, 0)
+end)
+spell1:on_recharged(function(ch) being_say(ch, "Hoooooooo...") end)
-local function use_special(ch, id)
- -- perform whatever the special with the ID does
- if id == 1 then
- being_say(ch, "Kaaame...Haaame... HAAAAAA!")
- end
- if id == 2 then
- being_say(ch, "HAA-DOKEN!")
- end
- if id == 3 then
- being_say(ch, "Sonic BOOM")
- end
-end
+local spell2 = get_special_info(2)
+spell2:on_use(function(user) being_say(user, "HAA-DOKEN!") end)
-local function get_special_recharge_cost(id)
- -- return the recharge cost for the special with the ID
- return specialCost[id]
-end
-
-on_use_special(use_special)
-on_get_special_recharge_cost(get_special_recharge_cost)
+get_special_info(3):on_use(function(user) being_say(user, "Sonic BOOM") end)
diff --git a/example/specials.xml b/example/specials.xml
index c234f66..2c1d61a 100644
--- a/example/specials.xml
+++ b/example/specials.xml
@@ -1,9 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<specials>
<set name="Magic">
- <special id="1" name="Test Spell 1" active="true" recharge="true" />
- <special id="2" name="Test Spell 2" active="true" recharge="true" />
- <special id="3" name="Test Spell 3" active="true" recharge="true" />
- <special id="4" name="Passive Special 1" active="false" />
+ <special
+ id="1"
+ name="Test Spell 1"
+ rechargeable="true"
+ needed="100"
+ rechargespeed="10"
+ />
+ <special
+ id="2"
+ name="Test Spell 2"
+ rechargeable="true"
+ needed="1000"
+ rechargespeed="10"
+ target="being"
+ />
+ <special
+ id="3"
+ name="Test Spell 3"
+ rechargeable="true"
+ needed="10000"
+ rechargespeed="10"
+ target="point"
+ />
</set>
</specials>