// TMW2 script // Author: // Jesusalva // Description: // Handles pirate attacks 016-8,0,0,0 script #MarineShipAttack2 NPC_HIDDEN,{ end; OnEvent: // TODO: Make this an instance? warp "016-8", 31, 33; dispbottom l("##1The ship is under a pirate's raid! ##BKill both ship captains before they conclude the loot!"); // How much time you have depend on how many rebirths you have .@time = (90 - (REBIRTH*5)) * 1000; addtimercount "#MarineShip::OnEvent", .@time+1000; addtimer(.@time, "#MarineShipAttack2::OnDefeat"); sleep2(1000); goto OnStart; OnDefeat: warp "000-0-0", 47, 42; // TODO: Warp you to a deserted island? (alone or with the crew duplicates?) dispbottom l("The ship was fully plundered and you were thrown in the sea."); dispbottom l("You now must wait for a passing ship to rescue you and bring you to your original destination."); // Maybe warp back to Candor instead? addtimer 90000, "#MarineShipAttack2::OnResumeTravel"; addtimercount "#MarineShip::OnEvent", 120000; end; OnStart: // TODO: If "OnDefeat" timer is not set, jump to OnDefeat automatically! // Define number of pirates based on player level. // Player count is not important here, as this is run for every player. .@c=max(1, (BaseLevel/15)-REBIRTH); areamonster "016-8", 23, 25, 51, 30, strmobinfo(1, OceanPirate), OceanPirate, .@c, "#MarineShipAttack2::OnPirateDie"; areamonster "016-8", 23, 40, 51, 57, strmobinfo(1, OceanPirate), OceanPirate, .@c, "#MarineShipAttack2::OnPirateDie"; // And the stronger pirates (Blanc's Crew) .@r=max(1,REBIRTH); areamonster "016-8", 23, 40, 47, 57, strmobinfo(1, Thug), Thug, .@r, "#MarineShipAttack2::OnPirateDie"; areamonster "016-8", 23, 40, 47, 57, strmobinfo(1, Swashbuckler), Swashbuckler, .@r, "#MarineShipAttack2::OnPirateDie"; areamonster "016-8", 23, 40, 47, 57, strmobinfo(1, Grenadier), Grenadier, .@r, "#MarineShipAttack2::OnPirateDie"; end; OnDie: // Each OPTIONAL pirate you defeat gives you only 4 seconds! addtimercount "#MarineShip::OnEvent", 4000; addtimercount "#MarineShipAttack2::OnDefeat", 4000; end; OnPirateDie: if (rand2(10000) < REBIRTH) getitem PirateBandana, 1; // Each pirate you defeat gives you 8 seconds addtimercount "#MarineShip::OnEvent", 8000; addtimercount "#MarineShipAttack2::OnDefeat", 8000; // If all pirates are dead the bosses spawn if (!mobcount("016-8", "#MarineShipAttack2::OnPirateDie")) { // You get 18 seconds to defeat each boss, the first boss is additional time. addtimercount "#MarineShip::OnEvent", 18000; addtimercount "#MarineShipAttack2::OnDefeat", 18000; mapannounce "016-8", l("The frigate and pirate ship captains appear! DEFEAT BOTH BEFORE THE SHIP IS LOOTED!!"), bc_map; // *** .@pirate=monster("016-8", 38, 27, "Pirate Captain", Grenadier, 1, "#MarineShipAttack2::OnVictory"); sc_start SC_INCMHP, 900000, 1000, 10000, SCFLAG_FIXEDTICK|SCFLAG_NOAVOID|SCFLAG_NOICON, .@pirate; sc_start SC_ATTHASTE_POTION1, 900000, 40, 10000, SCFLAG_FIXEDTICK|SCFLAG_NOAVOID|SCFLAG_NOICON, .@pirate; sc_start SC_INCHIT, 900000, 1000, 10000, SCFLAG_FIXEDTICK|SCFLAG_NOAVOID|SCFLAG_NOICON, .@pirate; // *** .@pirate=monster("016-8", 24, 54, "Frigate Captain", RedFollower, 1, "#MarineShipAttack2::OnVictory"); sc_start SC_INCMHP, 900000, 1000, 10000, SCFLAG_FIXEDTICK|SCFLAG_NOAVOID|SCFLAG_NOICON, .@pirate; sc_start SC_ATTHASTE_POTION1, 900000, 40, 10000, SCFLAG_FIXEDTICK|SCFLAG_NOAVOID|SCFLAG_NOICON, .@pirate; sc_start SC_INCHIT, 900000, 1000, 10000, SCFLAG_FIXEDTICK|SCFLAG_NOAVOID|SCFLAG_NOICON, .@pirate; // (Re)Spawn support for them as well! .@c=max(1,REBIRTH) + (BaseLevel/32); monster "016-8", 40, 28, strmobinfo(1, OceanPirate), OceanPirate, .@c, "#MarineShipAttack2::OnDie"; monster "016-8", 40, 28, strmobinfo(1, Thug), Thug, .@c, "#MarineShipAttack2::OnDie"; monster "016-8", 24, 55, strmobinfo(1, OceanPirate), OceanPirate, .@c, "#MarineShipAttack2::OnDie"; monster "016-8", 24, 55, strmobinfo(1, Swashbuckler), Swashbuckler, .@c, "#MarineShipAttack2::OnDie"; monster "016-8", 40, 54, strmobinfo(1, Grenadier), Grenadier, .@c, "#MarineShipAttack2::OnDie"; monster "016-8", 32, 44, strmobinfo(1, OceanPirate), OceanPirate, .@c, "#MarineShipAttack2::OnDie"; // "hiding" one which shows up to protect the bridge } end; OnVictory: if (rand2(10000) < REBIRTH+((readparam2(bLuk) + readparam2(bVit)) / 2)) getitem SailorShirt, 1; // You need to defeat both captains to win (TODO: Needs testing) if (mobcount("016-8", "#MarineShipAttack2::OnVictory")) { addtimercount "#MarineShip::OnEvent", 15000; addtimercount "#MarineShipAttack2::OnDefeat", 15000; end; } // Give reward and remove reinforcements areatimer("016-8", 23, 25, 52, 35, 10, "#MarineShipAttack2::OnReward"); killmonster("016-8", "#MarineShipAttack2::OnDie"); end; OnReward: // That would give 10% from missing exp, but I didn't like it. //getexp ((NextBaseExp-BaseExp)/10), 0; addtimercount "#MarineShip::OnEvent", 3500; deltimer("#MarineShipAttack2::OnDefeat"); // Lv 40 rewards: 800 exp, 80 jxp, 400~600 GP getexp BaseLevel*20, BaseLevel*2; Zeny += BaseLevel*rand2(10,15); // 12% chance to get Crazy Rum if (rand2(10000) < 1200+(readparam2(bLuk)*3)) getitem CrazyRum, 1; dispbottom l("Congratulations!"); if (isin("016-8", 23, 25, 52, 60)) addtimer(3000, "#MarineShipAttack2::OnResumeTravel"); end; OnResumeTravel: if (@timer_navio_running) warp "016-6", 31, 33; end; }