From fecce8c6a6fa825de4af4f213e0c1d68f8fbe9c6 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 30 Apr 2020 11:26:30 -0300 Subject: Monster Population and script logic for first sewers part --- npc/014-4/kamelot.txt | 5 +-- npc/042-3/_import.txt | 1 - npc/042-3/_warps.txt | 3 -- npc/042-3/jail.txt | 20 ++++++++++++ npc/042-4/ctrl.txt | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 112 insertions(+), 7 deletions(-) delete mode 100644 npc/042-3/_warps.txt diff --git a/npc/014-4/kamelot.txt b/npc/014-4/kamelot.txt index d5d088888..f6cf38488 100644 --- a/npc/014-4/kamelot.txt +++ b/npc/014-4/kamelot.txt @@ -124,8 +124,8 @@ OnDebug: l("Abort"), l("Reset"), l("Reset & Destroy"), - l("Quest - Skip Krukan fight"), l("Quest - Skip Weapons Room"), + l("Quest - Skip Krukan fight"), "", "", "", @@ -144,14 +144,15 @@ OnDebug: instance_destroy($@KAMELOT_ID[.@g]); KamelotCleanup(.@g); break; + // We now order from bottom-up case 5: - // FIXME: Can a variable really be named "$@GTEMP_042-2@10"? $KAMELOT_QUEST[.@g]=$KAMELOT_QUEST[.@g]|4; mes "WARNING: Krukan Fight and jail skipped."; case 4: $KAMELOT_KEYMASK[.@g]=$KAMELOT_KEYMASK[.@g]|16; mes "WARNING: Weapons Room skipped."; break; + // 10+ are the warp triggers case 10: warp "042-0@"+.@g, 60, 40; break; case 11: diff --git a/npc/042-3/_import.txt b/npc/042-3/_import.txt index 0aec19ef6..4596bff40 100644 --- a/npc/042-3/_import.txt +++ b/npc/042-3/_import.txt @@ -1,4 +1,3 @@ // Map 042-3: Camelot - Jail // This file is generated automatically. All manually added changes will be removed when running the Converter. -"npc/042-3/_warps.txt", "npc/042-3/jail.txt", diff --git a/npc/042-3/_warps.txt b/npc/042-3/_warps.txt deleted file mode 100644 index d86c4911e..000000000 --- a/npc/042-3/_warps.txt +++ /dev/null @@ -1,3 +0,0 @@ -// This file is generated automatically. All manually added changes will be removed when running the Converter. -// Map 042-3: Camelot - Jail warps -042-3,63,19,0 warp #042-3_63_19 1,0,042-4,60,77 diff --git a/npc/042-3/jail.txt b/npc/042-3/jail.txt index 3eeb84648..a7b49739c 100644 --- a/npc/042-3/jail.txt +++ b/npc/042-3/jail.txt @@ -126,6 +126,26 @@ OnKamelotSlide: +// Leave the dungeon +042-3,62,19,0 script #KDoor0423 NPC_HIDDEN,1,0,{ + end; + +OnTouch: + .@g=getcharid(2); + warp "042-4@"+.@g, any(59,60), 77; + addtimer 1000, .name$+"::OnHey"; + end; + +OnHey: + dispbottom l("Oh, here the path seems to split. Which way should we go?"); + addtimer 3000, .name$+"::OnHey2"; + end; + +OnHey2: + dispbottom l("Or should we even split ourselves to check all possible ways?")+" "+col(l("[Caution, this may be dangerous!]"), 1); + end; +} + // Required exit. This one has no conditions, so it is not really required // But I do not trust Instancing System, so better safe than sorry! 042-3,58,140,0 script #KDoor0423B NPC_HIDDEN,0,0,{ diff --git a/npc/042-4/ctrl.txt b/npc/042-4/ctrl.txt index a2b22dd78..600759382 100644 --- a/npc/042-4/ctrl.txt +++ b/npc/042-4/ctrl.txt @@ -11,7 +11,7 @@ // A simple random treasure chest - to be sure players were introduced to this // awesome system. Same rules as any treasure box still applies. 042-4,94,47,0 script #chest_0424 NPC_CHEST,{ - + function monster0424; TreasureBox(); specialeffect(.dir == 0 ? 24 : 25, AREA, getnpcid()); // closed ? opening : closing close; @@ -19,5 +19,93 @@ OnInit: .distance = 2; end; + +OnInstanceInit: + // Yes, we just hope it works out of box + explode(.@map$, .map$, "@"); + .@g=atoi(.@map$[1]); + if (.@g < 1) { + debugmes "[ERROR] [KAMELOT] Unable to spawn for Kamelot %s", .map$; + debugmes "[ERROR] [KAMELOT] Using dummy data (returned: %d)", .@g; + .@g=0; + } + debugmes "Spawning monsters for guild %d", .@g; + .@mx=getguildavg(.@g); + monster0424(1, 20, 20, 115, 100, .@mx); + monster0424(4, 20, 51, 51, 71, .@mx); + monster0424(5, 76, 56, 115, 100, .@mx); + monster0424(2, 79, 40, 97, 52, .@mx); + monster0424(5, 51, 20, 80, 50, .@mx); + + // Neutral monsters + areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, Blub), Blub, 5); + areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, ManaGhost), ManaGhost, max(1, .@mx/10)); + + // Bonus monsters + if (!rand2(3)) + areamonster(.map$, 20, 20, 115, 100, "Micksha's Tortuga", Tortuga, 1); + end; + +OnKillMob: + // Yes, we just hope it works out of box + explode(.@map$, .map$, "@"); + .@g=atoi(.@map$[1]); + if (.@g < 1) { + debugmes "[ERROR] [KAMELOT] Unable to respawn for Kamelot %s", .map$; + .@g=0; + } + monster0424(1, 20, 20, 115, 100, $KAMELOT_MX[.@g]); + + // Maybe a reward is due + if (!playerattached()) end; + .@g=getcharid(2); + if (.@g < 1) percentheal -100, -100; + getexp $KAMELOT_MX[.@g]*7, $KAMELOT_MX[.@g]*3; + end; + +function monster0424 { + .@label$=instance_npcname(.name$)+"::OnKillMob"; + .@gcount=getarg(0); + .@x1=getarg(1); + .@y1=getarg(2); + .@x2=getarg(3); + .@y2=getarg(4); + .@avg=getarg(5); + .@m$=instance_mapname("042-4"); + debugmes "Total %d, map %s (power %d)", .@gcount, .@m$, .@avg; + freeloop(true); + for (.@i=0; .@i < .@gcount; .@i++) { + .@mobId=any(CursedSoldier, CursedArcher); // 50-50 ratio + .@mob=areamonster(.@m$, 21, 24, 59, 99, strmobinfo(1, .@mobId), .@mobId, 1, .@label$); + // Reconfigure the monster + setunitdata(.@mob, UDT_LEVEL, .@avg); + setunitdata(.@mob, UDT_STR, 1+.@avg*3/10); + setunitdata(.@mob, UDT_AGI, 1+.@avg*3/10); + setunitdata(.@mob, UDT_VIT, 1+.@avg*3/10); + setunitdata(.@mob, UDT_INT, 1+.@avg*3/10); + setunitdata(.@mob, UDT_DEX, 1+.@avg*3/10); + setunitdata(.@mob, UDT_LUK, 1+.@avg*3/10); + setunitdata(.@mob, UDT_ADELAY, 1572); + setunitdata(.@mob, UDT_ATKRANGE, (.@mobId == CursedArcher ? any(6,7) : any(1,2))); + // Battle Status + setunitdata(.@mob, UDT_MAXHP, .@avg*36); + setunitdata(.@mob, UDT_HP, .@avg*36); + setunitdata(.@mob, UDT_ATKMIN, .@avg*50/10); + setunitdata(.@mob, UDT_ATKMAX, .@avg*70/10); + setunitdata(.@mob, UDT_DEF, 1+.@avg*10/10); + setunitdata(.@mob, UDT_MDEF, 1+.@avg*6/10); + setunitdata(.@mob, UDT_HIT, .@avg*45/10); // Advised: x3 + setunitdata(.@mob, UDT_FLEE, .@avg*37/10); // Advised: x4 + // Critical calculation + .@min=5; + .@max=max(.@min, min(30, .@avg/4)); + setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max)); + // Loop through + } + freeloop(false); + return; + } + } + -- cgit v1.2.3-70-g09d2