diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-04-29 11:23:14 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-04-29 11:23:14 -0300 |
commit | cbbf95462972c3a8274f3fef6a3f3a258e41a5e7 (patch) | |
tree | ee89afa3727f66b68c8f8ea75e05578c3b3b50b7 /npc/functions/siege.txt | |
parent | 6fc1e2fc43d1dc217df402d2a196dd06b3512f39 (diff) | |
download | serverdata-cbbf95462972c3a8274f3fef6a3f3a258e41a5e7.tar.gz serverdata-cbbf95462972c3a8274f3fef6a3f3a258e41a5e7.tar.bz2 serverdata-cbbf95462972c3a8274f3fef6a3f3a258e41a5e7.tar.xz serverdata-cbbf95462972c3a8274f3fef6a3f3a258e41a5e7.zip |
I'm done simplyfing Siege script on Hurnscald! =D
Diffstat (limited to 'npc/functions/siege.txt')
-rw-r--r-- | npc/functions/siege.txt | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt index 261492ac2..1a0d92dbe 100644 --- a/npc/functions/siege.txt +++ b/npc/functions/siege.txt @@ -25,6 +25,12 @@ function script siege_calcdiff { .@bsum=0; .@highest=getarg(1, false); .@c = getunits(BL_PC, .@players, false, getarg(0)); + + // Fallback: No players on map, always return 0 + if (.@c == 0) + return 0; + + // There is at least one player, do things properly for (.@i = 0; .@i < .@c; .@i++) { .@b=readparam(BaseLevel, .@players[.@i]); .@bsum+=.@b; @@ -62,7 +68,7 @@ function script siege_push { // siege_selectmob ( blvl, difficulty{, tp_mask} ) function script siege_selectmob { .@blv=getarg(0); - .@dif=getarg(1); + .@dif=getarg(1, 0); .@tp=getarg(2, 0); // We don't need .@dif, so we convert difficulty to levels @@ -124,11 +130,10 @@ function script siege_selectmob { return; } - +///////////////////////////////////////////////////////////// // Prepare a siege with optional announce // siege_setup ( map{, announce} ) function script siege_setup { - debugmes "Cast"; .@m$=getarg(0); .@msg$=getarg(1, ""); @@ -136,8 +141,52 @@ function script siege_setup { changemusic .@m$, any("mythica.ogg", "eric_matyas_ghouls.ogg", "misuse.ogg", "Arabesque.ogg"); disablenpc("Mana Stone"); pvpon(.@m$); + setmapflag(.@m$,mf_bexp,rand(140,160)); // 40~60% EXP UP on siege maps if (.@msg$ != "") kamibroadcast(col(.@msg$,1)); return; } +// Revert what siege_setup did +// siege_revert ( map ) +function script siege_revert { + .@m$=getarg(0); + + removemapmask .@m$, MASK_MATTACK; + changemusic .@m$, "caketown.ogg"; // :> + enablenpc("Mana Stone"); + pvpoff(.@m$); + removemapflag(.@m$,mf_bexp); + killmonsterall(.@m$); + return; +} + +// Spawn some monsters +// siege_cast ( map, NPCName, {, difficulty{, tpflag}} ) +function script siege_cast { + // mz - map ; n - name ; d - difficulty ; tp - teleport + // a - ammount ; e - mobId + .@mz$=getarg(0); + .@n$=getarg(1); + .@d=getarg(2,0); + .@tp=getarg(3,0); + + siege_selectmob(siege_calcdiff(.@mz$), .@d, .@tp); + + // How many monsters? + .@a=(.@d/3)+1; + + .@e=any_of($@SIEGE_TMPMOBS); + array_remove($@SIEGE_TMPMOBS, .@e); + siege_spawn(.@mz$, .@e, .@a, .@n$+"::OnRespawn"); + + .@e=any_of($@SIEGE_TMPMOBS); + array_remove($@SIEGE_TMPMOBS, .@e); + siege_spawn(.@mz$, .@e, .@a, .@n$+"::OnRespawn"); + + .@e=any_of($@SIEGE_TMPMOBS); + array_remove($@SIEGE_TMPMOBS, .@e); + siege_spawn(.@mz$, .@e, .@a, .@n$+"::OnRespawn"); + return; +} + |