summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authoromatt <m.vuoso@laposte.net>2016-07-16 18:52:53 +0200
committeromatt <m.vuoso@laposte.net>2016-08-04 05:10:04 +0200
commit474df6a958a9543dcae07d2e76ba648882621878 (patch)
treedd492be687ee20a00277d2ac9f0a58e0a5029dd8 /npc
parentf1efb34969c42a2eba29d972731d96e6ab467b3f (diff)
downloadserverdata-474df6a958a9543dcae07d2e76ba648882621878.tar.gz
serverdata-474df6a958a9543dcae07d2e76ba648882621878.tar.bz2
serverdata-474df6a958a9543dcae07d2e76ba648882621878.tar.xz
serverdata-474df6a958a9543dcae07d2e76ba648882621878.zip
change water animation (001-1), and change fishing function
Diffstat (limited to 'npc')
-rw-r--r--npc/001-1/wateranimation.txt229
-rw-r--r--npc/functions/fishing.txt174
2 files changed, 287 insertions, 116 deletions
diff --git a/npc/001-1/wateranimation.txt b/npc/001-1/wateranimation.txt
index c27a7f4f..ad409d1a 100644
--- a/npc/001-1/wateranimation.txt
+++ b/npc/001-1/wateranimation.txt
@@ -5,10 +5,23 @@
// Water animations, splash, fishes, etc...
001-1,116,123,0 script #water_animation0 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ // skip the narator when we are in fishing
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3); // give the name of npc for set the addtimer.
close;
+OnPull:
+ emotion 106; // here the effect, emote is just for try :3
+ if (@pull == 3) // is too late or too soon, don't set the @pull 2
+ // useless for now, because if you fail that delete the timer
+ // just a security
+ end;
+ else
+ @pull = 2; // set 2, the fish bite the bait
+ @tick = gettimetick(0); // the tick required for the pull_max
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -16,10 +29,20 @@ OnInit:
}
001-1,119,102,0 script #water_animation1 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -27,10 +50,20 @@ OnInit:
}
001-1,167,82,0 script #water_animation2 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -38,10 +71,20 @@ OnInit:
}
001-1,167,40,0 script #water_animation3 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -49,10 +92,20 @@ OnInit:
}
001-1,104,127,0 script #water_animation4 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -60,10 +113,20 @@ OnInit:
}
001-1,166,123,0 script #water_animation5 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -71,10 +134,20 @@ OnInit:
}
001-1,181,119,0 script #water_animation6 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -82,10 +155,20 @@ OnInit:
}
001-1,202,114,0 script #water_animation7 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -93,10 +176,20 @@ OnInit:
}
001-1,187,86,0 script #water_animation8 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -104,10 +197,20 @@ OnInit:
}
001-1,32,57,0 script #water_animation9 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -115,10 +218,20 @@ OnInit:
}
001-1,40,144,0 script #water_animation10 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -126,10 +239,20 @@ OnInit:
}
001-1,58,131,0 script #water_animation11 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -137,10 +260,20 @@ OnInit:
}
001-1,76,137,0 script #water_animation12 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -148,10 +281,20 @@ OnInit:
}
001-1,109,132,0 script #water_animation13 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -159,10 +302,20 @@ OnInit:
}
001-1,141,93,0 script #water_animation14 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
@@ -170,10 +323,22 @@ OnInit:
}
001-1,168,57,0 script #water_animation15 NPC_WATER_SPLASH,{
- narrator 4, l("You see some fish reflecting the sun on the surface of the water.");
- fishing;
+ if (@pull != 1 && @pull != 2)
+ {
+ narrator 4, l("You see some fish reflecting the sun on the surface of the water. " + @pull + "");
+ }
+ fishing strnpcinfo(3);
close;
+OnPull:
+ emotion 106;
+ if (@pull == 3)
+ end;
+ else
+ @pull = 2;
+ @tick = gettimetick(0);
+ end;
+
OnInit:
.sex = G_OTHER;
.distance = 5;
diff --git a/npc/functions/fishing.txt b/npc/functions/fishing.txt
index e59918b8..f2a1fd20 100644
--- a/npc/functions/fishing.txt
+++ b/npc/functions/fishing.txt
@@ -4,33 +4,103 @@
// Description:
// Fishing functions.
+
+// player log on @pull is 0, start by choose bait menu
+// player choose bait, script addtimer in npc @pull is 1
+// if player pull before signal npc, bait is lose, set @pull 3 goto choose bait
+// if player pull after pull delay max, bait is lose, set @pull 3 goto choose bait
+// npc signal @pull 2
+// player pull between npc signal and pull delay max, got the fish, set @pull 3 goto choose bait
+
function script fishing {
+ .@wait_time_min = 8000;
+ .@wait_time_max = 35000;
+ .@pull_rand_max = 800;
+ .@fish_id = CommonCarp;
+ .@rare_fish_chance = 25;
+
+
if (countitem(FishingRod) < 1)
{
narrator
l("You don't have a @@.", getitemlink(FishingRod));
return -1;
}
- if (Fishing_Tick > gettimetick(2) - 20)
+
+// @pull :
+// 0 = never try (goto choose bait)
+// 1 = bait done
+// 2 = fish bite bait
+// 3 = pull too late or soon, Leave the spot, or already pulled a carp ( goto choose bait)
+
+ switch (@pull)
{
- closedialog;
- return -3;
+ case 1:
+ {
+ narrator 5,
+ l("You pulled too soon and lost the bait.");
+ // @pull is 1 and the player talk to npc too late
+ // delete the timer for pull, and set 3 cancel the bait
+ @pull = 3;
+ // delete the timer, the bait is lost, no need to tease the player with a useless signal :3
+ deltimer "" + getarg(0) + "::OnPull";
+ close;
+ }
+ case 2:
+ // with this new system of pull i think this check become useless
+ // but that can prevent the player to start a fishing in one spot and complete in another
+ getmapxy (.@mapbis$, .@xbis, .@ybis, 0);
+ if (.@xbis != @x || .@ybis != @y || !compare (@map$, .@mapbis$))
+ {
+ narrator
+ l("You left your fishing spot!");
+ // Leave spot, lost the bait, set @pull 3
+ @pull = 3;
+ close;
+ }
+ .@timediff = gettimetick(0) - @tick;
+ .@rnd = rand(.@timediff);
+ if (rand(.@rare_fish_chance) == 0)
+ .@fish_id = GrassCarp;
+ // debugmes "timediff = " + .@timediff;
+
+ if (.@rnd <= .@pull_rand_max)
+ {
+ getitem .@fish_id, 1;
+
+ narrator 1,
+ l("You caught a @@!", getitemname(.@fish_id));
+ // player got the fish, done, set @pull 3
+ @pull = 3;
+ close;
+ }
+ else
+ {
+ narrator 5,
+ l("You pulled too late and lost the bait.");
+ // the player pull to late, set @pull 3
+ @pull = 3;
+ close;
+ }
+ case 3:
+ {
+ break;
+ }
}
- .@wait_time_min = 8000;
- .@wait_time_max = 35000;
- .@pull_rand_max = 800;
- .@pull_timeout = 1500;
- .@fish_id = CommonCarp;
- .@max_wait_times = 3;
- .@rare_fish_chance = 25;
+L_ChooseBait:
+ if (Fishing_Tick > gettimetick(2) - 20)
+ {
+ mes "Busy, please, wait few seconds.";
+ close;
+ }
setarray .@bait_ids[0], SmallTentacles, Bread, Aquada,
UrchinMeat, TortugaTongue,
Tentacles;
-L_ChooseBait:
+
.@curr_wait_times = 0;
.@sel$ = "";
.@cnt = 0;
@@ -72,81 +142,17 @@ L_ChooseBait:
narrator 3,
l("You use a @@ as bait.", getitemname(.@bait)),
- l("You patiently wait...");
-
-L_Wait:
- getmapxy (.@map$, .@x, .@y, 0);
-
- sleep2 rand(.@wait_time_min, .@wait_time_max);
- .@tick = gettimetick(0);
- Fishing_Tick = 0;
+ l("You patiently wait..."); // maybe adding here informatiopn about effect
+ // because the player don't know he need to wait the signal effect
+ getmapxy (@map$, @x, @y, 0);
- getmapxy (.@mapbis$, .@xbis, .@ybis, 0);
- if (.@xbis != .@x || .@ybis != .@y || !compare (.@map$, .@mapbis$))
- {
- narrator
- l("You left your fishing spot!");
- close;
- }
-
- mes col(l("Splash!"), 9);
- mes "";
+ .@delay = rand(.@wait_time_min, .@wait_time_max);
- menuint
- l("Pull!"), 1,
- l("Wait..."), 2,
- l("Give up."), 3;
+ // set 1 the @pull, the bait is ready, player need to wait the signal
+ @pull = 1;
+ // @spot$ is set by the spot npc
+ addtimer .@delay, "" + getarg(0) + "::OnPull";
- switch (@menuret)
- {
- case 1:
- .@timediff = gettimetick(0) - .@tick;
- .@rnd = rand(.@timediff);
- if (rand(.@rare_fish_chance) == 0)
- .@fish_id = GrassCarp;
- // debugmes "timediff = " + .@timediff;
-
- if (.@rnd <= .@pull_rand_max)
- {
- getitem .@fish_id, 1;
-
- narrator 1,
- l("You caught a @@!", getitemname(.@fish_id));
-
- return 1;
- }
- else
- {
- narrator 5,
- l("You pulled too late and lost the bait.");
-
- goto L_ChooseBait;
- }
-
- case 2:
- .@curr_wait_times += 1;
-
- if (.@curr_wait_times > .@max_wait_times)
- {
- narrator 5,
- l("The fish ate all your bait.");
- goto L_ChooseBait;
- }
- else
- {
- narrator 3,
- l("The fish ate small part of your bait."),
- l("But you decide to patiently wait.");
-
- goto L_Wait;
- }
- break;
-
- case 3:
- narrator 1,
- l("You take your fishing rod and leave.");
- return 0;
- }
+ close;
- return;
}