summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-16 12:13:45 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-16 12:13:45 +0300
commit0bc40e4ddc5365451a2c7fa84e5bb395b17e76cf (patch)
treefb4a6717effdfa34a94ffde9b3751858bb0ffe28
parent2d6ba5af5b0ea8f2c4d0dd957c09bb7c6674fd51 (diff)
downloadserverdata-0bc40e4ddc5365451a2c7fa84e5bb395b17e76cf.tar.gz
serverdata-0bc40e4ddc5365451a2c7fa84e5bb395b17e76cf.tar.bz2
serverdata-0bc40e4ddc5365451a2c7fa84e5bb395b17e76cf.tar.xz
serverdata-0bc40e4ddc5365451a2c7fa84e5bb395b17e76cf.zip
Add door script on test map.
Add door functions.
-rw-r--r--npc/functions/doors.txt34
-rw-r--r--npc/scripts.conf1
-rw-r--r--npc/test/npc1.txt25
3 files changed, 54 insertions, 6 deletions
diff --git a/npc/functions/doors.txt b/npc/functions/doors.txt
new file mode 100644
index 00000000..1fc4163d
--- /dev/null
+++ b/npc/functions/doors.txt
@@ -0,0 +1,34 @@
+// Evol functions.
+// Authors:
+// 4144
+// Description:
+// Doors utility functions
+// Variables:
+// none
+
+function script doorTouch {
+ if (getareausers() <= 1)
+ {
+ setnpcdir 2;
+ stopnpctimer;
+ initnpctimer;
+ }
+ close;
+}
+
+function script doorUnTouch {
+ if (getareausers() == 0)
+ {
+ setnpcdir 4;
+ initnpctimer;
+ startnpctimer;
+ }
+ close;
+}
+
+function script doorTimer {
+ stopnpctimer;
+ if (getnpcdir() == 2) setnpcdir 6;
+ if (getnpcdir() == 4) setnpcdir 8;
+ end;
+}
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 59275d45..ce4642d6 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -11,6 +11,7 @@ npc: npc/functions/inventoryplace.txt
npc: npc/functions/goodbye.txt
npc: npc/functions/sailordialogue.txt
npc: npc/functions/savepoint.txt
+npc: npc/functions/doors.txt
// Maps specific scripts
import: npc/_import.txt
diff --git a/npc/test/npc1.txt b/npc/test/npc1.txt
index e4c9c4d8..7d96b971 100644
--- a/npc/test/npc1.txt
+++ b/npc/test/npc1.txt
@@ -4,6 +4,14 @@
// Description:
// test npc1
+test,10,10,0 script npc1#door 32767,0,1,{
+OnTouch:
+ warp "test", 20, 20;
+ close;
+OnUnTouch:
+ doevent "npc1::OnUnTouch";
+}
+
test,10,10,0 script npc1 800,3,3,{
function areatest
{
@@ -18,18 +26,23 @@ test,10,10,0 script npc1 800,3,3,{
return;
}
mes "talk";
+ for (.@f = 0; .@f < 9; .@f ++)
+ {
+ mes "" + .@f;
+ setnpcdir .@f;
+ next;
+ }
areatest;
close;
OnTouch:
- mes "OnTouch";
- areatest;
- close;
+ doorTouch;
OnUnTouch:
- mes "OnUnTouch";
- areatest;
- close;
+ doorUnTouch;
+
+OnTimer340:
+ doorTimer;
OnInit:
setnpcsex G_MALE;