diff options
-rw-r--r-- | npc/functions/doors.txt | 34 | ||||
-rw-r--r-- | npc/scripts.conf | 1 | ||||
-rw-r--r-- | npc/test/npc1.txt | 25 |
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; |