// Evol scripts.
// Authors:
// Vasily_Makarov
// 4144
// Reid
// Ablu
// Description:
// Rat killer NPC
// 4 bits array:
// ShipQuests
// Variable:
// ShipQuests_Peter
// Values:
// 0 default
// 1 task given
// 2 task given + reward expected
// 3 task completed
// 4 task completed + reward to be given
// 5 task done + reward given
// "000-2-2.gat" - map with mobs
000-2-1.gat,61,34,0,1 script AreaNPC 0,0,1,{
OnTouch:
set @q, geta4(ShipQuests, ShipQuests_Peter);
// Only let play pass that finished Peters quest
if (@q < 5 && BaseLevel > 5 && getmapmobs("000-2-2.gat") == 4 && $@RAT_SAILOR_HELPER$ == "") goto l_Task;
if (@q < 5) goto l_Stop;
warp "000-2-2.gat", 48, 28;
close;
l_Stop:
doevent "Peter::OnStop";
close;
l_Task:
doevent "Peter::OnGiveTask";
close;
}
000-2-1.gat,60,35,0,1 script Peter 303,{
set @q_julia, geta2(ShipQuests, ShipQuests_Julia);
if (@q_julia == 0) goto l_TalkToJulia;
if (BaseLevel < 5) goto OnTooWeak;
mesn;
mesq g(l("Hey, girl!"), l("Hey, man!"));
next;
set @q, geta4(ShipQuests, ShipQuests_Peter);
// If player is here but has not finished the quest he aborted it since he
// cannot come here before he finished the quest while not aborting the quest
if (@q == 1 || @q == 2) goto l_QuestAborted;
if (@q == 3 || @q == 4) goto l_QuestDone;
if (@q == 5) goto l_Thanks;
//If map is full of mobs and helper is free
if (getmapmobs("000-2-2.gat") == 4 && $@RAT_SAILOR_HELPER$ == "") goto OnGiveTask;
goto OnDontNeedHelp;
close;
OnTooWeak:
mesn;
mesq g(l("I need help for cleaning the wedge of the ship, but you aren't strong enough to help me.#0"), l("I need help for cleaning the wedge of the ship, but you aren't strong enough to help me.#1"));
close;
OnStop:
mesn;
mesq l("You can't go there!");
warp "000-2-1",61,36;
close;
OnGiveTask:
mesn;
mesq l("I need somebody who can clean the bottom of the ship of these Ratto, can you help me?");
menu
l("Yeah, but what reward will I get?"), l_BonusTask,
l("Why not, I need to train anyway."), l_Task,
l("No, they are way too dangerous for me!"), -;
mesq l("Ok, ok. Come back if you change your mind.");
close;
OnDontNeedHelp:
mesn;
mesq l("I don't need your help right now, come back later.");
if ($@RAT_SAILOR_HELPER$ == "") close;
mesq $@RAT_SAILOR_HELPER$ + " " + l("is helping me.");
close;
OnTimer500000:
stopnpctimer;
//Attach player if possible, otherway free helper
if (attachrid(getcharid(3, $@RAT_SAILOR_HELPER$)) == 0) goto l_KillHelper;
warp "000-2-1",61,36;
goto OnCheck;
detachrid;
close;
OnCheck:
stopnpctimer;
mesn;
mesq l("Let me see your work...");
next;
set @q, geta4(ShipQuests, ShipQuests_Peter);
if (getmapmobs("000-2-2.gat") || $@RAT_SAILOR_HELPER$ != strcharinfo(0)) goto l_QuestAborted;
set $@RAT_SAILOR_HELPER$, "";
if (@q == 2 || @q == 4) goto l_Reward;
goto l_Thanks;
l_TalkToJulia:
mesn;
mesq l("Hey, you should go see Julia to be registred on the ship board.");
close;
l_BonusTask:
mesn;
mesq l("I will give you @@gp.", 500);
menu
g(l("Okay, I'm ready to work!#0"), l("Okay, I'm ready to work!#1")), -,
l("What? This reward is too small!"), l_Close;
if ($@RAT_SAILOR_HELPER != "") goto OnDontNeedHelp;
seta4 ShipQuests, ShipQuests_Peter, 2;
goto l_Start;
l_Task:
if ($@RAT_SAILOR_HELPER != "") goto OnDontNeedHelp;
seta4 ShipQuests, ShipQuests_Peter, 1;
goto l_Start;
l_QuestDone:
stopnpctimer;
seta4 ShipQuests, ShipQuests_Peter, 5;
if (@q == 4) goto l_Reward;
goto l_Thanks;
l_QuestAborted:
stopnpctimer;
seta4 ShipQuests, ShipQuests_Peter, 0;
set $@RAT_SAILOR_HELPER$, "";
mesn;
mesq l("Too bad that you do not want to help me.");
close;
l_Start:
mesn;
mesq l("Okay, you can start!");
set $@RAT_SAILOR_HELPER$, strcharinfo(0);
startnpctimer;
warp "000-2-2.gat", 48, 28;
close;
l_KillHelper:
set $@RAT_SAILOR_HELPER$, "";
close;
l_Reward:
mesn;
mesq l("Good job!") + " " + l("Here is your reward!");
getexp 100, 0;
set zeny, zeny + 500;
close;
l_Thanks:
mesn;
mesq l("Thanks for helping me!");
close;
l_Close:
close;
}