summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-05-01 10:59:43 +0000
committerWildX <wildx@evolonline.org>2019-05-01 10:59:43 +0000
commit1fcfb18c2cf527043ba08b3ac578898b04c08f77 (patch)
tree76346f46fe852ec18c1a894e5bc1a9a76a57d77f
parente478440a8fb70fa0cbc67020f68a849de9949365 (diff)
downloadserverdata-1fcfb18c2cf527043ba08b3ac578898b04c08f77.tar.gz
serverdata-1fcfb18c2cf527043ba08b3ac578898b04c08f77.tar.bz2
serverdata-1fcfb18c2cf527043ba08b3ac578898b04c08f77.tar.xz
serverdata-1fcfb18c2cf527043ba08b3ac578898b04c08f77.zip
Make Mundane walk, instead of jumping.
Maybe he should walk faster than player, as he is scared. I just read npc/funcs/npcmove* to accomplish my task. Thanks, @toams and 4144!
-rw-r--r--npc/001-2-11/mona.txt103
-rw-r--r--npc/001-3-0/mundane.txt111
-rw-r--r--npc/functions/math.txt10
-rw-r--r--npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt3
-rw-r--r--npc/functions/util.txt36
5 files changed, 185 insertions, 78 deletions
diff --git a/npc/001-2-11/mona.txt b/npc/001-2-11/mona.txt
index abec0cee..3d5b4584 100644
--- a/npc/001-2-11/mona.txt
+++ b/npc/001-2-11/mona.txt
@@ -3,10 +3,12 @@
// Reid
// Jesusalva
// Description:
-// A rich girl holding a candle. Her father went to examine weird noises on
-// sewers and still haven't come back. Her mother is gone, but it is not clear
-// if she died, abandoned them, or something else.
+// A rich girl holding a candle. Her father went to examine weird noises in the
+// sewers and still hasn't come back. Her mother is gone, but it is not clear
+// whether she died, abandoned them, or something else.
// Variable:
+// MONA_TIME = gettimeparam(GETTIME_DAYOFMONTH) so you need 3 days
+// MONA_REPEAT = How many times the quest was done
// ArtisQuests_MonaDad
// Quest states:
// 0 - Quest not started
@@ -35,14 +37,14 @@
}
speech S_LAST_NEXT | S_NO_NPC_NAME,
- l("Daddy did not come back home... He said that he would be back for lunch but it has already been a week!"),
+ l("Daddy never came back home... He said that he would be back for lunch but it has already been two days!"),
l("You have to find him, or else I will tell him that you did not help me.");
- switch (select(l("You do not give me much options."), l("The elder ran away from you.")))
+ switch (select(l("You do not give me a lot of options."), l("Your dad ran away from you!")))
{
case 1:
speech S_FIRST_BLANK_LINE,
- l("He said that he would check why the manhole next to the house was doing weird sounds."),
+ l("He said that he would check why weird noises were coming from the manhole next to the house."),
l("But he never returned."),
l("Please find my daddy...");
@@ -64,30 +66,41 @@
// only to support Global Instances and in general is not a smart thing to do.
function check_daddy_quest
{
- // Did you really brought Mundane to sewer exit (152, 56)?
+ // Did you really bring Mundane to sewer exit?
// We need to add 1 tile in each direction of tolerance because addtimer()
// is not exactly what I would call “a reliable way to do stuff”
// Note that @variables sometimes get erasen AT RANDOM.
// If this problem happens, move it char variables.
// (that might cause problems with logout though.)
// Temporary variables give you a time limit to report back...
- if (@MUNDANE_OLDX >= 151 && @MUNDANE_OLDX <= 153 &&
- @MUNDANE_OLDY >= 55 && @MUNDANE_OLDY <= 57) {
- // There's no need to check if instance still exists, because
- // when the instance expires, you get warped to *somewhere*.
- // This means the timer will die and MUNDANE_OLD* variables will stop
- // being updated.
- inventoryplace WoodenBow, 1;
- speech 0x0,
- l("Daddy finally came back home! He grabbed a snack and said he would be returning to the sewers."),
- lg("He did said to you take this @@ as a gift. He says you are very skilled and will make a good use of his old weapon.",
- "He did said to you take this @@ as a gift. He says you are very skilled and will make a good use of his old weapon.",
- getitemlink(WoodenBow)),
- l("He was never the same since mommy vanished...");
- getitem WoodenBow, 1;
- setq(ArtisQuests_MonaDad, 3);
- close;
- }
+ //
+ // There's no need to check if instance still exists, because
+ // when the instance expires, you get warped to *somewhere*.
+ // This means the timer will die and MUNDANE_OLD* variables will stop
+ // being updated.
+ .@success=false;
+
+ // Sewer mouths (warps to 001-1)
+ if (is_between(151, 153, @MUNDANE_OLDX) &&
+ is_between(55, 57, @MUNDANE_OLDY))
+ .@success=true;
+
+ if (is_between(195, 197, @MUNDANE_OLDX) &&
+ is_between(34, 36, @MUNDANE_OLDY))
+ .@success=true;
+
+ if (is_between(197, 199, @MUNDANE_OLDX) &&
+ is_between(59, 61, @MUNDANE_OLDY))
+ .@success=true;
+
+ if (is_between(84, 86, @MUNDANE_OLDX) &&
+ is_between(129, 131, @MUNDANE_OLDY))
+ .@success=true;
+
+ if (.@success)
+ return true;
+ else
+ return false;
}
// Here the script really starts
@@ -97,13 +110,51 @@
}
else if (getq(ArtisQuests_MonaDad) == 3)
{
+ // Quest Repeat takes priority. Don't worry, you won't lose password unless
+ // you accept the quest again.
+ if (MONA_TIME <= gettimeparam(GETTIME_DAYOFMONTH)) {
+ find_daddy_quest();
+ }
+
+ // Sagratha is Great B-)
npctalkonce any(
l("Thanks for finding daddy... I wish he spent more time with me..."),
- l("Sagratha is great. Why the strange woman near the Legion building always say that to daddy...")); // TODO: Polish
+ l("Sagratha is great. Why does the strange woman near the Legion building always say that to daddy...?")); // TODO: Polish
}
else if (getq(ArtisQuests_MonaDad) == 2)
{
- check_daddy_quest();
+ if (check_daddy_quest())
+ {
+ if (!MONA_REPEAT)
+ {
+ inventoryplace WoodenBow, 1;
+ speech 0x0,
+ l("Daddy finally came back home! He grabbed a snack and said he would be returning to the sewers."),
+ lg("He did say that I should give you this @@ as a gift. He says you are very skilled and will make good use of his old weapon.",
+ "He did say that I should give you this @@ as a gift. He says you are very skilled and will make good use of his old weapon.",
+ getitemlink(WoodenBow)),
+ l("He has never been the same since mommy went away...");
+ getitem WoodenBow, 1;
+ }
+ else if (MONA_REPEAT == 10)
+ {
+ speech
+ l("Daddy asked me to give you some money as a thank you for looking out for me."),
+ l("I don't want you! I want daddy!");
+ mesc l("*sniff sniff*");
+ emotion E_SAD;
+ Zeny+=1000;
+ }
+ else
+ {
+ inventoryplace TrainingArrow, 100;
+ getitem TrainingArrow, min(MONA_REPEAT*20, 100);
+ }
+ setq(ArtisQuests_MonaDad, 3);
+ MONA_TIME=gettimeparam(GETTIME_DAYOFMONTH)+3;
+ MONA_REPEAT+=1;
+ close;
+ }
}
else
{
diff --git a/npc/001-3-0/mundane.txt b/npc/001-3-0/mundane.txt
index 17e70b0f..fdf617ee 100644
--- a/npc/001-3-0/mundane.txt
+++ b/npc/001-3-0/mundane.txt
@@ -37,8 +37,8 @@
function rescue_mundane
{
speech(S_LAST_NEXT,
- l("Scary... I am afraid of these Slimes, Rattos and Maggots... And worse, I am lost..."),
- l("I already killed many strong monsters, but everyone has fears, right?!"),
+ l("Scary... I am afraid of all these Slimes, Rattos and Maggots... And worse, I am lost..."),
+ l("I was an archer of the Legion and shouldn't be scared of a few maggots, but everyone has fears, right?!"),
l("My daughter is probably worried about me. Could you perhaps lead me out of here?"));
switch (select(l("Yes, follow me!"), l("Not now. You see, I am also afraid of Slimes and Rattos!")))
@@ -49,17 +49,13 @@
case 2:
speech(S_FIRST_BLANK_LINE,
l("That's too bad... Although I think you're lying."),
- l("If it is the latter, please take some courage and help me!"));
+ l("If so, please take some courage and help me!"));
close;
break;
}
.@ID=getcharid(0);
.@MAP_NAME$="mona@"+str(.@ID);
@MUNDANE_INSTID = instance_create("001-3-0@a"+(.@ID), getcharid(3), IOT_CHAR);
- //debugmes "You are "+str(.@ID);
-
- //if (@MUNDANE_INSTID < 0) debugmes "Error: No instance ID";
- //debugmes "new instance id: " + str(@MUNDANE_INSTID);
// XXX - Important Note - XXX
// We currently have only FOUR chars to name the map. "001-3-0" or "mundane" have 7 chars, so that cannot be used.
@@ -74,33 +70,35 @@
if (.@instanceMapName$ == "") {
speech(0x0,
l("Wait... You are that @@ from earlier, aren't you?", strcharinfo(0)),
- l("If my memory serves me right, you died just before. Why don't you go out to buy better equipment?"));
+ l("If my memory serves me right, you were just defeated. Why don't you go out to buy better equipment?"));
close;
}
// You have 5 minutes to complete the quest. This does not results in failure by itself, getq2 does that
instance_set_timeout(300, 300, @MUNDANE_INSTID);
instance_init(@MUNDANE_INSTID);
- dispbottom(l("Mona Father's is right behind you. You have five minutes to bring him out of sewers!"));
-
- // Not sure if Green Slimes are exactly what we want here - and shouldn't it be "Slime"? (mind upper-case)
- areamonster(.@MAP_NAME$, 119, 51, 162, 85, l("Green Slime"), slime, 3);
- areamonster(.@MAP_NAME$, 190, 65, 193, 68, l("Ratto"), Ratto, 5);
- areamonster(.@MAP_NAME$, 90, 67, 92, 72, l("Cave Maggot"), CaveMaggot, 3);
- areamonster(.@MAP_NAME$, 99, 106, 102, 111, l("Green Slime"), slime, 3);
- areamonster(.@MAP_NAME$, 115, 93, 115, 75, l("Green Slime"), slime, 3);
- areamonster(.@MAP_NAME$, 120, 85, 7, 2, l("Little Green Slime"), slime-littleslime, 7);
- areamonster(.@MAP_NAME$, 114, 65, 121, 68, l("Cave Maggot"), CaveMaggot, 5);
- areamonster(.@MAP_NAME$, 137, 76, 130, 87, l("Spider"), Spider, 4);
- areamonster(.@MAP_NAME$, 98, 92, 101, 94, l("Green Slime"), slime, 3);
+ dispbottom(l("Mona's father is right behind you. You have five minutes to bring him out of sewers!"));
+
+ // Note: Difficulty is based on your level
+ .@BLVLBOOST=BaseLevel/10;
+ areamonster(.@MAP_NAME$, 119, 51, 162, 85, strmobinfo(1, slime), slime, 3+.@BLVLBOOST);
+ areamonster(.@MAP_NAME$, 190, 65, 193, 68, strmobinfo(1, Ratto), Ratto, 5);
+ areamonster(.@MAP_NAME$, 90, 67, 92, 72, strmobinfo(1, CaveMaggot), CaveMaggot, 3+.@BLVLBOOST);
+ areamonster(.@MAP_NAME$, 99, 106, 102, 111, strmobinfo(1, slime), slime, 3+.@BLVLBOOST);
+ areamonster(.@MAP_NAME$, 115, 93, 115, 75, strmobinfo(1, slime), slime, 3+.@BLVLBOOST);
+ areamonster(.@MAP_NAME$, 120, 85, 7, 2, strmobinfo(1, slime-littleslime), slime-littleslime, 7+.@BLVLBOOST);
+ areamonster(.@MAP_NAME$, 114, 65, 121, 68, strmobinfo(1, CaveMaggot), CaveMaggot, 5+.@BLVLBOOST);
+ areamonster(.@MAP_NAME$, 137, 76, 130, 87, strmobinfo(1, Spider), Spider, 4+.@BLVLBOOST);
+ areamonster(.@MAP_NAME$, 98, 92, 101, 94, strmobinfo(1, slime), slime, 3+.@BLVLBOOST);
+
+ // Important temporary variables and move you accordingly
+ @MUNDANE_OLDX=.x;
+ @MUNDANE_OLDY=.y;
+ warp(.@MAP_NAME$, .x, .y);
+
setq ArtisQuests_MonaDad, 2;
- warp(.@MAP_NAME$, 96,66);
addtimer(150, instance_npcname(.name$, @MUNDANE_INSTID)+"::OnMove");
updateSpotlight(true);
-
- // Important temporary variables
- @MUNDANE_OLDX=96;
- @MUNDANE_OLDY=66;
close;
}
@@ -115,20 +113,6 @@
hello;
end;
-OnInit:
- .sex = G_MALE;
- .distance = 3;
- .speed = 150;
- end;
-
-// If we are to use a fake-NPC (a monster which actually is a NPC, for example),
-// We need to uncomment this code block. As we are moving the actual NPC, this is
-// not needed (and harmful, too). Notes regarding disablenpc().
-OnInstanceInit:
- //disablenpc(instance_npcname(.name$));
- .speed = 150; // Double-sure
- end;
-
// This functions serves two major purposes:
// 1- Move Mundane accordingly
// 2- Be able to determine if you brought Mundane to exit or cheat (warp, etc.)
@@ -144,6 +128,8 @@ OnMove:
// This check shouldn't be needed but better safe than sorry
if (.@m$ == "001-1")
dispbottom l("Mundane ran straight home. He must be missing his daughter.");
+ else
+ dispbottom l("Mundane ran away, he did not trust the path you chose.");
end;
}
// We actually won't move the NPC to your position, but to where you were last.
@@ -154,13 +140,7 @@ OnMove:
}
// movenpc() will cause NPC to "jump" to player position.
- // npcwalkto(x, y) could be better, but there are concerns about instance NPC,
- // and the server code behind this function would need to be changed to actually
- // use NPC walking animation (instead of just sliding it around).
- //
- // Mind the note about instance_npcname and about ignoring your position
- // We should in future at least figure out the right direction to display too
- //movenpc(instance_npcname(.name$, @MUNDANE_INSTID), @MUNDANE_OLDX, @MUNDANE_OLDY);
+ // npcwalkto(x, y) will make it walk to your position.
npcwalkto @MUNDANE_OLDX, @MUNDANE_OLDY;
// We now update the misleading @MUNDANE_OLD* variable with your current
@@ -172,6 +152,11 @@ OnMove:
addtimer(150, instance_npcname(.name$, @MUNDANE_INSTID)+"::OnMove");
end;
+OnPCLogoutEvent:
+ if (getq(ArtisQuests_MonaDad) != 2) end;
+ setq ArtisQuests_MonaDad, 1;
+ end;
+
OnPCDieEvent:
if (getq(ArtisQuests_MonaDad) != 2) end;
setq ArtisQuests_MonaDad, 1;
@@ -181,15 +166,41 @@ OnPCDieEvent:
// This will cause the NPC to "vanish", player is left to guess that he ran
// back to where he originally was.
// (ie. The NPC won't be fine without you if we have code to handle that).
+ // NOTE: Maybe we could send the NPC running back to his original position?
+ // For future thought and testing by anyone interested.
getmapxy(.@m$, .@x, .@y, 0);
if (.@m$ ~= "mona@*") {
disablenpc(instance_npcname(.name$, @MUNDANE_INSTID));
}
+ end;
- // Uncommenting the code piece will warp you back to your savepoint.
- // It's better to don't use this if the previous code works.
- //recovery();
- //warp("Save",0,0);
+OnInit:
+ .sex = G_MALE;
+ .distance = 3;
+ .speed = 140;
+
+// Move Mundane every Sunday, Wednesday, and Friday
+// to be less repetitive, and save also where it is
+OnSun0000:
+OnWed0000:
+OnFri0000:
+ if (.begin)
+ delcells "MundaneProtection";
+
+ // Micksha may tweak this.
+ setarray .@valid_x, 96, 132, 150, 49;
+ setarray .@valid_y, 66, 86, 118, 47;
+ .@index=rand(0,getarraysize(.@valid_x)-1);
+ movenpc .name$, .@valid_x[.@index], .@valid_y[.@index];
+
+ // Create a 3x3 monster collision block over Mundane
+ setcells .map$, .x-3, .y-3, .x+3, .y+3, 6, "MundaneProtection";
+ .begin=true;
end;
+
+OnInstanceInit:
+ .speed = 140; // Double-sure
+ end;
+
}
diff --git a/npc/functions/math.txt b/npc/functions/math.txt
index 004125c7..357407da 100644
--- a/npc/functions/math.txt
+++ b/npc/functions/math.txt
@@ -2,6 +2,7 @@
// Authors:
// 4144
// Reid
+// Jesusalva
// Description:
// Math functions
@@ -38,3 +39,12 @@ function script lognbaselvl {
return .@ret;
}
+
+
+// result is: lower < target <= higher
+// is_between ( lower, higher, target)
+function script is_between {
+ .@val=getarg(2);
+ return (getarg(0) < .@val && getarg(1) >= .@val);
+}
+
diff --git a/npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt b/npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt
index 68ba67fe..bda45b90 100644
--- a/npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt
+++ b/npc/functions/quest-debug/032-ArtisQuests_MonaDad.txt
@@ -14,7 +14,8 @@ function script QuestDebug32 {
GenericQuestDebug ArtisQuests_MonaDad,
l("Does not have the quest"), 0,
- l("Mona's dad is missing"), 1;
+ l("Mona's dad is missing"), 1,
+ l("Mona's dad was rescued"), 3;
if (@menuret < 0)
{
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index d5fe8bc4..a8e157b2 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -107,6 +107,40 @@ function script get_race {
return .@allskins$[.@g];
else
return .@allskins$[.@g] + " " + .@allraces$[.@g];
-
}
+// gettimeparam(GETTIME_X)
+// Returns the number of seconds/minutes/hours/days/months/years since 01/01/1970
+// This is for truly daily quests, which doesn't imposes a timed wait in hours
+function script gettimeparam {
+ .@p=getarg(0, GETTIME_MINUTE);
+
+ // Seconds (same as gettimetick(2) - use that instead)
+ .@t=gettimetick(2);
+ if (.@p == GETTIME_SECOND)
+ return .@t;
+
+ // Minutes (default)
+ .@t=.@t/60;
+ if (.@p == GETTIME_MINUTE)
+ return .@t;
+
+ // Hours
+ .@t=.@t/60;
+ if (.@p == GETTIME_HOUR)
+ return .@t;
+
+ // Days
+ .@t=.@t/24;
+ if (.@p == GETTIME_DAYOFMONTH)
+ return .@t;
+
+ // Months (estimative)
+ .@t=.@t/30;
+ if (.@p == GETTIME_MONTH)
+ return .@t;
+
+ // Years (estimative, unused, fallback)
+ .@t=.@t/12;
+ return .@t;
+}