diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-06-22 21:50:12 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-06-22 21:50:12 -0300 |
commit | fcf490e8a87afc36bffc8f6304b436e782c9074b (patch) | |
tree | cea7e6fe7860b81e064c0d62f81ef75225b0d63b /npc/config | |
parent | f0c58069dbd7721b140ba3f585a4c6e6ad315352 (diff) | |
download | serverdata-fcf490e8a87afc36bffc8f6304b436e782c9074b.tar.gz serverdata-fcf490e8a87afc36bffc8f6304b436e782c9074b.tar.bz2 serverdata-fcf490e8a87afc36bffc8f6304b436e782c9074b.tar.xz serverdata-fcf490e8a87afc36bffc8f6304b436e782c9074b.zip |
New function: IronTrap()
It behaves similar to SteelTrap, but it always stun and deals absolute damage.
Works on both players and monsters.
Diffstat (limited to 'npc/config')
-rw-r--r-- | npc/config/traps.txt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/npc/config/traps.txt b/npc/config/traps.txt index 83e46f7a0..1b43e5cc7 100644 --- a/npc/config/traps.txt +++ b/npc/config/traps.txt @@ -43,3 +43,40 @@ function script SteelTrap { } +// Unlike SteelTrap, presents same behavior and absolute damage +// IronTrap( {damage=100}, {delay=15s}, {stun=3s}, {npcname=auto} ) +function script IronTrap { + .@dmg=getarg(0, 100); + .@delay=getarg(1, 15); + .@stun=getarg(2, 3); + .@n$=getarg(3, strnpcinfo(0)); + + // It was disarmed + if (getnpctimer(0) == 0 && .@delay) + { + initnpctimer; + setnpcdisplay .@n$, NPC_TRAP_ONLINE; + return; + } + + // Fire!! + setnpctimer 9000; + setnpcdisplay .@n$, NPC_TRAP_TRIGGERED; + + // Boom - Hurt and Stun (only works on players and mobs) + .@stun*=1000; + sc_start SC_STUN, rand2(.@stun,.@stun*3), 0; + .@gid=(playerattached() ? playerattached() : mobattached()); + + // Just to be sure + if (.@gid) + harm(.@gid, .@dmg, HARM_MISC); + else + Exception("IronTrap \""+.@n$+"\" called without GID!", RB_DEBUGMES); + + // A minor special effect and we're done. + specialeffect 11; + return; +} + + |