How to separate cancelation of cast From spells and scrolls?

Serj

Member
Jun 13, 2018
7
0
32
I want that some spells would cast only by using SpellScrolls
I know how to cancel a cast of a spell But the problem is that in
C#:
public WaterElementalSpell(Mobile caster, Item scroll):base(caster, scroll, m_info)
"Mobile caster" and "Item scroll" are in the same script
 

Serj

Member
Jun 13, 2018
7
0
32
no Its not works and I think you didn't understand me Let's try another way
How to prevent from dragging-adding some SpellScrolls to a magic book?
 

PyrO

Well-Known Member
Jan 27, 2015
1,074
75
Well thats by far not what you asked though.

Anyway
Spellbook.cs - OnDragDrop
AddToSpellbookEntry - OnTarget OR
SpellScroll.cs - GetContextMenuEntries

You can also edit both files if you want to
 

Serj

Member
Jun 13, 2018
7
0
32
C#:
public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll && !(dropped is SpellStone))
            {
                SpellScroll scroll = (SpellScroll)dropped;

                SpellbookType type = GetTypeForSpell(scroll.SpellID);

                if (type != SpellbookType || scroll.SpellID==8044 )
                {
                    return false;
                }
OK
How to get-match scroll ID? cause
C#:
if (type != SpellbookType || scroll.SpellID==8044 )
doesn't work
 

zerodowned

Moderator
ServUO Developer
Jun 28, 2014
1,754
206
Scripts\Spells\Initializer.cs

after Register is the # for each spell

// First circle
Register(00, typeof(First.ClumsySpell));
Register(01, typeof(First.CreateFoodSpell));
Register(02, typeof(First.FeeblemindSpell));
Register(03, typeof(First.HealSpell));
Register(04, typeof(First.MagicArrowSpell));
Register(05, typeof(First.NightSightSpell));
Register(06, typeof(First.ReactiveArmorSpell));
Register(07, typeof(First.WeakenSpell));
 
  • Wow
Reactions: Serj

Serj

Member
Jun 13, 2018
7
0
32
Thanks It works like this
C#:
if (dropped is SpellScroll && !(dropped is SpellStone))
            {
                SpellScroll scroll = (SpellScroll)dropped;

                SpellbookType type = GetTypeForSpell(scroll.SpellID);
                
                int Intgr=scroll.SpellID;//edited

                if (type != SpellbookType || Intgr == 63  )//editwed
                {
                    return false;
                }