diff options
author | Joseph Botosh <rumly111@gmail.com> | 2015-09-17 01:00:10 +0300 |
---|---|---|
committer | Joseph Botosh <rumly111@gmail.com> | 2015-09-17 01:02:29 +0300 |
commit | d23cd0f379bd01eacea337ffb49b68c4faa1b71c (patch) | |
tree | f333757a8241fbe7f70fb9a418e1f264664fe4a2 /npc/001-1 | |
parent | 87fa4b967fd8670313d991eb0e65bca51f4aba41 (diff) | |
download | serverdata-d23cd0f379bd01eacea337ffb49b68c4faa1b71c.tar.gz serverdata-d23cd0f379bd01eacea337ffb49b68c4faa1b71c.tar.bz2 serverdata-d23cd0f379bd01eacea337ffb49b68c4faa1b71c.tar.xz serverdata-d23cd0f379bd01eacea337ffb49b68c4faa1b71c.zip |
add quest Catch the Piou
Diffstat (limited to 'npc/001-1')
-rw-r--r-- | npc/001-1/flyingpiou.txt | 150 | ||||
-rw-r--r-- | npc/001-1/salem.txt | 86 |
2 files changed, 192 insertions, 44 deletions
diff --git a/npc/001-1/flyingpiou.txt b/npc/001-1/flyingpiou.txt index a1bdfa0f1..ff558a9e2 100644 --- a/npc/001-1/flyingpiou.txt +++ b/npc/001-1/flyingpiou.txt @@ -6,7 +6,97 @@ // Variables: // none -001-1,95,84,0 script #FlyingPiou1 NPC_FLYING_PIOU,{ +function script ArtisFlyingPiouLogic { + .@tick = gettimetick(1); + .@LastTimeTouched = getvariableofnpc(.LastTimeTouched, strnpcinfo(3)); + if (.@tick > .@LastTimeTouched + 300) + { + npcspeed 200; + set getvariableofnpc(.LastPlayerTouched, strnpcinfo(3)), -1; + } + return; +} + +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"; + mes col(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; + end; + } + + .LastTimeTouched = .@tick; + + .@rnd = TryCatchPiou(); + if (!.@rnd) + { + npcstop; + stopnpctimer; + getmapxy(.@map$, .@x, .@y, 1); + npcwalkto .@x, .@y; + .@trader$ = "Salem#001-1"; + mesn "Narrator"; + mes col(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("The Piou escaped :-P"); + set getvariableofnpc(.LastPiouHunterID, .@trader$), .@charid; + set getvariableofnpc(.PiouCaught, .@trader$), 1; + donpcevent .@trader$ + "::OnPiouFlee"; + next; + 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]; + npcspeed max(140, 200 - 10 * (@ArtisQuests_CatchPiouTries + + ArtisQuests_CatchPiou_Difficulcy)); + } + end; + +OnPCLogoutEvent: + debugmes strnpcinfo(0) + "::OnPCLogoutEvent"; + end; + +OnHour00: + .LastTimeTouched = 0; end; OnTimer1000: @@ -19,8 +109,9 @@ OnTimer1000: OnInit: setnpcsex G_OTHER; - setnpcdistance 0; - initmovegraph "fountain_1", 95, 84, + setnpcdistance 5; + initmovegraph "market_start", 53, 117, + "fountain_1", 95, 84, "fountain_2", 83, 97, "fountain_3", 80, 86, "river_bank_1", 117, 98, @@ -28,36 +119,47 @@ OnInit: "chelios_1", 102, 112, "market_1", 81, 118, "market_2", 63, 119, - "spot_1", 55, 98, "taree_1", 69, 82, "inn_1", 112, 79, "steps_1", 109, 63, "beh_twnhall_1", 89, 52, "taree_2", 67, 67, - "taree_3", 56, 85 + "taree_3", 56, 85, + "batiment_1", 55, 98, + "batiment_2", 39, 88, + "batiment_3", 36, 108, + "batiment_4", 45, 121, + "batiment_5", 53, 106 ; - setmovegraphcmd "fountain_1", "river_bank_1", 1, "moveon", - "river_bank_1", "river_bank_2", 1, "moveon", - "river_bank_2", "chelios_1", 1, "moveon", - "chelios_1", "fountain_2", 1, "moveon", - "fountain_2", "fountain_3", 1, "moveon", - "chelios_1", "market_1", 1, "moveon", - "market_1", "market_2", 1, "moveon", - "market_2", "spot_1", 1, "moveon", - "spot_1", "taree_1", 1, "moveon", - "taree_1", "fountain_3", 1, "moveon", - "fountain_3", "fountain_1", 1, "moveon", - "spot_1", "taree_3", 1, "moveon", - "taree_3", "taree_2", 1, "moveon", - "taree_2", "beh_twnhall_1",1, "moveon", - "beh_twnhall_1", "steps_1", 1, "moveon", - "steps_1", "inn_1", 1, "moveon", - "steps_1", "fountain_1", 1, "moveon", - "inn_1", "river_bank_1", 1, "moveon" + setmovegraphcmd "fountain_1", "river_bank_1", 1, "call ArtisFlyingPiouLogic", + "river_bank_1", "river_bank_2", 1, "call ArtisFlyingPiouLogic", + "river_bank_2", "chelios_1", 1, "call ArtisFlyingPiouLogic", + "chelios_1", "fountain_2", 1, "call ArtisFlyingPiouLogic", + "fountain_2", "fountain_3", 1, "call ArtisFlyingPiouLogic", + "chelios_1", "market_1", 1, "call ArtisFlyingPiouLogic", + "market_1", "market_2", 1, "call ArtisFlyingPiouLogic", + "market_2", "batiment_1", 1, "call ArtisFlyingPiouLogic", + "batiment_1", "taree_1", 1, "call ArtisFlyingPiouLogic", + "batiment_1", "batiment_2", 1, "call ArtisFlyingPiouLogic", + "batiment_2", "batiment_3", 1, "call ArtisFlyingPiouLogic", + "batiment_3", "batiment_4", 1, "call ArtisFlyingPiouLogic", + "batiment_4", "market_2", 1, "call ArtisFlyingPiouLogic", + "taree_1", "fountain_3", 1, "call ArtisFlyingPiouLogic", + "fountain_3", "fountain_1", 1, "call ArtisFlyingPiouLogic", + "batiment_1", "taree_3", 1, "call ArtisFlyingPiouLogic", + "taree_3", "taree_2", 1, "call ArtisFlyingPiouLogic", + "taree_2", "beh_twnhall_1",1, "call ArtisFlyingPiouLogic", + "beh_twnhall_1", "steps_1", 1, "call ArtisFlyingPiouLogic", + "steps_1", "inn_1", 1, "call ArtisFlyingPiouLogic", + "steps_1", "fountain_1", 1, "call ArtisFlyingPiouLogic", + "inn_1", "river_bank_1", 1, "call ArtisFlyingPiouLogic", + "market_start", "batiment_1", 1, "call ArtisFlyingPiouLogic" ; - firstmove "speed 200"; + firstmove "speed 200", "market_start"; initnpctimer; + + .LastPlayerTouched = -1; end; } diff --git a/npc/001-1/salem.txt b/npc/001-1/salem.txt index 957a1bde4..e36882726 100644 --- a/npc/001-1/salem.txt +++ b/npc/001-1/salem.txt @@ -9,18 +9,25 @@ // Quest states: // 0 -- not started // 1 -- trader asked to catch piou -// 2 -- piou caught, going back to trader -// 4 -- quest finished +// 2 -- quest finished +// Note: this script is ugly like hell 001-1,57,118,0 script Salem#001-1 NPC_SHOP_BAG,{ function BuyPiou { .@price = getarg(0); + mesq l("The piou costs @@E", .@price); + next; + menuint l("Alright, I take it."), 1, + l("I changed my mind."), 2; + + mes ""; + mesn; + if (@menuret == 2) + return 4; if (Zeny < .@price) { - mesq l("Don't you try to trick an old merchant! " - "You don't have enough money, you need @@E", - .@price); + mesq l("Don't you try to trick an old merchant! You don't have enough money, you need @@E", .@price); next; return 1; } @@ -33,36 +40,47 @@ getinventorylist; if (.@inventorylist_count >= 100) { - mesq l("You don't have enough room in your backpack for a Piou Egg. " - "Get rid of some junk and come back."); + mesq l("You don't have enough room in your backpack for a Piou Egg. Get rid of some junk and come back."); next; return 3; } Zeny = Zeny - .@price; getitem 4000, 1; + ArtisQuests_PiousBought += 1; mesq l("You take good care of your piou. Remember to feed it every day."); next; return 0; } + if (2 == select("[debug]continue quest:[debug] start over")) + { + debugmes "Starting quest CatchPiou over"; + setq ArtisQuests_CatchPiou, 0; + } + .@q = getq(ArtisQuests_CatchPiou); @ArtisQuests_PiouPrice = 30000; mesn; if (.@q == 1) { - mesq l("So, where is my piou? You should keep the given promise."); - close; - } - else if (.@q == 2) - { - mesq l("Ah, great! Now you get a nice discount on Pious."); - @ArtisQuests_PiouPrice = 3000; - if (!BuyPiou(@ArtisQuests_PiouPrice)) - setq ArtisQuests_CatchPiou, 4; + if (.PiouCaught) + { + mesq l("Ah, great! Now you get a nice discount on a piou."); + @ArtisQuests_PiouPrice = 3000; + ArtisQuests_PiouDiscount = 1; + donpcevent strnpcinfo(3) + "::OnPiouFlee"; + next; + setq ArtisQuests_CatchPiou, 2; + ArtisQuests_CatchPiou_Difficulcy = 0; + if (!BuyPiou(@ArtisQuests_PiouPrice)) + ArtisQuests_PiouDiscount = 0; + } + else + mesq l("So, where is my piou? You should keep the given promise."); close; } - + mesq l("Good day, my friend, come closer, come closer!"); next; mesq l("Just look at my goods for sale! Fresh fruits and vegetables were shipped only this morning. And for reasonable price, of course."); @@ -70,7 +88,7 @@ menuint rif(.@q == 0, l("What about those pious? They look so cute.")), 0, - rif(.@q == 4, l("I'd like to buy a piou.")), 1, + rif(.@q == 2, l("I'd like to buy a piou.")), 1, l("I'd like to see your other products."), 2; mes ""; @@ -81,7 +99,15 @@ case 0: goto L_AboutPious; case 1: - BuyPiou @ArtisQuests_PiouPrice; + if (.@q == 2 && ArtisQuests_PiouDiscount) + { + mesq l("You still have a 90% discount on one piou"); + @ArtisQuests_PiouPrice = 3000; + next; + } + if (!BuyPiou(@ArtisQuests_PiouPrice)) + ArtisQuests_PiouDiscount = 0; + mesq l("See you next time!"); close; case 2: goto L_BuyShop; @@ -106,7 +132,7 @@ L_AboutPious: next; menuint l("Sounds like easy money. I'll do it."), 0, - l("I don't really have time to chase pious, let me just buy one for it's real price."), 1, + l("I don't really have time to chase pious, let me just buy one for it's real price (30000E)."), 1, l("I don't want to buy a piou right now."), 2; mes ""; @@ -118,6 +144,7 @@ L_AboutPious: goto L_QuestInfo; case 1: BuyPiou @ArtisQuests_PiouPrice; + mesq l("See you later!"); close; case 2: mesq l("See you later!"); @@ -128,6 +155,7 @@ L_QuestInfo: mesq l("The little piou is flying nearby, all you need is to catch it and bring back to me."); next; setq ArtisQuests_CatchPiou, 1; + ArtisQuests_CatchPiou_Difficulcy = 2; mesq l("Good luck!"); close; @@ -135,6 +163,24 @@ L_BuyShop: mes "not implemented yet!"; close; +OnPiouFlee: + sleep 120000; + if (!.PiouCaught) + end; + .PiouCaught = 0; + .@piou$ = "#FlyingPiou1"; + if (getstrlen(.LastPiouHunter$) > 0) + { + message .LastPiouHunter$, .PiouEscapedMessage$; + .LastPiouHunter$ = ""; + } + // debugmes "The piou escaped from " + .LastPiouHunter$; + sleep 60000; + enablenpc .@piou$; + movenpc .@piou$, 53, 117; + donpcevent .@piou$ + "::OnInit"; + end; + OnInit: setnpcsex G_MALE; setnpcdistance 5; |