summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2011-09-07 12:41:43 -0700
committerBen Longbons <b.r.longbons@gmail.com>2011-09-07 13:03:32 -0700
commitd7d75d5d4a8226943d0a1a6625bb946e61e23c83 (patch)
treec9a4558ff30a870a5f27f58bf6404f37605affa5
parentdc809dd5da73b2a1ec88eca1a4c0c555f7fc5ce6 (diff)
downloadserverdata-d7d75d5d4a8226943d0a1a6625bb946e61e23c83.tar.gz
serverdata-d7d75d5d4a8226943d0a1a6625bb946e61e23c83.tar.bz2
serverdata-d7d75d5d4a8226943d0a1a6625bb946e61e23c83.tar.xz
serverdata-d7d75d5d4a8226943d0a1a6625bb946e61e23c83.zip
Improve logic and fix bugs in Tanisha script.
Requires the server patch to allow argumentless script functions
-rw-r--r--world/map/npc/042-2/tanisha.txt159
1 files changed, 83 insertions, 76 deletions
diff --git a/world/map/npc/042-2/tanisha.txt b/world/map/npc/042-2/tanisha.txt
index dd4b57ac..c3c0d199 100644
--- a/world/map/npc/042-2/tanisha.txt
+++ b/world/map/npc/042-2/tanisha.txt
@@ -1,11 +1,10 @@
// This file is part of the Tutorial
// Authors: Jenalya, alastrim
+// Cleanup: o11c
042-2.gat,37,90,0|script|Tanisha|114,{
-
- set @playerlimit, 4;
-
- if ((getx(0) > 29) && (getx(0) < 37) && (gety(0) > 84) && (gety(0) < 90)) goto L_Fighting;
+ if (isin("042-2.gat", 30, 85, 36, 89))
+ goto L_Fighting;
if (FLAGS & FLAG_TUTORIAL_DONE) goto L_Tut_Done;
if (tanisha == 4) goto L_Again;
@@ -20,14 +19,15 @@
mes "\"Are you feeling better?\"";
next;
menu
- "Yes, thank you.",-,
- "Yeah, but all my stuff is gone.",-;
+ "Yes, thank you.", -,
+ "Yeah, but all my stuff is gone.", -;
mes "[Tanisha]";
mes "\"I'm glad you're feeling better. It was really bad luck what happened to you.";
mes "Hey, I have an idea.\"";
next;
-L_Maggots:
set tanisha, 1;
+
+L_Maggots:
mes "\"There are some maggots eating the goods and I'm supposed to get rid of them.";
mes "But they're so yucky!\"";
next;
@@ -35,15 +35,17 @@ L_Maggots:
mes "What do you say?\"";
next;
menu
- "Sure!",-,
- "That's your job.",L_Close;
+ "Sure!", -,
+ "That's your job.", L_Close;
mes "[Tanisha]";
mes "\"Wonderful!\"";
- if ($@TUT_MAGGOT >= @playerlimit)
+ // since the check happens here, it is actually possible to have
+ // more than $@Maggot_MaxHunters in the area at one time
+ // but that's not a BIG problem
+ if (getareausers("042-2.gat", 30, 85, 36, 89) >= $@Maggot_MaxHunters)
goto L_Crowded;
- set $@TUT_MAGGOT, $@TUT_MAGGOT + 1;
- getitem "Knife", 1;
next;
+
L_Fight_Again:
mes "\"Ok, listen what to do.";
mes "Equip the knife and kill the maggots.\"";
@@ -56,15 +58,20 @@ L_Fight_Again:
mes "\"Maggots aren't aggressive, so they won't harm you until you attack them first. Take them out one by one.\"";
next;
mes "\"Sometimes dead monsters leave some useful things. You can pick them up by pressing Z or clicking on the items with your mouse.\"";
+ close2;
+ // The getitem must be in the same place as set tanisha, 2;
+ // since it was moved to after L_Fight_Again, add it conditionally
+ if (tanisha == 1)
+ getitem "Knife", 1;
set tanisha, 2;
- set @maggot, 0;
+ set @Maggot_Kills, 0;
set @time, 0;
- close2;
+ if (getareausers("042-2.gat", 30, 85, 36, 89) == 0)
+ initnpctimer;
warp "042-2.gat", 33, 87;
L_Summon:
- monster "042-2.gat", getx(0), gety(0), "", 1002, 1, "Tanisha::onMaggotDeath";
- startnpctimer;
+ areamonster "042-2.gat", 30, 85, 36, 89, "", 1002, 1, "Tanisha::OnMaggotDeath";
end;
L_Stats:
@@ -92,14 +99,14 @@ L_StatsRe:
next;
mes "\"Think about how you want to play before assigning the points.\"";
next;
- mes "Also I heard rumors about a strange guy lurking around in the desert south of Tulimshar who can help you to forget your abilities!\"";
+ mes "\"Also I heard rumors about a strange guy lurking around in the desert south of Tulimshar who can help you to forget your abilities!\"";
mes "Tanisha looks at you with wide opened eyes.";
next;
mes "[Tanisha]";
mes "\"But I doubt he'd do that without a service in return.\"";
- if (tanisha == 3) goto L_Money;
- close;
+ if (tanisha != 3)
+ goto L_Close;
L_Money:
next;
@@ -107,14 +114,15 @@ L_Money:
mes "\"Hey, you are so smart taking out all that yucky maggots for me.";
mes "You can have my pocket money. Here.\"";
set Zeny, Zeny + 5;
-L_Advice:
next;
+
+L_Advice:
mes "\"When you go to Tulimshar, you should see Bernard. He can make a delicious soup!";
mes "Good luck!\"";
emotion EMOTE_HAPPY;
if (tanisha == 3)
set tanisha, 4;
- close;
+ goto L_Close;
L_Again:
mes "[Tanisha]";
@@ -122,21 +130,20 @@ L_Again:
next;
if (hasan)
menu
- "A guy named Hasan won't let me enter Tulimshar.",L_Hasan,
- "Yes, could you explain again about...",L_Explain,
- "No, thanks.",L_Close;
+ "A guy named Hasan won't let me enter Tulimshar.", L_Hasan,
+ "Yes, could you explain again about...", L_Explain,
+ "No, thanks.", L_Close;
menu
- "Yes, could you explain again about...",L_Explain,
- "No, thanks.",L_Close;
- close;
+ "Yes, could you explain again about...", L_Explain,
+ "No, thanks.", L_Close;
L_Explain:
menu
- "... how to fight?",L_Fight,
- "... monsters?",L_Mob,
- "... status points?",L_StatsRe,
- "... what to do in Tulimshar?",L_Advice,
- "... nevermind.",L_Close;
+ "... how to fight?", L_Fight,
+ "... monsters?", L_Mob,
+ "... status points?", L_StatsRe,
+ "... what to do in Tulimshar?", L_Advice,
+ "... nevermind.", L_Close;
L_Fight:
mes "[Tanisha]";
@@ -148,7 +155,7 @@ L_Fight:
mes "\"Sometimes dead monsters leave some useful things. You can pick them up with pressing Z or clicking on the items with your mouse.\"";
next;
mes "\"If you feel exhausted from battle you can sit down by pressing S to recover faster.\"";
- close;
+ goto L_Close;
L_Mob:
mes "[Tanisha]";
@@ -160,7 +167,7 @@ L_Mob:
mes "\"Neutral monsters are peaceful until they get attacked.\"";
next;
mes "\"Assistants are monsters who help each other.\"";
- close;
+ goto L_Close;
L_Hasan:
mes "[Tanisha]";
@@ -171,7 +178,7 @@ L_Hasan:
mes "That was before I was born.\"";
if (hasan == 1)
set hasan, 2;
- close;
+ goto L_Close;
L_Tut_Done:
mes "[Tanisha]";
@@ -181,10 +188,9 @@ L_Tut_Done:
next;
mes "[Tanisha]";
mes "\"Do you have any questions?\"";
- menu
- "Yes, could you explain about...",L_Explain,
- "No, thanks.",L_Close;
- close;
+ menu
+ "Yes, could you explain about...", L_Explain,
+ "No, thanks.", L_Close;
L_Crowded:
mes "[Tanisha]";
@@ -192,7 +198,7 @@ L_Crowded:
mes "it seems a little crowded in there.\"";
next;
mes "\"Let's wait a short while.\"";
- close;
+ goto L_Close;
L_Sleep:
warp "042-2.gat", 36, 90;
@@ -200,13 +206,11 @@ L_Sleep:
mes "\"What are you doing in there?";
mes "Sleeping?";
mes "Come back when you're serious.\"";
- set @maggot, 0;
+ set @Maggot_Kills, 0;
set @time, 0;
- if ($@TUT_MAGGOT > 0)
- set $@TUT_MAGGOT, $@TUT_MAGGOT - 1;
- if ($@TUT_MAGGOT == 0) stopnpctimer;
- if ($@TUT_MAGGOT == 0) setnpctimer 0;
- close;
+ if (getareausers("042-2.gat", 30, 85, 36, 89) == 0)
+ stopnpctimer;
+ goto L_Close;
L_Fail:
mes "Tanisha seems to be trying hard to supress laughter.";
@@ -219,13 +223,11 @@ L_Fail:
mes "Do you want to try it again?\"";
next;
menu
- "Sure!",-,
- "No, I need a rest.",L_Close;
- if ($@TUT_MAGGOT >= @playerlimit)
+ "Sure!", -,
+ "No, I need a rest.", L_Close;
+ if (getareausers("042-2.gat", 30, 85, 36, 89) >= $@Maggot_MaxHunters)
goto L_Crowded;
goto L_Fight_Again;
- set $@TUT_MAGGOT, $@TUT_MAGGOT + 1;
- close;
L_Fighting:
message strcharinfo(0), "Tanisha: I believe in you!";
@@ -233,49 +235,54 @@ L_Fighting:
OnTimer1000:
setnpctimer 0;
- if (getareausers("042-2.gat", 29, 85, 36, 90) < 1)
+ if (getareausers("042-2.gat", 30, 85, 36, 89) == 0)
goto L_CleanUp;
- areatimer "042-2.gat", 30, 85, 36, 89, 10, "Tanisha::onTick";
+ // This is needed because multiple players can be in the area at once
+ areatimer "042-2.gat", 30, 85, 36, 89, 0, "Tanisha::OnTick";
end;
L_CleanUp:
- killmonster "042-2.gat", "Tanisha::onMaggotDeath";
- set $@TUT_MAGGOT, 0;
+ killmonster "042-2.gat", "Tanisha::OnMaggotDeath";
+ set $@Maggot_Hunters, 0;
stopnpctimer;
- setnpctimer 0;
end;
-onTick:
+OnTick:
set @time, @time + 1;
if (@time > 300)
goto L_Sleep;
- if (isdead(0)) end;
+ if (isdead())
+ end;
if (hp > 20)
- goto L_NoHeal;
+ end;
heal MaxHp, 0;
message strcharinfo(0), "Tanisha: You're doing good!";
-L_NoHeal:
- if (@maggot < 5)
- end;
+ end;
+
+OnMaggotDeath:
+ if (@Maggot_Kills == 1)
+ message strcharinfo(0), "Tanisha: Aaahhhh... another one! It will crawl up your legs!";
+ if (@Maggot_Kills == 2)
+ message strcharinfo(0), "Tanisha: Ohh... Irrhk... Eeeeww... They just appear from nowhere!";
+ if (@Maggot_Kills == 3)
+ message strcharinfo(0), "Tanisha: Yuck... I think I am getting sick.";
+ if (isin("042-2.gat", 30, 85, 36, 89))
+ set @Maggot_Kills, @Maggot_Kills + 1;
+ if (@Maggot_Kills < 5)
+ goto L_Summon;
+ // else, complete
warp "042-2.gat", 36, 90;
set tanisha, 3;
- set @maggot, 0;
+ set @Maggot_Kills, 0;
set @time, 0;
- if ($@TUT_MAGGOT > 0)
- set $@TUT_MAGGOT, $@TUT_MAGGOT - 1;
- if ($@TUT_MAGGOT == 0) stopnpctimer;
- if ($@TUT_MAGGOT == 0) setnpctimer 0;
- end;
-
-onMaggotDeath:
- if (@maggot == 1) message strcharinfo(0), "Tanisha: Aaahhhh... another one! It will crawl up your legs!";
- if (@maggot == 2) message strcharinfo(0), "Tanisha: Ohh... Irrhk... Eeeeww... They just appear from nowhere!";
- if (@maggot == 3) message strcharinfo(0), "Tanisha: Yuck... I think I am getting sick.";
- if ((getx(0) > 29) && (getx(0) < 37) && (gety(0) > 84) && (gety(0) < 90)) set @maggot, @maggot + 1;
- if (@maggot < 5 && (getx(0) <= 29) || (getx(0) >= 37) || (gety(0) <= 84) || (gety(0) >= 90)) monster "042-2.gat", 33, 87, "", 1002, 1, "Tanisha::onMaggotDeath";
- if (@maggot < 5 && (getx(0) > 29) && (getx(0) < 37) && (gety(0) > 84) && (gety(0) < 90)) monster "042-2.gat", getx(0), gety(0), "", 1002, 1, "Tanisha::onMaggotDeath";
+ if (getareausers("042-2.gat", 30, 85, 36, 89) == 0)
+ stopnpctimer;
end;
L_Close:
+ set @menu, 0;
close;
+
+OnInit:
+ set $@Maggot_MaxHunters, 4;
}