diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-01 03:18:45 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-05-01 03:18:45 -0300 |
commit | cabf8a7658b7a63a55e5ec0588df530c543c572a (patch) | |
tree | 677f556453d6ba294c6cd3111523cc12578d1682 | |
parent | 93d7142a964d9a34c142b0f17d043537534a7f51 (diff) | |
download | serverdata-cabf8a7658b7a63a55e5ec0588df530c543c572a.tar.gz serverdata-cabf8a7658b7a63a55e5ec0588df530c543c572a.tar.bz2 serverdata-cabf8a7658b7a63a55e5ec0588df530c543c572a.tar.xz serverdata-cabf8a7658b7a63a55e5ec0588df530c543c572a.zip |
Save some coding power
-rw-r--r-- | npc/042-5/ctrl.txt | 46 | ||||
-rw-r--r-- | npc/042-6/ctrl.txt | 56 |
2 files changed, 52 insertions, 50 deletions
diff --git a/npc/042-5/ctrl.txt b/npc/042-5/ctrl.txt index 4e681c7d5..f7538151a 100644 --- a/npc/042-5/ctrl.txt +++ b/npc/042-5/ctrl.txt @@ -235,3 +235,49 @@ function script KamelotBoss { +///////////////////////////////////////////////////////////////////////////// +// KamelotCaveSpawn(Amount, x1, y1, x2, y2, power{, map}) +function script KamelotCaveSpawn { + .@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(getarg(6, .map$)); + //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+1); + setunitdata(.@mob, UDT_STR, 1+.@avg*6/10); + setunitdata(.@mob, UDT_AGI, 1+.@avg*5/10); + setunitdata(.@mob, UDT_VIT, 1+.@avg*5/10); + setunitdata(.@mob, UDT_INT, 1+.@avg*6/10); + setunitdata(.@mob, UDT_DEX, 1+.@avg*6/10); + setunitdata(.@mob, UDT_LUK, 1+.@avg*5/10); + setunitdata(.@mob, UDT_ADELAY, 1372); + setunitdata(.@mob, UDT_ATKRANGE, (.@mobId == CursedArcher ? any(6,7) : any(1,2))); + // Battle Status + setunitdata(.@mob, UDT_MAXHP, .@avg*40); + setunitdata(.@mob, UDT_HP, .@avg*40); + setunitdata(.@mob, UDT_ATKMIN, .@avg*52/10); + setunitdata(.@mob, UDT_ATKMAX, .@avg*72/10); + setunitdata(.@mob, UDT_DEF, 1+.@avg*12/10); + setunitdata(.@mob, UDT_MDEF, 1+.@avg*8/10); + setunitdata(.@mob, UDT_HIT, .@avg*6); // Advised: x3 + setunitdata(.@mob, UDT_FLEE, .@avg*45/10); // Advised: x4 + // Critical calculation + .@min=15; + .@max=max(.@min, min(40, .@avg/3)); + setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max)); + // Loop through + } + freeloop(false); + return; +} + + diff --git a/npc/042-6/ctrl.txt b/npc/042-6/ctrl.txt index 11d9767a8..654a199fb 100644 --- a/npc/042-6/ctrl.txt +++ b/npc/042-6/ctrl.txt @@ -10,7 +10,6 @@ // A simple random treasure chest - to be sure players were introduced to this // awesome system. Same rules as any treasure box still applies. 042-6,65,89,0 script #chest_0426 NPC_CHEST,{ - function monster0426; KamelotTreasure(8); specialeffect(.dir == 0 ? 24 : 25, AREA, getnpcid()); // closed ? opening : closing close; @@ -32,13 +31,13 @@ OnInstanceInit: .@mx=getguildavg(.@g); // Corritors - monster0426(2, 21, 75, 50, 85, .@mx); - monster0426(7, 45, 45, 74, 80, .@mx); - monster0426(5, 52, 21, 90, 60, .@mx); - monster0426(3, 54, 28, 82, 39, .@mx); + KamelotCaveSpawn(2, 21, 75, 50, 85, .@mx, "042-6"); + KamelotCaveSpawn(7, 45, 45, 74, 80, .@mx, "042-6"); + KamelotCaveSpawn(5, 52, 21, 90, 60, .@mx, "042-6"); + KamelotCaveSpawn(3, 54, 28, 82, 39, .@mx, "042-6"); // Boss Chamber - monster0426(5, 59, 71, 82, 91, .@mx); + KamelotCaveSpawn(5, 59, 71, 82, 91, .@mx, "042-6"); KamelotBoss("042-6", 74, 80, .@mx+1, .name$); // Boss monster @@ -92,52 +91,9 @@ OnRespawn: debugmes "[ERROR] [KAMELOT] Unable to respawn for Kamelot %s", .map$; .@g=0; } - monster0426(1, 20, 20, 115, 100, $KAMELOT_MX[.@g]); + KamelotCaveSpawn(1, 20, 20, 115, 100, $KAMELOT_MX[.@g], "042-6"); end; -function monster0426 { - .@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-6"); - //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+1); - setunitdata(.@mob, UDT_STR, 1+.@avg*6/10); - setunitdata(.@mob, UDT_AGI, 1+.@avg*5/10); - setunitdata(.@mob, UDT_VIT, 1+.@avg*5/10); - setunitdata(.@mob, UDT_INT, 1+.@avg*6/10); - setunitdata(.@mob, UDT_DEX, 1+.@avg*6/10); - setunitdata(.@mob, UDT_LUK, 1+.@avg*5/10); - setunitdata(.@mob, UDT_ADELAY, 1372); - setunitdata(.@mob, UDT_ATKRANGE, (.@mobId == CursedArcher ? any(6,7) : any(1,2))); - // Battle Status - setunitdata(.@mob, UDT_MAXHP, .@avg*40); - setunitdata(.@mob, UDT_HP, .@avg*40); - setunitdata(.@mob, UDT_ATKMIN, .@avg*52/10); - setunitdata(.@mob, UDT_ATKMAX, .@avg*72/10); - setunitdata(.@mob, UDT_DEF, 1+.@avg*12/10); - setunitdata(.@mob, UDT_MDEF, 1+.@avg*8/10); - setunitdata(.@mob, UDT_HIT, .@avg*6); // Advised: x3 - setunitdata(.@mob, UDT_FLEE, .@avg*45/10); // Advised: x4 - // Critical calculation - .@min=15; - .@max=max(.@min, min(40, .@avg/3)); - setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max)); - // Loop through - } - freeloop(false); - return; - } - } |