From 698624844aad54ad2c382a105b5fb24d3261d7c0 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 8 Jun 2018 13:00:08 -0300 Subject: Soren's House Logic. --- npc/soren-2/_import.txt | 1 + npc/soren-2/main.txt | 191 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100644 npc/soren-2/main.txt (limited to 'npc/soren-2') diff --git a/npc/soren-2/_import.txt b/npc/soren-2/_import.txt index 6c0936688..e7a1264b0 100644 --- a/npc/soren-2/_import.txt +++ b/npc/soren-2/_import.txt @@ -1,3 +1,4 @@ // Map soren-2: Soren House // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/soren-2/_warps.txt", +"npc/soren-2/main.txt", diff --git a/npc/soren-2/main.txt b/npc/soren-2/main.txt new file mode 100644 index 000000000..a844634b4 --- /dev/null +++ b/npc/soren-2/main.txt @@ -0,0 +1,191 @@ +// TMW2 Scripts +// Author: +// Jesusalva +// Description: +// Celestia Yeti King's quest. This controls Soren's House Indoors. It will +// handle Lobby event, and is called by Soren's House script. +// It'll then spawn monsters and/or items, but with addtimer technology. +// Once all monsters are dead, and minimum time is over, a portal will show up. +// This later control is done by npctimer. The spawn logic continues, though. +// The addtimer will use compareandsetq, and the warp will use it too, so if +// you haven't spawned your quota, you won't be able to use the portal. +// +// The use of compareandsetq HurnscaldQuest_Celestia +// Ensures you're NOT capable of skipping to final stage in order to finish +// the quest. Nice attempt, but that won't work. The scripts will advance, +// but you'll stay at the same quest state, and when it's checked, you will +// be with bound hands. +// +// OnCheck: +// Everytime you kill a monster, this checks if all mobs are dead, and you +// have finished your share of spawns. Friends can really make your life +// harder. +// OnSanctum: +// This runs every once in a while, and may either spawn things, or drop +// items. ...Needless to say, if it spawn things, everyone on the room will +// get mad at you. Luck you, here's not PVP. +// +// One last thing. If you're way past your share, you'll get warnings about +// messing other players life. Simply use the warp, or leave the house and +// come back. If you don't, you'll be kicked from the game via @kick. +// Why? Because Jesusalva did this script. + +soren-2,38,29,0 script #SorenSanctum NPC_NO_SPRITE,0,0,{ + end; + +OnTouch: + if (@sorensanctum >= 5 && !mobcount(.map$, "#SorenSanctum::OnCheck")) { + dispbottom l("Error, contact Jesusalva! Missing warp. Healing & Reseting temporaly."); + percentheal 100, 100; + @sorensanctum=@sorensanctum-5; + } + end; + +OnCheck: + if (!mobcount(.map$, "#SorenSanctum::OnCheck")) + setnpcdisplay .name$, NPC_SUMMONING_CIRC; + end; + +OnSanctum: + //setnpcdisplay .name$, NPC_NO_SPRITE; + ++@sorensanctum; + + // Decide if we'll spawn or add items. Previous failures are NOT considerated. + .@odds=rand(1, 10000); + .@amount=rand(1, 3); + .@lx=24; .@ly=27; + .@ux=40; .@uy=36; + + // Generate which monster/item would be dropped, depending on your (un)luck at ODDS + .@mid=rand(1,10); + switch (.@mid) { + case 1: + .@monsterId = Moonshroom ; break; + case 2: + .@monsterId = CaveMaggot ; break; + case 3: + .@monsterId = FallenGuard2 ; break; + case 4: + .@monsterId = BlackScorpion ; break; + case 5: + .@monsterId = LavaSlime ; break; + case 6: + .@monsterId = RedScorpion ; break; + case 7: + .@monsterId = Snake ; break; + case 8: + .@monsterId = SeaSlime ; break; + case 9: + .@monsterId = Mouboo ; break; + default: + .@monsterId = Yeti ; break; + } + // Item Gen + .@mid=rand(1,10); + switch (.@mid) { + case 1: + .@itemId = Acorn ; break; + case 2: + .@itemId = Bread ; break; + case 3: + .@itemId = Aquada ; break; + case 4: + .@itemId = BlackScorpionStinger ; break; + case 5: + .@itemId = Plushroom ; break; + case 6: + .@itemId = Piberries ; break; + case 7: + .@itemId = Croconut ; break; + case 8: + .@itemId = Chagashroom ; break; + case 9: + .@itemId = Manana ; break; + default: + .@itemId = rand(CopperOre, TitaniumOre) ; break; + } + + + // Core Logic + // 1%: Super Rare drop + if (.@odds <= 100) { + makeitem(.@itemId, 1, .map$, rand(.@lx, .@ux), rand(.@ly, .@uy)); + // 9%: Rare Drop + } else if (.@odds <= 1000) { + makeitem(.@itemId, 1, .map$, rand(.@lx, .@ux), rand(.@ly, .@uy)); + // 10%: Normal Drop + } else if (.@odds <= 2000) { + makeitem(.@itemId, 1, .map$, rand(.@lx, .@ux), rand(.@ly, .@uy)); + // 50%: Normal Spawn + } else if (.@odds <= 7000) { + areamonster .map$, .@lx, .@ly, .@ux, .@uy, strmobinfo(1, .@monsterId), .@monsterId, .@amount; + // 10%: Rare Spawn + } else if (.@odds <= 8000) { + areamonster .map$, .@lx, .@ly, .@ux, .@uy, strmobinfo(1, .@monsterId), .@monsterId, .@amount; + // 19%: Drop + Spawn + } else if (.@odds <= 9900) { + areamonster .map$, .@lx, .@ly, .@ux, .@uy, strmobinfo(1, .@monsterId), .@monsterId, .@amount; + makeitem(.@itemId, 1, .map$, rand(.@lx, .@ux), rand(.@ly, .@uy)); + // 1%: Super Rare Spawn + } else { + areamonster .map$, .@lx, .@ly, .@ux, .@uy, strmobinfo(1, .@monsterId), .@monsterId, .@amount; + } + + + // Handle maximum overtime you can do here: 10 cycles, or 3m20s ~ 6m40s + if (@sorensanctum == 8) { + dispbottom col("WARNING: Do not spend unecessary time on Soren's House, you'll be disconnected!", 1); + percentheal -5, -20; + } + if (@sorensanctum == 9) { + dispbottom col("FINAL WARNING: Do not spend unecessary time on Soren's House, you'll be disconnected!!", 1); + percentheal -20, -100; + } + if (@sorensanctum >= 10) { + atcommand "@kick \""+strcharinfo(0)+"\""; + npctalk l("The power of Soren's House kicks @@ like a game master.", strcharinfo(0)); + } + + // Random 20~40 seconds before next cycle. (Minimum 100~200 seconds, or 1m40s~3m20s) + addtimer(rand(20000, 40000), "#SorenSanctum::OnSanctum"); + end; + +OnStart: + // If you're past stage 4, skip this. I could set here to stage 5, so this + // intro won't play again. But if it plays again, your progress is reset, and + // it is harder this way, so I'm not touching on quest state :> + if (getq(HurnscaldQuest_Celestia) != 4) + end; + // When we reach here, we have both a player attached, and the player was already warped. + // I don't know if you walked in and out the house, though. If you do, this will loop... + // Which is actually bad for you, as that will reset your progress!! + npctalk3 l("Well well well, @@, good job in reaching Soren's House.", strcharinfo(0)); + addtimer(3000, "#SorenSanctum::OnStep2"); + end; + +OnStep2: + //setnpcdisplay .name$, NPC_YETI_KING; + npctalk3 l("You done well in getting so far. I didn't thought you would make it."); + addtimer(3000, "#SorenSanctum::OnStep3"); + end; + +OnStep3: + npctalk3 l("The Cave Of Trials, and the Soren's Village... There's only one thing left."); + addtimer(3000, "#SorenSanctum::OnStep4"); + end; + +OnStep4: + npctalk3 l("...You still have not overcome his house."); + addtimer(3000, "#SorenSanctum::OnStep5"); + end; + +OnStep5: + //setnpcdisplay .name$, NPC_NO_SPRITE; + npctalk3 l("May the last line of defense of Soren's happen. Once you're done, this will become a warp. Hurry before it closes."); + @sorensanctum=0; + addtimer(5000, "#SorenSanctum::OnSanctum"); + end; + +OnInit: + end; +} -- cgit v1.2.3-60-g2f50