Fear Aura

Got any custom JavaScript additions/tweaks you think other people would like to see? Post 'em here!
Post Reply
Azzerhoden
UOX3 Newbie
Posts: 16
Joined: Wed Oct 05, 2022 3:10 pm
Has thanked: 0
Been thanked: 8 times

Fear Aura

Post by Azzerhoden »

As part of my Necromancy spell line, Necromancers can summon ghosts, and for ghost I have added this 'fear aura' ability. There is only a 25% chance that the aura will go off, and there is a chance for those caught in the aura to resist. This ability is based on the life_drain_aura.js script.
// For creatures that can drain life of target when they are hit in combat.  From the life_drain_aura.js script

var iSpecialAttack = 25;   // This is the % chance the attacker will attempt to drain life
var resistModifyer = 1;    // How effective the players magic resistance is to ward off the attack

function onAttack(pAttacker, pDefender, damageValue, damageType )
{
    var iNum = RandomNumber( 0, 100 );
    if (iNum < iSpecialAttack)  // there is a 25% chance that nearby targets may be impacted by fear
    {
        AreaCharacterFunction( "DealAreaFear", pAttacker, 5 );
        return true;
    }
    else
        return false;
}

function DealAreaFear( pAttacker, pDefender )
{
    if( ValidateObject(pDefender) && pDefender != pAttacker && pDefender.vulnerable && !pDefender.dead
        && (( pDefender.npc && ( pDefender.tamed || pDefender.hireling )) || pDefender.online ))
    {
        var iResistRoll = RandomNumber( 0, 1000 );
        if( iResistRoll > ( pDefender.skills.magicresistance / resistModifyer))
        {  
            var mSpell = Spells[38];
            pDefender.frozen = 1;
            pDefender.SpellStaticEffect( mSpell );
            pDefender.SoundEffect( 0x0204, true );  
            if( pDefender.socket != null )
                pDefender.EmoteMessage("You are paralyzed by fear");
            pDefender.StartTimer(10000, 0, true);
        }
    }
    return false;
}

function onTimer(pDefender, timerID)
{
    var socket = pDefender.socket;
    if(timerID == 0)
    {
        pDefender.frozen = 0;
        if( pDefender.socket != null )
            pDefender.EmoteMessage( "You have regained mobility");
        return true;
    }
}
Attachments
fear_aura.js
(1.52 KiB) Downloaded 257 times
Post Reply