summaryrefslogtreecommitdiff
path: root/npc/functions/npcmove.txt
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-05 00:20:01 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-05 00:20:46 +0300
commit45eeb456802331db4756fe5acf4a1cb13477fcec (patch)
tree8ecf7466f5212889fb4c16b5248324f3339b822a /npc/functions/npcmove.txt
parent479aac0b2e30c7bbc07870696658c1fda1efbb9d (diff)
downloadserverdata-45eeb456802331db4756fe5acf4a1cb13477fcec.tar.gz
serverdata-45eeb456802331db4756fe5acf4a1cb13477fcec.tar.bz2
serverdata-45eeb456802331db4756fe5acf4a1cb13477fcec.tar.xz
serverdata-45eeb456802331db4756fe5acf4a1cb13477fcec.zip
Add into npc moving program new commands: rmove, emote, warp, class, goto.
Also some commands here not waiting next tick for continue execution.
Diffstat (limited to 'npc/functions/npcmove.txt')
-rw-r--r--npc/functions/npcmove.txt50
1 files changed, 42 insertions, 8 deletions
diff --git a/npc/functions/npcmove.txt b/npc/functions/npcmove.txt
index 783539a9..346549fc 100644
--- a/npc/functions/npcmove.txt
+++ b/npc/functions/npcmove.txt
@@ -39,17 +39,40 @@ function script domoveaction {
else if (.@cmd$ == "dir")
{
setnpcdir getvariableofnpc(.movepathx[.@pos], strnpcinfo(3));
+ return 2;
}
else if (.@cmd$ == "wait")
{
set getvariableofnpc(.waitticks, strnpcinfo(3)), getvariableofnpc(.movepathx[.@pos], strnpcinfo(3));
}
+ else if (.@cmd$ == "emote")
+ {
+ unitemote getnpcid(0), getvariableofnpc(.movepathx[.@pos], strnpcinfo(3));
+ return 2;
+ }
+ else if (.@cmd$ == "class")
+ {
+ setnpcdisplay strnpcinfo(3), getvariableofnpc(.movepathx[.@pos], strnpcinfo(3));
+ return 2;
+ }
+ else if (.@cmd$ == "warp")
+ {
+ movenpc strnpcinfo(3), getvariableofnpc(.movepathx[.@pos], strnpcinfo(3)), getvariableofnpc(.movepathy[.@pos], strnpcinfo(3));
+ }
+ else if (.@cmd$ == "goto")
+ {
+ set getvariableofnpc(.movepos, strnpcinfo(3)), getvariableofnpc(.movepathx[.@pos], strnpcinfo(3));
+ return 0;
+ }
+ else if (.@cmd$ == "rmove")
+ {
+ getmapxy(.@mapName$, .@x, .@y, 1);
+ npcwalkto .@x + getvariableofnpc(.movepathx[.@pos], strnpcinfo(3)), .@y + getvariableofnpc(.movepathy[.@pos], strnpcinfo(3));
+ }
return 1;
}
function script movetonextpos {
- .@pos = getvariableofnpc(.movepos, strnpcinfo(3));
- //debugmes "movetonextpos: " + str(.@pos);
.@wait = getvariableofnpc(.waitticks, strnpcinfo(3));
if (.@wait > 0)
{
@@ -58,13 +81,24 @@ function script movetonextpos {
set getvariableofnpc(.waitticks, strnpcinfo(3)), .@wait;
return;
}
- .@res = domoveaction(.@pos);
- if (.@res)
+ .@true = 1;
+ while (.@true)
{
- .@pos++;
- if (.@pos >= getarraysize(getvariableofnpc(.movepathx, strnpcinfo(3))))
- .@pos = 0;
- set getvariableofnpc(.movepos, strnpcinfo(3)), .@pos;
+ .@true = 0;
+ .@pos = getvariableofnpc(.movepos, strnpcinfo(3));
+ //debugmes "movetonextpos: " + str(.@pos);
+ .@res = domoveaction(.@pos);
+ if (.@res == 1 || .@res == 2)
+ {
+ .@pos++;
+ if (.@pos >= getarraysize(getvariableofnpc(.movepathx, strnpcinfo(3))))
+ .@pos = 0;
+ set getvariableofnpc(.movepos, strnpcinfo(3)), .@pos;
+ }
+ if (.@res == 0 || .@res == 2)
+ {
+ .@true = 1;
+ }
}
return;
}