summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2018-07-02 00:16:14 -0300
committerJesusaves <cpntb1@ymail.com>2018-07-02 00:16:14 -0300
commit367370970161a620c60fee5eb13fa3ac7d99ea41 (patch)
treee3df093af0a01b5443f432027926f9731b6b3284
parent36d1cfca08d38941f1f726d01b261d2e944a1c9d (diff)
downloadserverdata-367370970161a620c60fee5eb13fa3ac7d99ea41.tar.gz
serverdata-367370970161a620c60fee5eb13fa3ac7d99ea41.tar.bz2
serverdata-367370970161a620c60fee5eb13fa3ac7d99ea41.tar.xz
serverdata-367370970161a620c60fee5eb13fa3ac7d99ea41.zip
Attempt to rewrite magic to use more function helpers
-rw-r--r--npc/config/magic.txt48
-rw-r--r--npc/magic/zarkor.txt46
-rw-r--r--npc/scripts.conf1
3 files changed, 55 insertions, 40 deletions
diff --git a/npc/config/magic.txt b/npc/config/magic.txt
new file mode 100644
index 000000000..0ec8dd99b
--- /dev/null
+++ b/npc/config/magic.txt
@@ -0,0 +1,48 @@
+// TMW2 script
+// Author: Jesusalva <admin@tmw2.org>
+//
+// Magic Script Core Functions
+//
+// Used for our pseudo-magic.
+// These are only helpers, you can add more restrictions and effects freely.
+
+// SkillID, Mana, MobID{, MP per level, Script}
+function script SummonMagic {
+ .@sk=getarg(0);
+ .@mp=getarg(1);
+ .@id=getarg(2);
+ .@scr$=getarg(4,"Cassia::OnSkip");
+
+ // PRE EXECUTION
+ // Check Skill
+ if (getskilllv(.@sk) < 1)
+ end;
+
+ // Load mana cost
+ .@amp=getarg(3,0);
+ .@mp=.@mp+getskilllv(.@sk)*.@amp-.@amp;
+
+ // Check mana
+ if (readparam(Sp) < .@mp) {
+ dispbottom l("Insufficient mana: @@/@@.", readparam(Sp), .@mp);
+ end;
+ }
+
+
+ // EXECUTION
+ // Apply costs
+ heal 0, 0-.@mp;
+
+ // Cause effect
+ getmapxy(.@map$,.@x,.@y,0);
+ monster(.@map$, .@x, .@y, "Summoned Monster", .@id, getskilllv(.@sk), .@scr, Size_Medium, 1);
+ dispbottom l("All monsters summoned!");
+ /* AI Options
+ 0 = none (default)
+ 1 = attack/friendly
+ 2 = sphere (Alchemist skill)
+ 3 = flora (Alchemist skill)
+ 4 = zanzou (Kagerou/Oboro skill)
+ */
+
+}
diff --git a/npc/magic/zarkor.txt b/npc/magic/zarkor.txt
index a52484bf5..20cbb3f12 100644
--- a/npc/magic/zarkor.txt
+++ b/npc/magic/zarkor.txt
@@ -14,57 +14,23 @@ OnNone:
end;
OnCall:
- // PRE EXECUTION
- // Check Skill
- if (getskilllv(TMW2_ZARKOR) < 1)
- end;
-
- // Check cooldown
- /*
- if (@skzarkor_cooldown > gettimetick(0)) {
- dispbottom l("Cannot cast that now.");
- end;
- }
- */
-
- // Check mana
- if (readparam(Sp) < 400) {
- dispbottom l("Insufficient mana.");
- end;
- }
-
// Other requeriments
if (countitem(ZarkorScroll) < 1) {
dispbottom l("You need @@ to cast this skill.", getitemlink(ZarkorScroll));
end;
}
- // EXECUTION
- // Apply costs
- heal 0, -400;
-
- // Cause effect
- getmapxy(.@map$,.@x,.@y,0);
- monster(.@map$, .@x, .@y, "Summoned Monster", CaveMaggot, 1, "sk#zarkor::OnNone", Size_Medium, 1);
- dispbottom l("All monsters summoned!");
- /*
-<size> can be:
- Size_Medium = medium (default)
- Size_Small = small
- Size_Large = big
+ // Check cooldown
+ /* TODO */
-<ai> can be:
- 0 = none (default)
- 1 = attack/friendly
- 2 = sphere (Alchemist skill)
- 3 = flora (Alchemist skill)
- 4 = zanzou (Kagerou/Oboro skill)
+ // Summon Magic
+ SummonMagic(TMW2_ZARKOR, 400, CaveMaggot, 75, "sk#zarkor::OnNone");
- */
- // POST EXECUTION
+ /*
// set cooldown
@skzarkor_cooldown=gettimetick(0)+20;
+ */
end;
OnInit:
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 69261c6a9..855348647 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -74,6 +74,7 @@
// config script
"npc/config/hairstyle_config.txt",
+"npc/config/magic.txt",
// Magic Commands
"npc/magic/zarkor.txt",