The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wall spell (local.duration) problem
Author Message
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #2
RE: wall spell local.duration problem
Satvet, sup?

I've noticed this too, but i've change the core code to act as i wanted...

IN "CCharact.cpp" i've chenged the setPoison to:

Code:
bool CChar::SetPoison( int iSkill, int iTicks, CChar * pCharSrc )
{
    ADDTOCALLSTACK("CChar::SetPoison");

    const CSpellDef *pSpellDef = g_Cfg.GetSpellDef(SPELL_Poison);
    if ( !pSpellDef )
        return false;

    // Release if paralyzed ?
    if ( !pSpellDef->IsSpellType(SPELLFLAG_NOUNPARALYZE) )
    {
        CItem *pParalyze = LayerFind(LAYER_SPELL_Paralyze);
        if ( pParalyze )
            pParalyze->Delete();
    }

    CItem *pPoison = Spell_Effect_Create(SPELL_Poison, LAYER_FLAG_Poison, iSkill, 1 + Calc_GetRandVal(2) * TICK_PER_SEC, pCharSrc, false);
    if ( !pPoison )
        return false;
    LayerAdd(pPoison, LAYER_FLAG_Poison);
    
    pPoison->m_itSpell.m_spellcharges = iTicks;        // effect duration
    pPoison->SetTimeout(30);  // FIX DG

    if ( m_pClient && IsSetOF(OF_Buffs) )
    {
        m_pClient->removeBuff(BI_POISON);
        m_pClient->addBuff(BI_POISON, 1017383, 1070722, static_cast<WORD>(pPoison->m_itSpell.m_spellcharges));
    }

    SysMessageDefault(DEFMSG_JUST_BEEN_POISONED);
    StatFlag_Set(STATF_Poisoned);
    UpdateStatsFlag();
    return true;
}

Take a look at the method definition, at this part "1 + Calc_GetRandVal(2) * TICK_PER_SEC" it's the spell duration!
Sphere always treat the poison duration minimum: 10 segs to maximum: 30 segs", you can change this for any duration you want...

And in "CCharSpell.cpp" to:
Code:
case SPELL_Poison:
        {
            // Both potions and poison spells use this.
            // m_itSpell.m_spelllevel = strength of the poison ! 0-1000

            if ( iCharges <= 0 )
                return false;

            int iDmg = 0;

            // The poison in your body is having an effect.
            if ( iLevel < 50 )
                return false;
            if ( iLevel < 200 )    // Lesser
                iLevel = 0;
            else if ( iLevel < 400 ) // Normal
                iLevel = 1;
            else if ( iLevel < 800 ) // Greater
                iLevel = 2;
            else    // Deadly.
                iLevel = 3;

            pItem->m_itSpell.m_spelllevel -= 50;    // gets weaker too.    Only on old formulas
            iDmg = IMULDIV(Stat_GetMax(STAT_STR), iLevel * 2, 100);
            pItem->SetTimeout(30); // FIX DG

            static LPCTSTR const sm_Poison_Message[] =
            {
                g_Cfg.GetDefaultMsg(DEFMSG_SPELL_POISON_1),
                g_Cfg.GetDefaultMsg(DEFMSG_SPELL_POISON_2),
                g_Cfg.GetDefaultMsg(DEFMSG_SPELL_POISON_3),
                g_Cfg.GetDefaultMsg(DEFMSG_SPELL_POISON_4)
            };

            TCHAR *pszMsg = Str_GetTemp();
            sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_SPELL_LOOKS), sm_Poison_Message[iLevel]);
            Emote(pszMsg, m_pClient);
            SysMessagef(g_Cfg.GetDefaultMsg(DEFMSG_SPELL_YOUFEEL), sm_Poison_Message[iLevel]);

            static const int sm_iPoisonMax[] = { 2, 4, 6, 8, 10 };
            OnTakeDamage(maximum(sm_iPoisonMax[iLevel], iDmg), pItem->m_uidLink.CharFind(), DAMAGE_MAGIC|DAMAGE_POISON|DAMAGE_NODISTURB|DAMAGE_NOREVEAL, 0, 0, 0, 100, 0);

            if ( IsSetOF(OF_Buffs) && m_pClient )
            {
                m_pClient->removeBuff(BI_POISON);
                m_pClient->addBuff(BI_POISON, 1017383, 1070722, static_cast<WORD>(pItem->GetTimerAdjusted()));
            }
            break;
        }


Another thing to look at: "SetTimeout(30);" (both files) in my shard, poisin deals damage every 3 seconds, you also can change this to any delay you want...


I basically ignored all script proccess and fixed the spell as i wanted directly in the core...


You can do something like in any spells you want... i also removed the OSI_MAGICFORMULA from the code cuz i don't use it.


Hope it helps again Smile

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
(This post was last modified: 04-18-2017 04:17 AM by escribano.)
04-18-2017 04:14 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
RE: wall spell local.duration problem - escribano - 04-18-2017 04:14 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)