Hi guys, how can I set the spell book that casts spells only equipped ?
then, how can I set meditation in movement?

Thanks!
 
The casting is a good question, i would guess from looking around a little it would be to change the check in spellbook.cs
from.Backpack; to equipped but not positive. Someone will know more and be on soon, but it might be a place to start looking. The meditation.cs seems to handle equipped items for that skill but not on movement but it refrences Server.SkillHandlers and SkillInfo.Table[46].Callback So sorry I wasnt more help but it might be places to investigate untill some one with more knowledge can help you out.
 
Yes the code I guess that should be put here , the problem is what code !

public static Spellbook FindEquippedSpellbook( Mobile from )
{
return (from.FindItemOnLayer( Layer.OneHanded ) as Spellbook);
}
 
Are you trying to make a specific type of spellbook that needs to be equipped to work, or are you trying to make it so that ALL spellbooks must be equipped to work?
 
Are you trying to make a specific type of spellbook that needs to be equipped to work, or are you trying to make it so that ALL spellbooks must be equipped to work?

Hi Lokay I would like to set the mage spellbook to be equipped to work
 
Try this. In Spellbook.cs, modify the EventSink at the bottom of the script like this:

Code:
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;
           
            if (!DesignContext.Check(from))
            {
                return; // They are customizing
            }
           
            Spellbook book = e.Spellbook as Spellbook;
            int spellID = e.SpellID;
           
            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }
           
            if (book != null && book.HasSpell(spellID))
            {
                SpecialMove move = SpellRegistry.GetSpecialMove(spellID);
               
                if (move != null)
                {
                    SpecialMove.SetCurrentMove(from, move);
                }
                // THIS WILL CHECK TO SEE IF THE MAGERY BOOK IS EQUIPPED
                else if (book is MagerySpellbook && !(book == FindEquippedSpellbook(from)))
                {
                    from.SendMessage("That spellbook must be equipped.");
                }
                else
                {
                    Spell spell = SpellRegistry.NewSpell(spellID, from, null);

                    if (spell != null)
                    {
                        spell.Cast();
                    }
                    else if ( !Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery( spellID ) )
                    {
                        from.SendLocalizedMessage( 502345 ); // This spell has been temporarily disabled.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500015); // You do not have that spell!
            }
        }
 
Ok Loki I will try ;) very thanks !
[doublepost=1552488875][/doublepost]I tried I got this error ; certainly because of the different language between servant and runuo maybe!

+ Articles / Skills / Magic / Spellbook.cs:
CS0103: Line 116: The name 'DesignContext' does not exist in the current context.
CS0246: Line 138: Could not find the namespace type "MagerySpellbook". Probably missing a directive using or a reference to an assembly
CS0234: Line 150: The type or name of the namespace 'SkillMasteries' does not exist in the namespace 'Server.Spells'. Probably missing a reference to an assembly.
[doublepost=1552490215][/doublepost]Here my spellbook.cs is needed
 

Attachments

  • Spellbook.cs
    23.5 KB · Views: 2
OK. Minor tweaks. That method should look like this:

Code:
        private static void EventSink_CastSpellRequest( CastSpellRequestEventArgs e )
        {
            Mobile from = e.Mobile;

            if ( !Multis.DesignContext.Check( from ) )
                return; // They are customizing

            Spellbook book = e.Spellbook as Spellbook;
            int spellID = e.SpellID;

            if ( book == null || !book.HasSpell( spellID ) )
                book = Find( from, spellID );

            if ( book != null && book.HasSpell( spellID ) )
            {
                SpecialMove move = SpellRegistry.GetSpecialMove( spellID );

                if ( move != null )
                {
                    SpecialMove.SetCurrentMove( from, move );
                }
                else if (book.SpellbookType = SpellbookType.Regular && !(book = FindEquippedSpellbook(from)))
                {
                    from.SendMessage("That spellbook must be equipped.");
                }
                else
                {
                    Spell spell = SpellRegistry.NewSpell( spellID, from, null );
   
                    if ( spell != null )
                        spell.Cast();
                    else
                        from.SendLocalizedMessage( 502345 ); // This spell has been temporarily disabled.
                }
            }
            else
            {
                from.SendLocalizedMessage( 500015 ); // You do not have that spell!
            }
        }
 
Ok Loki I will try thanks for you help !
[doublepost=1552736791][/doublepost]CS0023: Line 135: Unable to apply operator '!'to the operand of type 'Server.Items.Spellbook'.
this line

else if (book.SpellbookType = SpellbookType.Regular && !(book = FindEquippedSpellbook(from)))

If I remove the "!" same error with && .
 
change it to book == instead of book =

Like this:

Code:
                else if (book.SpellbookType == SpellbookType.Regular && !(book == FindEquippedSpellbook(from)))
                {
 
Back