summaryrefslogtreecommitdiff
path: root/npc/functions/npcmovegraph.txt
diff options
context:
space:
mode:
authorJoseph Botosh <rumly111@gmail.com>2015-09-17 00:59:13 +0300
committerJoseph Botosh <rumly111@gmail.com>2015-09-17 01:02:29 +0300
commit87fa4b967fd8670313d991eb0e65bca51f4aba41 (patch)
treec2e595afa5811fe789ea24297971424d2e3c14a9 /npc/functions/npcmovegraph.txt
parent468bdabc8b0bf14ca4662eaf998742391a75462c (diff)
downloadserverdata-87fa4b967fd8670313d991eb0e65bca51f4aba41.tar.gz
serverdata-87fa4b967fd8670313d991eb0e65bca51f4aba41.tar.bz2
serverdata-87fa4b967fd8670313d991eb0e65bca51f4aba41.tar.xz
serverdata-87fa4b967fd8670313d991eb0e65bca51f4aba41.zip
add initial pos to firstmove function as 2nd arg
Diffstat (limited to 'npc/functions/npcmovegraph.txt')
-rw-r--r--npc/functions/npcmovegraph.txt12
1 files changed, 11 insertions, 1 deletions
diff --git a/npc/functions/npcmovegraph.txt b/npc/functions/npcmovegraph.txt
index f7bd8e6d..d3db8765 100644
--- a/npc/functions/npcmovegraph.txt
+++ b/npc/functions/npcmovegraph.txt
@@ -201,11 +201,21 @@ function script movetonextpoint {
return;
}
+// initial actions for npc when using move graphs.
+// function can accept 2 arguments:
+// 1: action sequence, for example "speed 200; dir 4". Default is "moveon"
+// 2: start point label. Default is #0 from move graph labels
function script firstmove {
.@nextcmd$ = "moveon";
+ .@initpos = 0;
if (getargcount() > 0)
.@nextcmd$ = getarg(0);
- set getvariableofnpc(.movepos, strnpcinfo(3)), 0;
+ if (getargcount() > 1)
+ .@initpos = findmovegraphlabel(getarg(1));
+
+ set getvariableofnpc(.movepos, strnpcinfo(3)), .@initpos;
+ movenpc strnpcinfo(3), getvariableofnpc(.moveposx[.@initpos], strnpcinfo(3)),
+ getvariableofnpc(.moveposy[.@initpos], strnpcinfo(3));
set getvariableofnpc(.nextcmd$, strnpcinfo(3)), .@nextcmd$;
set getvariableofnpc(.waitticks, strnpcinfo(3)), -1;
movetonextpoint;