summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-23 19:14:55 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-23 19:14:55 +0300
commit73ccd23e1ff25cb1194cde9fa5789e6a8f9ed547 (patch)
tree8e07ac831910ddeb844e6425221ad3d8b53fcafd
parent40f4c1b085e909f467fcf319e2cbb068c86e561c (diff)
downloadserverdata-73ccd23e1ff25cb1194cde9fa5789e6a8f9ed547.tar.gz
serverdata-73ccd23e1ff25cb1194cde9fa5789e6a8f9ed547.tar.bz2
serverdata-73ccd23e1ff25cb1194cde9fa5789e6a8f9ed547.tar.xz
serverdata-73ccd23e1ff25cb1194cde9fa5789e6a8f9ed547.zip
Move timer logic for simple npcs to function.
-rw-r--r--npc/001-1/carmie.txt9
-rw-r--r--npc/001-1/nalkri.txt9
-rw-r--r--npc/001-1/xilaxa.txt9
-rw-r--r--npc/001-2-2/moon.txt9
-rw-r--r--npc/functions/npcmove.txt11
-rw-r--r--npc/test/npc4.txt9
6 files changed, 16 insertions, 40 deletions
diff --git a/npc/001-1/carmie.txt b/npc/001-1/carmie.txt
index 1f8680ab..014664c0 100644
--- a/npc/001-1/carmie.txt
+++ b/npc/001-1/carmie.txt
@@ -9,14 +9,7 @@
close;
OnTimer1000:
- if (isunitwalking())
- {
- initnpctimer;
- end;
- }
- movetonextpos;
- initnpctimer;
- end;
+ domovestep;
OnInit:
initpath "move", 89, 68,
diff --git a/npc/001-1/nalkri.txt b/npc/001-1/nalkri.txt
index 4d0a26bd..6e8f0101 100644
--- a/npc/001-1/nalkri.txt
+++ b/npc/001-1/nalkri.txt
@@ -9,14 +9,7 @@
close;
OnTimer1000:
- if (isunitwalking())
- {
- initnpctimer;
- end;
- }
- movetonextpos;
- initnpctimer;
- end;
+ domovestep;
OnInit:
initpath "move", 56, 84,
diff --git a/npc/001-1/xilaxa.txt b/npc/001-1/xilaxa.txt
index 62b0a8f4..b1a90da5 100644
--- a/npc/001-1/xilaxa.txt
+++ b/npc/001-1/xilaxa.txt
@@ -9,14 +9,7 @@
close;
OnTimer1000:
- if (isunitwalking())
- {
- initnpctimer;
- end;
- }
- movetonextpos;
- initnpctimer;
- end;
+ domovestep;
OnInit:
initpath "move", 52, 54,
diff --git a/npc/001-2-2/moon.txt b/npc/001-2-2/moon.txt
index a50a8435..44b07e17 100644
--- a/npc/001-2-2/moon.txt
+++ b/npc/001-2-2/moon.txt
@@ -189,14 +189,7 @@ L_Close:
close;
OnTimer1000:
- if (isunitwalking())
- {
- initnpctimer;
- end;
- }
- movetonextpos;
- initnpctimer;
- end;
+ domovestep;
OnTouch:
SayRandomGreeting;
diff --git a/npc/functions/npcmove.txt b/npc/functions/npcmove.txt
index e8aa38aa..ab29dd35 100644
--- a/npc/functions/npcmove.txt
+++ b/npc/functions/npcmove.txt
@@ -129,3 +129,14 @@ function script getmovecmd {
return "";
return getvariableofnpc(.movepathcmd$[.@pos], strnpcinfo(3));
}
+
+function script domovestep {
+ if (isunitwalking())
+ {
+ initnpctimer;
+ end;
+ }
+ movetonextpos;
+ initnpctimer;
+ end;
+}
diff --git a/npc/test/npc4.txt b/npc/test/npc4.txt
index 09f85bb7..a3acdd0e 100644
--- a/npc/test/npc4.txt
+++ b/npc/test/npc4.txt
@@ -7,14 +7,7 @@
test,25,20,0 script npc4 NPC_PLAYER,{
close;
OnTimer1000:
- if (isunitwalking())
- {
- initnpctimer;
- end;
- }
- movetonextpos;
- initnpctimer;
- end;
+ domovestep;
OnInit:
.walkmask = WALK_WATER;
initpath "move", 20, 20,