summaryrefslogtreecommitdiff
path: root/npc/functions/main.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-07-13 00:01:46 -0300
committerJesusaves <cpntb1@ymail.com>2021-07-13 00:01:46 -0300
commit1c6f15feae59ae309033c46e722dcd620e3be48a (patch)
treed697e00c112b9d8e391e71c603e06b3fb1221dca /npc/functions/main.txt
parenta7e396a0d5459f401a916d7361ece608fed0c49f (diff)
downloadserverdata-1c6f15feae59ae309033c46e722dcd620e3be48a.tar.gz
serverdata-1c6f15feae59ae309033c46e722dcd620e3be48a.tar.bz2
serverdata-1c6f15feae59ae309033c46e722dcd620e3be48a.tar.xz
serverdata-1c6f15feae59ae309033c46e722dcd620e3be48a.zip
New NPC Utility: spawndummy() - Spawns a monster without params for script use.
It returns the spawned monster GID so setunitdata() can configure it properly
Diffstat (limited to 'npc/functions/main.txt')
-rw-r--r--npc/functions/main.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index 4a0c9c22..bf69551e 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -748,3 +748,37 @@ function script learnskill {
return;
}
+function script spawndummy {
+ // spawndummy(map, x, y, ID{, name{, event}})
+ .@m$=getarg(0);
+ .@x=getarg(1);
+ .@y=getarg(2);
+ .@id=getarg(3);
+ .@n$=getarg(4, strmobinfo(1, .@id));
+ .@e$=getarg(5, "");
+ // Create monster, with optional event
+ if (.@e$ == "")
+ .@u=monster(.@m$, .@x, .@y, .@n$, .@id, 1);
+ else
+ .@u=monster(.@m$, .@x, .@y, .@n$, .@id, 1, .@e$);
+ // Reset unit data for script use
+ setunitdata(.@u, UDT_LEVEL, 1);
+ setunitdata(.@u, UDT_HP, 1);
+ setunitdata(.@u, UDT_MAXHP, 1);
+ setunitdata(.@u, UDT_SP, 1);
+ setunitdata(.@u, UDT_MAXSP, 1);
+ setunitdata(.@u, UDT_MODE, 0); // Stoic mode
+ setunitdata(.@u, UDT_ATKRANGE, 1);
+ setunitdata(.@u, UDT_ATKMIN, 1);
+ setunitdata(.@u, UDT_ATKMAX, 1);
+ setunitdata(.@u, UDT_MATKMIN, 1);
+ setunitdata(.@u, UDT_MATKMAX, 1);
+ setunitdata(.@u, UDT_DEF, 1);
+ setunitdata(.@u, UDT_MDEF, 1);
+ setunitdata(.@u, UDT_HIT, 1);
+ setunitdata(.@u, UDT_FLEE, 1);
+ setunitdata(.@u, UDT_CRIT, 1);
+ setunitdata(.@u, UDT_LOOKDIR, DOWN);
+ return .@u;
+}
+