diff options
author | gumi <mekolat@users.noreply.github.com> | 2017-08-20 12:25:41 -0400 |
---|---|---|
committer | gumi <mekolat@users.noreply.github.com> | 2017-08-22 11:45:09 -0400 |
commit | 2c87bb38c881639bed963e7933a1e9d9c2e8e6a3 (patch) | |
tree | d9e26c7592316293f333a7384c6f9a92b2afe8bd /npc | |
parent | e9c90337a6057b66faad6759ff418e8a5f162cfe (diff) | |
download | serverdata-2c87bb38c881639bed963e7933a1e9d9c2e8e6a3.tar.gz serverdata-2c87bb38c881639bed963e7933a1e9d9c2e8e6a3.tar.bz2 serverdata-2c87bb38c881639bed963e7933a1e9d9c2e8e6a3.tar.xz serverdata-2c87bb38c881639bed963e7933a1e9d9c2e8e6a3.zip |
fix the npc talk lock mechanism, make some other npcs use it
Diffstat (limited to 'npc')
-rw-r--r-- | npc/001-1/juscare.txt | 10 | ||||
-rw-r--r-- | npc/001-1/lucas.txt | 10 | ||||
-rw-r--r-- | npc/001-1/merlin.txt | 43 | ||||
-rw-r--r-- | npc/001-1/mouboo.txt | 8 | ||||
-rw-r--r-- | npc/functions/asleep.txt | 18 | ||||
-rw-r--r-- | npc/functions/goodbye.txt | 4 | ||||
-rw-r--r-- | npc/functions/hello.txt | 6 | ||||
-rw-r--r-- | npc/functions/legiontalk.txt | 33 | ||||
-rw-r--r-- | npc/functions/main.txt | 12 | ||||
-rw-r--r-- | npc/functions/mouboofunc.txt | 16 | ||||
-rw-r--r-- | npc/functions/sailortalk.txt | 23 | ||||
-rw-r--r-- | npc/functions/villagertalk.txt | 8 |
12 files changed, 70 insertions, 121 deletions
diff --git a/npc/001-1/juscare.txt b/npc/001-1/juscare.txt index 694668af..393186fa 100644 --- a/npc/001-1/juscare.txt +++ b/npc/001-1/juscare.txt @@ -22,14 +22,6 @@ close; } - function randomTalk { - if (Repeat_NPC_lock <= gettimetick(2)) - { - Repeat_NPC_lock = gettimetick(2) + 2; - villagertalk; - } - } - npc_pausemove; @Juscar_old_dir = -1; if (shouldTurn()) @@ -39,7 +31,7 @@ npc_turntoxy(.@cx, .@cy); } - randomTalk; + villagertalk(); localClose; diff --git a/npc/001-1/lucas.txt b/npc/001-1/lucas.txt index 2104b5b5..4058d72e 100644 --- a/npc/001-1/lucas.txt +++ b/npc/001-1/lucas.txt @@ -6,15 +6,7 @@ 001-1,59,44,0 script Lucas#001-1 NPC_LUCAS,{ - function randomTalk { - if (Repeat_NPC_lock <= gettimetick(2)) - { - Repeat_NPC_lock = gettimetick(2) + 2; - villagertalk; - } - } - - randomTalk; + villagertalk(); closedialog; close; diff --git a/npc/001-1/merlin.txt b/npc/001-1/merlin.txt index d970f537..0d9a8b30 100644 --- a/npc/001-1/merlin.txt +++ b/npc/001-1/merlin.txt @@ -6,44 +6,17 @@ 001-1,73,128,0 script Merlin NPC_MERLIN,2,2,{ - function randomDialogue { - closedialog; - - .@r = rand (6); - if (.@r == 0) - { - npctalk3 l("Fish, come and see my fish!"); - } - else if (.@r == 1) - { - npctalk3 l("They are fresh, they are good!"); - } - else if (.@r == 2) - { - npctalk3 l("Fresh from the sea and cheap!"); - } - else if (.@r == 3) - { - npctalk3 l("Come, come and see!"); - } - else if (.@r == 4) - { - npctalk3 l("They are fresh!"); - } - else - { - npctalk3 l("Fish is good for the brain!"); - } - close; - } - OnTouch: - if (Repeat_NPC_lock <= gettimetick(2)) + switch(rand(6)) { - Repeat_NPC_lock = gettimetick(2) + 1; - randomDialogue; + case 0: npctalkonce(l("Fish, come and see my fish!")); break; + case 0: npctalkonce(l("They are fresh, they are good!")); break; + case 0: npctalkonce(l("Fresh from the sea and cheap!")); break; + case 0: npctalkonce(l("Come, come and see!")); break; + case 0: npctalkonce(l("They are fresh!")); break; + default: npctalkonce(l("Fish is good for the brain!")); } - close; + end; OnInit: .sex = G_MALE; diff --git a/npc/001-1/mouboo.txt b/npc/001-1/mouboo.txt index be0294e1..bee13d1e 100644 --- a/npc/001-1/mouboo.txt +++ b/npc/001-1/mouboo.txt @@ -6,7 +6,7 @@ 001-1,67,79,4 script Mouboo#Artis0 NPC_MOUBOO,{ - mouboochecklock; + moubootalk(); close; OnTimer2000: @@ -21,7 +21,7 @@ OnInit: 001-1,67,80,4 script Mouboo#Artis1 NPC_MOUBOO,{ - mouboochecklock; + moubootalk(); close; OnTimer2000: @@ -36,7 +36,7 @@ OnInit: 001-1,67,81,4 script Mouboo#Artis2 NPC_MOUBOO,{ - mouboochecklock; + moubootalk(); close; OnTimer2000: @@ -51,7 +51,7 @@ OnInit: 001-1,67,82,4 script Mouboo#Artis3 NPC_MOUBOO,{ - mouboochecklock; + moubootalk(); close; OnTimer2000: diff --git a/npc/functions/asleep.txt b/npc/functions/asleep.txt index 4905f329..aa5abd63 100644 --- a/npc/functions/asleep.txt +++ b/npc/functions/asleep.txt @@ -8,14 +8,12 @@ // .@rand = Random number between the number of "sleeping" choice. function script asleep { - closedialog; - - .@rand = rand(5); - if (.@rand == 0) npctalk3 l("Zzzzzzzzz..."); - else if (.@rand == 1) npctalk3 l("Rrrr... Pchhhh..."); - else if (.@rand == 2) npctalk3 l("Ggrmm... Grmmmm..."); - else if (.@rand == 3) npctalk3 l("Hm... Shhhh..."); - else emotion E_SLEEPY; - - close; + switch(rand(5)) { + case 0: npctalkonce(l("Zzzzzzzzz...")); break; + case 1: npctalkonce(l("Rrrr... Pchhhh...")); break; + case 2: npctalkonce(l("Ggrmm... Grmmmm...")); break; + case 3: npctalkonce(l("Hm... Shhhh...")); break; + default: emotion(E_SLEEPY); + } + end; } diff --git a/npc/functions/goodbye.txt b/npc/functions/goodbye.txt index ce4e8dd6..620883b8 100644 --- a/npc/functions/goodbye.txt +++ b/npc/functions/goodbye.txt @@ -128,7 +128,7 @@ function script bye { // can also display an emote function script goodbye { - npctalk3 goodbye_msg(); + npctalkonce(goodbye_msg()); bye getarg(0, -1); } @@ -143,7 +143,7 @@ function script goodbye2 { .@emote = getarg(0, -1); close2; - npctalk3 goodbye_msg(); + npctalkonce(goodbye_msg()); if (.@emote >= 0) emotion .@emote; diff --git a/npc/functions/hello.txt b/npc/functions/hello.txt index 6f795c82..9399b3b5 100644 --- a/npc/functions/hello.txt +++ b/npc/functions/hello.txt @@ -9,13 +9,13 @@ function script hello { switch (rand(3)) { case 0: - npctalk3 l("Heya!"); + npctalkonce(l("Heya!")); break; case 1: - npctalk3 l("Hi."); + npctalkonce(l("Hi.")); break; case 2: - npctalk3 l("Nice day to you."); + npctalkonce(l("Nice day to you.")); break; } diff --git a/npc/functions/legiontalk.txt b/npc/functions/legiontalk.txt index 14743783..fbc35e1f 100644 --- a/npc/functions/legiontalk.txt +++ b/npc/functions/legiontalk.txt @@ -11,53 +11,54 @@ function script legiontalk { switch (rand(15)) { case 0: - npctalk3 l("Do I look like a tree? I feel like one."); - //speech S_LAST_NEXT, + npctalkonce(l("Do I look like a tree? I feel like one.")); + //speech( // l("Do you feel too weak even to do damage to this areas wishy-washy wildlife?"), // l("Then concentrate your anger upon the trees hereabouts, you will gain experience whilst leveling your sword skill on them."), - // l("Oh, and a fruit may even fall for you if you are lucky! But stay alert to pick up your drops."); + // l("Oh, and a fruit may even fall for you if you are lucky! But stay alert to pick up your drops.")); + //close; break; case 1: - npctalk3 l("I'm a little busy right now."); + npctalkonce(l("I'm a little busy right now.")); break; case 2: - npctalk3 l("Not in the mood to chat."); + npctalkonce(l("Not in the mood to chat.")); break; case 3: - npctalk3 l("My breath smells bad."); + npctalkonce(l("My breath smells bad.")); break; case 4: - npctalk3 l("Don't distract me, I have to stay alert."); + npctalkonce(l("Don't distract me, I have to stay alert.")); break; case 5: - npctalk3 l("Give me some space."); + npctalkonce(l("Give me some space.")); break; case 6: - npctalk3 l("Can you please go away?"); + npctalkonce(l("Can you please go away?")); break; case 7: - npctalk3 l("Can't talk right now, I'm on patrol duty."); + npctalkonce(l("Can't talk right now, I'm on patrol duty.")); break; case 8: - npctalk3 l("What're you looking at?!"); + npctalkonce(l("What're you looking at?!")); break; case 9: - npctalk3 l("I can't stay here and talk all day. I have a job to do."); + npctalkonce(l("I can't stay here and talk all day. I have a job to do.")); break; case 10: - npctalk3 lg("Keep moving girl.", "Keep moving boy."); + npctalkonce(lg("Keep moving girl.", "Keep moving boy.")); break; case 11: - npctalk3 lg("So you think you're tough? A warrior must also be loyal and patient."); + npctalkonce(lg("So you think you're tough? A warrior must also be loyal and patient.")); break; case 12: emotion E_LOOKAWAY; break; case 13: - npctalk3 l("Practice! There are no secrets to becoming a warrior."); + npctalkonce(l("Practice! There are no secrets to becoming a warrior.")); break; case 14: - npctalk3 l("There is no honor in fighting a weak opponent."); + npctalkonce(l("There is no honor in fighting a weak opponent.")); break; } diff --git a/npc/functions/main.txt b/npc/functions/main.txt index f3fca9b4..b2827a52 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -171,29 +171,29 @@ function script compareandsetq { function script npctalkonce { if (getarg(2, 0) == 0) { - if (now() <= @misc_NPC_lock) + if (gettimetick(2) <= @NPC_TALK_LOCK[getnpcid(0)]) { - @misc_NPC_lock = now() + getarg(1, 1); return false; } + @NPC_TALK_LOCK[getnpcid(0)] = gettimetick(2) + getarg(1, 1); npctalk3(getarg(0)); } else if (getarg(2, 0) == 1) { - if (now() <= .talk_lock) + if (gettimetick(2) <= .talk_lock) { - .talk_lock = now() + getarg(1, 1); return false; } + .talk_lock = gettimetick(2) + getarg(1, 1); npctalk(getarg(0)); } else if (getarg(2, 0) == 2) { - if (now() <= @misc_NPC_lock) + if (gettimetick(2) <= @NPC_TALK_LOCK[getnpcid(0)]) { - @misc_NPC_lock = now() + getarg(1, 1); return false; } + @NPC_TALK_LOCK[getnpcid(0)] = gettimetick(2) + getarg(1, 1); message(strcharinfo(0), getarg(0)); } diff --git a/npc/functions/mouboofunc.txt b/npc/functions/mouboofunc.txt index f01e4847..c0f7d96b 100644 --- a/npc/functions/mouboofunc.txt +++ b/npc/functions/mouboofunc.txt @@ -8,16 +8,16 @@ function script moubootalk { switch (rand (4)) { case 0: - npctalk3 l("Moooooo!"); + npctalkonce(l("Moooooo!")); break; case 1: - npctalk3 l("Moo!"); + npctalkonce(l("Moo!")); break; case 2: - npctalk3 l("Moooooooooooo!"); + npctalkonce(l("Moooooooooooo!")); break; case 3: - npctalk3 l("Moooo!"); + npctalkonce(l("Moooo!")); break; } return; @@ -87,11 +87,3 @@ function script mouboograph { initnpctimer; end; } - -function script mouboochecklock { - if (Repeat_NPC_lock <= gettimetick (2)) - { - Repeat_NPC_lock = gettimetick (2) + 1; - moubootalk; - } -} diff --git a/npc/functions/sailortalk.txt b/npc/functions/sailortalk.txt index 49bc62f8..73145768 100644 --- a/npc/functions/sailortalk.txt +++ b/npc/functions/sailortalk.txt @@ -12,25 +12,26 @@ function script sailortalk { if (.@rand == 0) goodbye; if (.@rand == 1) { - speech S_LAST_NEXT, + speech( l("These purple mushrooms are called @@s. There are plenty of 'em on this island!", getitemlink(Plushroom)), l("It's a kind of mushroom that tastes like a marshmallow and looks like a plush! @@, get it?", getitemlink(Plushroom)), - l("These funny fungi are mushrooming all around this island. Just pick some @@s and have a try.", getitemlink(Plushroom)); + l("These funny fungi are mushrooming all around this island. Just pick some @@s and have a try.", getitemlink(Plushroom))); + close; } - if (.@rand == 2) npctalk3 l("Good to hear from you!"); - if (.@rand == 3) npctalk3 l("So finally someone has came to visit me?"); + if (.@rand == 2) npctalkonce(l("Good to hear from you!")); + if (.@rand == 3) npctalkonce(l("So finally someone has came to visit me?")); if (.@rand == 4) { - speech S_LAST_NEXT, + speech( l("A sunny and hot day,"), l("a quiet place,"), l("a ground!"), - l("What else do you need?"); + l("What else do you need?")); + close; } - if (.@rand == 5) npctalk3 l("A-hoy matey!"); - if (.@rand == 6) npctalk3 l("We are glad captain Nard has let you join the crew!"); - if (.@rand == 7) npctalk3 l("Howdy?"); + if (.@rand == 5) npctalkonce(l("A-hoy matey!")); + if (.@rand == 6) npctalkonce(l("We are glad captain Nard has let you join the crew!")); + if (.@rand == 7) npctalkonce(l("Howdy?")); - closedialog; - close; + end; } diff --git a/npc/functions/villagertalk.txt b/npc/functions/villagertalk.txt index 6440ef0d..371a9f20 100644 --- a/npc/functions/villagertalk.txt +++ b/npc/functions/villagertalk.txt @@ -24,7 +24,7 @@ function script villagertalk { } else { - npctalk3 l("Stop it!"); + npctalkonce(l("Stop it!")); } return; @@ -36,13 +36,13 @@ function script villagertalk { darn_or_smile(); break; case 1: - npctalk3 l("It is a sunny day, don't you think?"); + npctalkonce(l("It is a sunny day, don't you think?")); break; case 2: - npctalk3 l("Go fly a kite."); + npctalkonce(l("Go fly a kite.")); break; case 3: - npctalk3 l("I just want to live my life in peace."); + npctalkonce(l("I just want to live my life in peace.")); break; default: emotion E_HAPPY; |