// This file is part of the Tutorial
// Authors: Jenalya, alastrim
042-1.gat,90,61,0|script|Hasan|189,
{
set @toll, 10000;
set @x, getx();
set @y, gety();
if (FLAGS & FLAG_TUTORIAL_DONE)
goto L_Tut_Done;
// Please consider rewriting this in terms of isin()
// it's not that trivial to put this in a rectangle...
if ( (@y < 58)&&(@x < 89) || (@x < 87) )
goto L_Cliff_Up;
// implicitly, $@ScorpionFighter is nonzero
if (getcharid(3) == $@ScorpionFighter)
goto L_Fear;
if (hasan == 4)
goto L_Thank;
if (hasan == 3)
goto L_Trick;
if (hasan > 0)
goto L_Toll;
mes "[Unfriendly Guy]";
mes "\"Hey! You can't pass here.\"";
next;
menu
"Why not?",-,
"Who says that?",-;
mes "[Unfriendly Guy]";
mes "\"I, Hasan the Mighty, have decided to put a toll on this path.\"";
next;
L_Toll:
mes "[Hasan]";
mes "\"Give me " + @toll + "GP, and I may let you pass.\"";
if (hasan == 0)
set hasan, 1;
next;
if (Zeny >= @toll)
menu
"Ok, here you go.",L_Pay,
"What? I don't have that much money!",L_NoPay,
"We'll see if you can stop me!",L_Fight;
menu
"What? I don't have that much money!",L_NoPay,
"We'll see if you can stop me!",L_Fight;
L_NoPay:
mes "[Hasan]";
mes "\"That's not my problem. You have to stay here then.\"";
next;
mes "This is annoying. Maybe Kaan can help?";
goto L_Close;
L_Fight:
mes "He laughs derisively.";
mes "[Hasan]";
mes "\"Do you really think you can beat me?\"";
mes "He pulls out a nasty looking dagger and stabs it in your direction.";
set Hp, 1;
next;
mes "That hurt! You begin to think searching for a different solution might be healthier.";
mes "Maybe Kaan can help?";
goto L_Close;
L_Pay:
if (Zeny < @toll)
goto L_Cheat;
set Zeny, Zeny - @toll;
mes "He grins gloatingly.";
mes "[Hasan]";
mes "\"Very well. You may pass.\"";
callfunc "TutorialCompleted";
goto L_Close;
L_Cheat:
mes "[Hasan]";
mes "\"Don't you dare try to cheat me!\"";
goto L_Close;
L_Trick:
mes "[Hasan]";
mes "\"Are you going to pay now? " + @toll + "GP, and I may let you pass.\"";
next;
menu
"I don't have that much money!",L_NoPay,
"No. (Scratch your head.)",-;
if ($@ScorpionFighter)
goto L_Wait;
mes "While you're scratching your head, you see Kaan coming nearer to the cliff above you.";
// close2 blocks
close2;
set $@ScorpionTimer, 0;
set $@ScorpionFighter, getcharid(3);
set $@ScorpDeath, PC_DIE_COUNTER;
monster "042-1.gat",89,63,"Scorpion",1003,1, "Hasan::onScorpionDeath";
initnpctimer;
end;
L_Thank:
mes "[Hasan]";
mes "\"You - you saved me!";
mes "I tried to take your money and you saved me!\"";
next;
mes "\"Hey, you're a really cool person.";
mes "I mean, the way you finished that ghastly scorpion!";
mes "Amazing!\"";
next;
mes "\"Let me tell you a secret: Cool persons are allowed to pass for free.";
mes "And you can have my Sharp Knife.\"";
getitem "SharpKnife", 1;
callfunc "TutorialCompleted";
next;
mes "\"You want to go to the bazaar, right? Shall I tell you how to get there?\"";
next;
menu
"Sure, thanks.",-,
"I'll try to find the way myself.",L_Explore;
mes "[Hasan]";
mes "\"Ok, when you leave here follow the road past the docks until you reach the old city gates.\"";
next;
mes "\"Pass through them and at the crossway, just go west and then south until you reach some other gateway.\"";
next;
mes "\"Behind it there is the bazaar of Tulimshar.\"";
goto L_Close;
L_Explore:
mes "[Hasan]";
mes "\"Alright. Take care!\"";
goto L_Close;
L_Fear:
mes "[Hasan]";
mes "\"Sc-sc-sco-scorpion!\"";
mes "He seems close to tears.";
goto L_Close;
L_Tut_Done:
mes "[Hasan]";
if (BaseLevel >= 40)
mes "\"Welcome to the suburbs of Tulimshar. I wonder what an experienced adventurer like you is doing here.\"";
if (BaseLevel < 40)
mes "\"Bah, nothing interesting is happening here.\"";
goto L_Close;
L_Distance:
mes "There is a person off in the distance. He doesn't seem to notice you, maybe you should go closer.";
goto L_Close;
L_Cliff_Up:
mes "You see a guy in shabby clothes when you look down the cliff.";
goto L_Close;
L_SummonAgain:
message strcharinfo(0), "Kaan is mad at you for your interference! He walks over to the edge of the cliff and throws a rock on top of your head, then lets another scorpion run just near Hasan!";
percentheal -100, 0;
message strcharinfo(0), "Kaan: \"Just go while he is distracted and no one is interfering!\"";
monster "042-1.gat",89,63,"Scorpion",1003,1, "Hasan::onScorpionDeath";
end;
L_Clean:
killmonster "042-1.gat", "Hasan::onScorpionDeath";
set $@ScorpionFighter, 0;
set $@ScorpionTimer, 0;
set $@ScorpDeath, 0;
stopnpctimer;
end;
L_TimeOut:
message strcharinfo(0), "Hasan, with his eyes almost closed, trembling with fear, runs toward the scorpion and stabs it with all his strength! Seems like you took too long and the plan didn't work this time.";
warp "042-1.gat", 91, 58;
message strcharinfo(0), "Hasan: \"Hey you! I told you you cannot pass!\"";
goto L_Clean;
L_MessageDeath:
message strcharinfo(0), "Ouch... I should be more careful when fighting these monsters.";
goto L_Clean;
L_Wait:
mes "There is a scorpion near Hasan already. I think Kaan is helping someone else... Maybe I should try the plan later.";
goto L_Close;
L_Close:
set @toll, 0;
set @x, 0;
set @y, 0;
close;
OnTimer5000:
if (attachrid($@ScorpionFighter) == 0)
goto L_Clean;
set $@ScorpionTimer, $@ScorpionTimer + 5;
if ($@ScorpionTimer >= 300)
goto L_TimeOut;
if (PC_DIE_COUNTER > $@ScorpDeath)
goto L_MessageDeath;
setnpctimer 0;
end;
onScorpionDeath:
if (getcharid(3) != $@ScorpionFighter)
goto L_SummonAgain;
if (hasan != 3)
end;
set hasan, 4;
message strcharinfo(0), "You saved Hasan.";
goto L_Clean;
}
042-1.gat,90,62,0|script|#Toll|32767,2,2,
{
end;
OnTouch:
// implicitly, $@ScorpionFighter is nonzero
if ($@ScorpionFighter == getcharid(3))
end;
if ((FLAGS & FLAG_TUTORIAL_DONE) || (hasan == 4))
end;
warp "042-1.gat", 91, 58;
message strcharinfo(0), "Hasan: \"Stop!\"";
end;
}
042-1.gat,96,69,0|script|#barrier|45,0,2
{
end;
OnTouch:
if (FLAGS & FLAG_TUTORIAL_DONE)
goto L_Tut;
warp "042-1.gat", 94, 69;
// implicitly, $@ScorpionFighter is nonzero
if ($@ScorpionFighter == getcharid(3))
message strcharinfo(0), "Hasan: \"" + strcharinfo(0) + "! Please help me!\"";
if ($@ScorpionFighter && $@ScorpionFighter != getcharid(3))
// is this reachable?
message strcharinfo(0), "Hasan: \"Hey! Stop right there!\"";
if (hasan == 4)
message strcharinfo(0), "Hasan: \"Please wait a moment!\"";
end;
L_Tut:
warp "022-1.gat", 23, 38;
end;
}