RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Spells!

wstsdwgr

Wanderer
Spells!

Ok I'm making my first set of new spells and I came across the number code that defines what spell a scroll uses. For example, the fireball scroll is:
[Constructable]
public FireballScroll( int amount ) : base( 17, 0xF0E, amount )

The 17 means cast the spell fireball..I made a spell called "freeze" and did not see where in the spell script to program hat number would define this new spell. Anybody know how I can assign a number to new spells?
 

wstsdwgr

Wanderer
Actually.. I do have a question :)

Before I thought I could haggle through the code and figure it out, but I guess not. So, reading through some tutorials I came across a basic item called a "firesword". It is supposed to use a flame effect every 10 seconds, but the tutorial's code gives me errors.

It says to use this:
public static DateTime LastEffectTime = DateTime.Now;

But when I use that I get an error compiling:
- Error: Scripts\Items\zNewstuff\IceSword.cs: CS0246: (line 6, column 21) The type or namespace name 'DateTime' could not be found

Any idea as to why this line of code doesn't work?

One more thing! What does int rendermode mean? And what is the hue for ice blue (glacial staff)?

Thanks in advance
 

Jalister

Sorceror
Mind posting a link to the tutorial? I'm having problems of my own with spell scripting also. Thanks.

Jalister
 

wstsdwgr

Wanderer
Sorry I meant to say it's a tutorial that explains the code used to script spells.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemTimeSpanClassctorTopic.asp
 

JLN

Wanderer
i you hadnt figured it yet, the 17 refers to the \\scrtipts\spells\initializer.cs the line:
Register( 17, typeof( Third.FireballSpell ) );

youll want to add something to the effect of:
Register( 401, typeof( ninth.FreezeSpell ) );
 

wstsdwgr

Wanderer
Ok, cool. I would also have to add a ninth circle to the spell book, right? And is that all I have to do to make it work is adjust the initializer file, script the spell, and script the scroll?
 

wstsdwgr

Wanderer
Ok here's the error I got for this:

- Error: Scripts\Spells\Undine\Freeze.cs: CS0117: (line 11, column 5) 'Server.S
pells.SpellCircle' does not contain a definition for 'Ninth'

I'm guessing this is because I need to define a ninth circle somewhere. Where do I do this?
 

Jalister

Sorceror
I'm trying to do something similar with spells also. I'm trying to make a cleric line of spells with their own book. I'm using the same book as the main spellbook. To save space, I only inserted parts of the script. I can post the entire scripts if needed.

holybook.cs

[code:1]using System;
using Server.Network;
using Server.Spells;

namespace Server.Items
{
public class Holybook : Spellbook
{
public override SpellbookType SpellbookType{ get{ return SpellbookType.Cleric; } }
public override int BookOffset{ get{ return 300; } }
public override int BookCount{ get{ return 22; } }

public override Item Dupe( int amount )
{
Spellbook book = new Holybook();

book.Content = this.Content;

return base.Dupe( book, amount );
}

[Constructable]
public Holybook() : this( (ulong)0 )
{
}

[Constructable]
public Holybook( ulong content ) : base( content, 0xEFA )
{
}

public Holybook( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
}
}
}[/code:1]

Changes to spellbook.cs

[code:1] public enum SpellbookType
{
Invalid = -1,
Regular,
Necromancer,
Paladin,
Cleric // ***ADDED***
}[/code:1]
[code:1] switch ( e.Type )
{
default:
case 1: type = SpellbookType.Regular; break;
case 2: type = SpellbookType.Necromancer; break;
case 3: type = SpellbookType.Paladin; break;
case 4: type = SpellbookType.Cleric; break; // ***ADDED***
}
[/code:1]
[code:1] public static SpellbookType GetTypeForSpell( int spellID )
{
if ( spellID >= 0 && spellID < 64 )
return SpellbookType.Regular;
else if ( spellID >= 100 && spellID < 116 )
return SpellbookType.Necromancer;
else if ( spellID >= 200 && spellID < 210 )
return SpellbookType.Paladin;
else if ( spellID >= 300 && spellID < 322 ) // ***ADDED***
return SpellbookType.Cleric; // ***ADDED***

return SpellbookType.Invalid;
}
[/code:1]
[code:1] public static Spellbook FindCleric( Mobile from ) // ***ADDED***
{ // ***ADDED***
return Find( from, -1, SpellbookType.Cleric ); // ***ADDED***
} // ***ADDED***
[/code:1]

Changes to healscroll.cs

[code:1] [Constructable]
public HealScroll( int amount ) : base( 300, 0x1F31, amount ) // *** originally base( 3,
{
}
[/code:1]

Changes to initializer.cs
[code:1] // Cleric spells
Register( 300, typeof( First.HealSpell ) );
[/code:1]

No errors during startup.
I can create the holybook, even though it stills labels as spellbook.
I can create the new healscroll.
I can put the healscroll in the holybook, and NOT the spellbook, as I wanted.

The problem is the spell lists as "Bad Spell" in the spell book.
Also, when I try to cast the spell from the book, or from the scroll I get this message - "This spell has been temporarily disabled"

Jalister
 

Jalister

Sorceror
wstsdwgr - I hope you don't mind me posting my script ideas here. I figure we could both learn from what we are trying to accomplish.

Jalister
 

wstsdwgr

Wanderer
Ahh thank you. I worked with the code and got it to be error-free, but I get the same spell disabled message. Also to change the name of the book from spellbook to holybook couldn't you just change the area in holybook.cs:
[Constructable]
public Holybook() : this( (ulong)0 )
{
}

To:

[Constructable]
public Holybook() : this( (ulong)0 )
{
Name = "a Holybook";
}

I'm new at this, but that's what I just did for my scrolls to change the names.

And I appreciate the help and ideas :D
 

wstsdwgr

Wanderer
Ok, I'll start trying to figure out how to fix this badspell thing..have you tried going to the back of the spellbook to check what regs your spell uses? I think we need to add gumps for our spells (or at least I do). It looks pretty funky :) . If you have instant messenger or icq, that'd make it alot easier to talk.
 

Jalister

Sorceror
When I try to turn to the page the spell is on, my client crashes. And I believe you are right, I shouldn't need gumps since I am using existing spells. I'll see about getting ICQ up, its been awhile.

Jalister
 
Top