summaryrefslogtreecommitdiff
path: root/npc/001-1/flyingpiou.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/001-1/flyingpiou.txt')
-rw-r--r--npc/001-1/flyingpiou.txt160
1 files changed, 160 insertions, 0 deletions
diff --git a/npc/001-1/flyingpiou.txt b/npc/001-1/flyingpiou.txt
new file mode 100644
index 00000000..ea48f4dc
--- /dev/null
+++ b/npc/001-1/flyingpiou.txt
@@ -0,0 +1,160 @@
+// Evol scripts.
+// Author:
+// Travolta
+// Description:
+// Pious flying around town
+// Variables:
+// none
+
+function script ArtisFlyingPiouLogic {
+ .@tick = gettimetick(1);
+ .@LastTimeTouched = getvariableofnpc(.LastTimeTouched, strnpcinfo(3));
+ if (.@tick > .@LastTimeTouched + 300)
+ {
+ .speed = 200;
+ set getvariableofnpc(.LastPlayerTouched, strnpcinfo(3)), -1;
+ }
+ .@rnd = rand(5) - 3;
+ if (.@rnd > 0)
+ return execmovecmd("wait " + .@rnd);
+ return 0;
+}
+
+001-1,53,117,0 script #FlyingPiou1 NPC_FLYING_PIOU,{
+
+ function TryCatchPiou {
+ .@agi = readparam(bAgi);
+ @ArtisQuests_CatchPiouTries += 1;
+ getmapxy(.@map$, .@x1, .@y1, 1);
+ getmapxy(.@map$, .@x2, .@y2, 0);
+ .@distance = distance(.@x1, .@y1, .@x2, .@y2);
+ .@chance = max(ArtisQuests_CatchPiou_Difficulcy,
+ 20 + .@distance * 5 - .@agi/10 -
+ @ArtisQuests_CatchPiouTries);
+ return rand(.@chance);
+ }
+
+ .@charid = getcharid(0);
+ if (.LastPlayerTouched <= 0)
+ {
+ .LastPlayerTouched = .@charid;
+ @ArtisQuests_CatchPiouTries = 0;
+ }
+ else if (.LastPlayerTouched != .@charid)
+ {
+ message strcharinfo(0), l("Hm, it seems another player is trying to catch the piou, I shouldn't interfere.");
+ end;
+ }
+
+ .@q = getq(ArtisQuests_CatchPiou);
+ if (.@q != 1)
+ {
+ mesn "Narrator";
+ mesc(l("You scare the piou, but let it go."), 9);
+ close;
+ }
+
+ .@tick = gettimetick(1);
+ if (.@tick < .LastTimeTouched + min(4, ArtisQuests_CatchPiou_Difficulcy
+ + @ArtisQuests_CatchPiouTries / 3))
+ {
+ message strcharinfo(0), l("Dang, I scared it! More patience, @@, more patience.", strcharinfo(0));
+ .LastTimeTouched = .@tick;
+ specialeffect(33, SELF);
+ end;
+ }
+
+ .LastTimeTouched = .@tick;
+
+ .@rnd = TryCatchPiou();
+ if (!.@rnd)
+ {
+ npcstop;
+ stopnpctimer;
+ getmapxy(.@map$, .@x, .@y, 1);
+ npcwalkto .@x, .@y;
+ .@trader$ = "Salem#001-1";
+ mesn "Narrator";
+ mesc(l("You caught the piou, but it's trying to escape from you. You'd better hurry back to Salem."), 9);
+ set getvariableofnpc(.LastPiouHunter$, .@trader$), strcharinfo(0);
+ set getvariableofnpc(.PiouEscapedMessage$, .@trader$), l("Oh no, the piou escaped!");
+ set getvariableofnpc(.LastPiouHunterID, .@trader$), .@charid;
+ set getvariableofnpc(.PiouCaught, .@trader$), 1;
+ donpcevent .@trader$ + "::OnPiouFlee";
+ specialeffect(26, SELF);
+ close2;
+ disablenpc strnpcinfo(3);
+ close;
+ }
+ else
+ {
+ setarray .RandomFailureMessages$[0], l("So close!"), l("It escaped!"), l("Almost got it!"), l("Oh, the little...");
+ .@r = rand(getarraysize(.RandomFailureMessages$));
+ message strcharinfo(0), .RandomFailureMessages$[.@r];
+ .speed = max(140, 200 - 10 * (@ArtisQuests_CatchPiouTries +
+ ArtisQuests_CatchPiou_Difficulcy));
+ specialeffect(33, SELF);
+ }
+ end;
+
+OnHour00:
+ .LastTimeTouched = 0;
+ end;
+
+OnTimer1000:
+ dographmovestep;
+
+OnInit:
+ .distance = 5;
+ .walkmask = WALK_WATER;
+ // .debug = 1;
+
+ initmovegraph "market_start", 53, 117,
+ "fountain", 79, 75, 102, 91,
+ "river_bank_1", 107, 94, 117, 102,
+ "river_bank_2", 117, 110,
+ "chelios_right", 100, 112, 113, 118,
+ "chelios_left", 80, 95, 93, 111,
+ "market_right", 74, 114, 83, 121,
+ "market_center", 50, 113, 66, 121,
+ "market_left", 36, 120, 42, 128,
+ "batiment_inside", 48, 138, 65, 106,
+ "batiment_behind", 33, 90, 41, 103,
+ "library_front", 42, 82, 63, 90,
+ "taree_yard", 69, 82,
+ "taree_behind", 61, 62, 76, 71,
+ "townhall_behind", 73, 40, 93, 55,
+ "townhall_right", 99, 55, 106, 60,
+ "inn_behind", 107, 63, 123, 76
+ ;
+
+ setmovegraphcmd "fountain", "river_bank_1", 1, "call ArtisFlyingPiouLogic",
+ "river_bank_1", "river_bank_2", 1, "call ArtisFlyingPiouLogic",
+ "river_bank_2", "chelios_right", 2, "call ArtisFlyingPiouLogic",
+ "chelios_right", "chelios_left", 1, "call ArtisFlyingPiouLogic",
+ "chelios_left", "fountain", 1, "wait 1; call ArtisFlyingPiouLogic",
+ "chelios_left", "market_right", 1, "call ArtisFlyingPiouLogic",
+ "chelios_right", "market_right", 1, "call ArtisFlyingPiouLogic",
+ "market_right", "market_center", 1, "call ArtisFlyingPiouLogic",
+ "market_center", "batiment_inside",1, "call ArtisFlyingPiouLogic",
+ "batiment_inside","library_front", 1, "call ArtisFlyingPiouLogic",
+ "library_front", "taree_yard", 1, "call ArtisFlyingPiouLogic",
+ "library_front", "taree_behind", 1, "call ArtisFlyingPiouLogic",
+ "library_front", "batiment_behind",1, "call ArtisFlyingPiouLogic",
+ "batiment_behind","market_left", 1, "wait 3; call ArtisFlyingPiouLogic",
+ "market_left", "market_center", 1, "call ArtisFlyingPiouLogic",
+ "taree_yard", "fountain", 1, "call ArtisFlyingPiouLogic",
+ "taree_behind", "townhall_behind",1, "call ArtisFlyingPiouLogic",
+ "townhall_behind","townhall_right", 1, "call ArtisFlyingPiouLogic",
+ "townhall_right", "inn_behind", 1, "call ArtisFlyingPiouLogic",
+ "inn_behind", "fountain", 1, "wait 2; call ArtisFlyingPiouLogic",
+ "inn_behind", "river_bank_1", 1, "call ArtisFlyingPiouLogic",
+ "market_start", "batiment_inside",1, "call ArtisFlyingPiouLogic"
+ ;
+
+ firstmove "speed 200", "market_start";
+ initnpctimer;
+
+ .LastPlayerTouched = -1;
+ end;
+}