diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-04-30 12:00:26 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-04-30 12:00:26 -0300 |
commit | 9c31b781c11ebd39bce4b7093a2d1f256b8d4441 (patch) | |
tree | c707c31c3e43aa3967e48ecfa9b03289fb7ad0ee /npc/042-5 | |
parent | 180c110df67a6a40678f5f2c51a6e759c1e6f6d3 (diff) | |
download | serverdata-9c31b781c11ebd39bce4b7093a2d1f256b8d4441.tar.gz serverdata-9c31b781c11ebd39bce4b7093a2d1f256b8d4441.tar.bz2 serverdata-9c31b781c11ebd39bce4b7093a2d1f256b8d4441.tar.xz serverdata-9c31b781c11ebd39bce4b7093a2d1f256b8d4441.zip |
First prototype for 042-5 Sewers mobs (just the code struct)
Diffstat (limited to 'npc/042-5')
-rw-r--r-- | npc/042-5/_import.txt | 1 | ||||
-rw-r--r-- | npc/042-5/ctrl.txt | 114 |
2 files changed, 115 insertions, 0 deletions
diff --git a/npc/042-5/_import.txt b/npc/042-5/_import.txt index 3b84e6ab4..cacf2e909 100644 --- a/npc/042-5/_import.txt +++ b/npc/042-5/_import.txt @@ -1,3 +1,4 @@ // Map 042-5: Camelot - Sewer Paths // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/042-5/_warps.txt", +"npc/042-5/ctrl.txt", diff --git a/npc/042-5/ctrl.txt b/npc/042-5/ctrl.txt new file mode 100644 index 000000000..d017a9bc1 --- /dev/null +++ b/npc/042-5/ctrl.txt @@ -0,0 +1,114 @@ +// TMW 2 Script +// Author: +// Jesusalva +// Micksha +// Description: +// Controls sewers. +// FIXME: The warps back should only work if treasure was found +// Spawn monsters and respawns them. + +// A simple random treasure chest - to be sure players were introduced to this +// awesome system. Same rules as any treasure box still applies. +042-5,0,0,0 script #ctrl0425 NPC_CHEST,{ + function monster0425; + 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); + monster0425(1, 20, 20, 115, 100, .@mx); + monster0425(4, 20, 51, 51, 71, .@mx); + monster0425(5, 85, 56, 115, 100, .@mx); + monster0425(2, 79, 40, 97, 52, .@mx); + monster0425(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(2)) + areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, MagicBif), MagicBif, 1); + if (!rand2(2)) + areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, SilverChest), SilverChest, 1); + if (!rand2(2)) + areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, BronzeChest), BronzeChest, 1); + // Next time I promise a Whirly Bird >.> + end; + +OnKillMob: + if (!playerattached()) + goto OnRespawn; + // Maybe a reward is due + .@g=getcharid(2); + if (.@g < 1) percentheal -100, -100; + getexp $KAMELOT_MX[.@g]*7, $KAMELOT_MX[.@g]*3; + // FALLTHROUGH + +OnRespawn: + sleep(3000); + // 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; + } + monster0425(1, 20, 20, 115, 100, $KAMELOT_MX[.@g]); + end; + +function monster0425 { + .@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-5"); + //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$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mobId), .@mobId, 1, .@label$); + // Reconfigure the monster + setunitdata(.@mob, UDT_LEVEL, .@avg); + setunitdata(.@mob, UDT_STR, 1+.@avg*5/10); + setunitdata(.@mob, UDT_AGI, 1+.@avg*4/10); + setunitdata(.@mob, UDT_VIT, 1+.@avg*5/10); + setunitdata(.@mob, UDT_INT, 1+.@avg*5/10); + setunitdata(.@mob, UDT_DEX, 1+.@avg*5/10); + setunitdata(.@mob, UDT_LUK, 1+.@avg*4/10); + setunitdata(.@mob, UDT_ADELAY, 1472); + setunitdata(.@mob, UDT_ATKRANGE, (.@mobId == CursedArcher ? any(6,7) : any(1,2))); + // Battle Status + setunitdata(.@mob, UDT_MAXHP, .@avg*38); + setunitdata(.@mob, UDT_HP, .@avg*38); + setunitdata(.@mob, UDT_ATKMIN, .@avg*50/10); + setunitdata(.@mob, UDT_ATKMAX, .@avg*70/10); + setunitdata(.@mob, UDT_DEF, 1+.@avg*11/10); + setunitdata(.@mob, UDT_MDEF, 1+.@avg*7/10); + setunitdata(.@mob, UDT_HIT, .@avg*6); // Advised: x3 + setunitdata(.@mob, UDT_FLEE, .@avg*40/10); // Advised: x4 + // Critical calculation + .@min=8; + .@max=max(.@min, min(35, .@avg/4)); + setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max)); + // Loop through + } + freeloop(false); + return; + } + +} + + + |