Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 02-05-2004, 08:41 PM   #1 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default a newbie mistake I'm thinking, but who knows

ok I worked hard on this going through script after script putting this together, and I expected dumb little errors like a missing ; or a misplaced { but I got something different

This is a staff that when doubleclicked will open a gump that allows players to choose the power they wish to use. It uses charges which will be found as loot (the charges worked just fine)

I am using the RKTimer as posted in the Submissions by Tashanna. It says it cannot be found but I know its there, I am obviously doing it wrong, maybe bad syntax.

Same with the actual staff, it cant find the gump... again maybe the syntax

I'll be posting the error and the 2 problem scripts

Error

- Error: Scripts\Pandora-Custom\Items\Pandora\weapons\Artifacts\StaffofMagi us.c
s: CS0246: (line 69, column 24) The type or namespace name 'StaffofMagiusGump' c
ould not be found (are you missing a using directive or an assembly reference?)
- Error: Scripts\Pandora-Custom\Items\Pandora\weapons\Artifacts\StaffofMagi usGu
mp.cs: CS0246: (line 323, column 10) The type or namespace name 'RKTimer' could
not be found (are you missing a using directive or an assembly reference?)

StaffofMagius.cs
[code:1]
using System;
using Server.Network;
using Server.Items;

// maybe I'm missing one of these above?

namespace Server.Items
{
[FlipableAttribute( 0x13F8, 0x13F9 )]
public class StaffofMagius : BaseStaff
{
public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.ConcussionBlow; } }
public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.ParalyzingBlow; } }

public override int AosStrengthReq{ get{ return 10; } }
public override int AosMinDamage{ get{ return 10; } }
public override int AosMaxDamage{ get{ return 15; } }
public override int AosSpeed{ get{ return 50; } }

public override int ArtifactRarity{ get{ return 1337; } }

public override int OldStrengthReq{ get{ return 20; } }
public override int OldMinDamage{ get{ return 10; } }
public override int OldMaxDamage{ get{ return 30; } }
public override int OldSpeed{ get{ return 33; } }

public override int InitMinHits{ get{ return 1; } }
public override int InitMaxHits{ get{ return 5; } }

[Constructable]
public StaffofMagius() : base( 0x13F8 )
{
Weight = 1.0;
Name = "the Staff of Magius";
Hue = 1153;
Attributes.SpellChanneling = 1;
Attributes.BonusInt= 20;
Attributes.DefendChance= 35;
Attributes.EnhancePotions= 75;
Attributes.RegenMana= 10;
Attributes.LowerManaCost= 25;
Attributes.LowerRegCost= 25;
Attributes.SpellDamage= 50;
Attributes.Luck= 250;
}
public StaffofMagius( 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();
}
public override void OnDoubleClick( Mobile from )
{
if ( Parent != from )
{
from.SendMessage( 22, "You must equip the staff to use its powers" );
}
else
{
from.SendGump( new StaffofMagiusGump( from ) );
}
}
}
}
[/code:1]

StaffofMagiusGump.cs
[code:1]
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Items;
using Server.Mobiles;

namespace Server.Gumps
{
public class StaffofMagiusGump : Gump
{
public static void Initialize()
{
Commands.Register( "StaffofMagiusGump", AccessLevel.GameMaster, new CommandEventHandler( StaffofMagiusGump_OnCommand ) );
}

private static void StaffofMagiusGump_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new StaffofMagiusGump( e.Mobile ) );
}

public StaffofMagiusGump( Mobile owner ) : base( 50,50 )
{

AddPage( 0 );
AddBackground( 0, 0, 500, 320, 2600 );

AddButton( 395, 275, 0xFB1, 0xFB3, 27, GumpButtonType.Reply, 0 );
AddLabel( 425, 275, 0x34, "Close" );

AddPage( 1 );

AddHtml( 20, 20, 460, 27," Spell Options for the Staff of Magius - Charges needed to use.", true, false );

AddButton( 35, 63, 0x2623, 0x2622, 1, GumpButtonType.Reply, 0 );
AddLabel( 55, 60, 0x34, "GoodBerry (Hunger and Thirst Maxed) - 5 Charges" );

AddButton( 35, 93, 0x2623, 0x2622, 2, GumpButtonType.Reply, 0 );
AddLabel( 55, 90, 0x34, "Infravision - 10 Charges" );

AddButton( 35, 123, 0x2623, 0x2622, 3, GumpButtonType.Reply, 0 );
AddLabel( 55, 120, 0x34, "Full Mana - 20 Charges" );

AddButton( 35, 153, 0x2623, 0x2622, 4, GumpButtonType.Reply, 0 );
AddLabel( 55, 150, 0x34, "Full Heal - 30 Charges" );

AddButton( 35, 183, 0x2623, 0x2622, 5, GumpButtonType.Reply, 0 );
AddLabel( 55, 180, 0x34, "Sticks to Snakes (Summon Snakes)- 50 Charges" );

AddButton( 35, 213, 0x2623, 0x2622, 6, GumpButtonType.Reply, 0 );
AddLabel( 55, 210, 0x34, "Monster Summoning I (Orcs) - 75 Charges" );

AddButton( 35, 243, 0x2623, 0x2622, 7, GumpButtonType.Reply, 0 );
AddLabel( 55, 240, 0x34, "Monster Summoning II (Dragons) - 100 Charges" );

AddButton( 35, 273, 0x2623, 0x2622, 8, GumpButtonType.Reply, 0 );
AddLabel( 55, 270, 0x34, "Globe of Invulnerability (15 minutes) - 500 Charges" );

}
BaseCreature v;
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;

switch ( info.ButtonID )
{
case 0: //Case uses the ActionIDs defenied above. Case 0 defenies the actions for the button with the action id 0
{
//Cancel
from.SendMessage( 22, "You decide not to use the power of the staff." );
break;
}
case 1:
{
if ( from.Hunger <= 19 )
{
Item[] Charge = from.Backpack.FindItemsByType( typeof( Charge ) );
if ( from.Backpack.ConsumeTotal( typeof( Charge ), 5 ) )
{
from.Hunger = 20;
from.Thirst = 20;
from.SendMessage( 22, "You create a good berry and after eating it you are stuffed and are no longer thirsty." );
}
else
{
from.SendMessage( 22, "You need 5 Charges in your pack to work this spell." );
}
}
else
{
from.SendMessage( 22, "You don't need any food yet" );
}
break;
}
case 2:
{
Item[] Charge = from.Backpack.FindItemsByType( typeof( Charge ) );
if ( from.Backpack.ConsumeTotal( typeof( Charge ), 10 ) )
{
from.LightLevel = 25;
from.SendMessage( 22, "The power of Magius lights your path." );
}
else
{
from.SendMessage( 22, "You need 10 Charges in your pack to work this spell." );
}
break;
}
case 3:
{
if ( from.Mana < from.ManaMax )
{
Item[] Charge = from.Backpack.FindItemsByType( typeof( Charge ) );
if ( from.Backpack.ConsumeTotal( typeof( Charge ), 20 ) )
{
from.Mana = from.ManaMax;
from.SendMessage( 22, "You have been completely refreshed by the power of Magius." );
}
else
{
from.SendMessage( 22, "You need 20 Charges in your pack to work this spell." );
}
}
else
{
from.SendMessage( 22, "You don't need mana" );
}
break;
}
case 4:
{
if ( from.Hits < from.HitsMax )
{
Item[] Charge = from.Backpack.FindItemsByType( typeof( Charge ) );
if ( from.Backpack.ConsumeTotal( typeof( Charge ), 30 ) )
{
from.Hits = from.HitsMax;
from.SendMessage( 22, "You have been completely healed by the power of Magius." );
}
else
{
from.SendMessage( 22, "You need 30 Charges in your pack to work this spell." );
}
}
else
{
from.SendMessage( 22, "You don't need healing" );
}
break;
}
case 5:
{
Item[] Charge = from.Backpack.FindItemsByType( typeof( Charge ) );
if ( from.Backpack.ConsumeTotal( typeof( Charge ), 50 ) )
{
switch ( Utility.Random( 3 ))
{
case 0:
v = new Snake();
v = new SilverSerpent();
v = new Snake();
break;
case 1:
v = new Snake();
v = new Snake();
v = new Snake();
v = new Snake();
v = new Snake();
break;
case 2:
v = new IceSnake();
v = new LavaSnake();
v = new GiantSerpent();
break;
}
v.Location = from.Location;
v.Map = from.Map;
from.SendMessage( "You turn some twigs into snakes." );
}
else
{
from.SendMessage( 22, "You need 50 Charges in your pack to work this spell." );
}
break;
}
case 6:
{
Item[] Charge = from.Backpack.FindItemsByType( typeof( Charge ) );
if ( from.Backpack.ConsumeTotal( typeof( Charge ), 75 ) )
{
switch ( Utility.Random( 10 ))
{
case 0: v = new OrcishMage(); break;
case 1: v = new OrcCaptain(); break;
case 2: v = new OrcBrute(); break;
case 3: v = new OrcBomber(); break;
case 4: v = new OrcCaptain(); break;
case 5: v = new OrcishLord(); break;
case 6: v = new Orc(); break;
case 7: v = new Orc(); break;
case 8: v = new Orc(); break;
case 9: v = new Orc(); break;
}
switch ( Utility.Random( 10 ))
{
case 0: v = new OrcishMage(); break;
case 1: v = new OrcCaptain(); break;
case 2: v = new OrcBrute(); break;
case 3: v = new OrcBomber(); break;
case 4: v = new OrcCaptain(); break;
case 5: v = new OrcishLord(); break;
case 6: v = new Orc(); break;
case 7: v = new Orc(); break;
case 8: v = new Orc(); break;
case 9: v = new Orc(); break;
}
switch ( Utility.Random( 9 ))
{
case 0: v = new OrcishMage(); break;
case 1: v = new OrcCaptain(); break;
case 2: v = new OrcBrute(); break;
case 3: v = new OrcBomber(); break;
case 4: v = new OrcCaptain(); break;
case 5: v = new OrcishLord(); break;
case 6: v = new Orc(); break;
case 7: v = new Orc(); break;
case 8: v = new Orc(); break;
}
switch ( Utility.Random( 8 ))
{
case 0: v = new OrcishMage(); break;
case 1: v = new OrcCaptain(); break;
case 2: v = new OrcBrute(); break;
case 3: v = new OrcBomber(); break;
case 4: v = new OrcCaptain(); break;
case 5: v = new OrcishLord(); break;
case 6: v = new Orc(); break;
case 7: v = new Orc(); break;
}
switch ( Utility.Random( 6 ))
{
case 0: v = new OrcishMage(); break;
case 1: v = new OrcCaptain(); break;
case 2: v = new OrcBrute(); break;
case 3: v = new OrcBomber(); break;
case 4: v = new OrcCaptain(); break;
case 5: v = new OrcishLord(); break;
}
v.Location = from.Location;
v.Map = from.Map;
from.SendMessage( "You summon some Orcs." );
}
else
{
from.SendMessage( 22, "You need 75 Charges in your pack to work this spell." );
}
break;
}
case 7:
{
Item[] Charge = from.Backpack.FindItemsByType( typeof( Charge ) );
if ( from.Backpack.ConsumeTotal( typeof( Charge ), 100 ) )
{
switch ( Utility.Random( 12 ))
{
case 0: v = new GreatWhiteWyrm(); break;
case 1: v = new RainbowWyrm(); break;
case 2: v = new DragonLord(); break;
case 3: v = new AncientWyrm(); break;
case 4: v = new SkeletalDragon(); break;
case 5: v = new SkeletalDragon(); break;
case 6: v = new WhiteWyrm(); break;
case 7: v = new ShadowWyrm(); break;
case 8: v = new PsudoDragon(); break;
case 9: v = new Wyvern(); break;
case 10: v = new Drake(); break;
case 11: v = new Dragon(); break;
}
switch ( Utility.Random( 9 ))
{
case 0: v = new AncientWyrm(); break;
case 1: v = new SkeletalDragon(); break;
case 2: v = new SkeletalDragon(); break;
case 3: v = new WhiteWyrm(); break;
case 4: v = new ShadowWyrm(); break;
case 5: v = new PsudoDragon(); break;
case 6: v = new Wyvern(); break;
case 7: v = new Drake(); break;
case 8: v = new Dragon(); break;
}
switch ( Utility.Random( 7 ))
{
case 0: v = new SkeletalDragon(); break;
case 1: v = new WhiteWyrm(); break;
case 2: v = new ShadowWyrm(); break;
case 3: v = new PsudoDragon(); break;
case 4: v = new Wyvern(); break;
case 5: v = new Drake(); break;
case 6: v = new Dragon(); break;
}
switch ( Utility.Random( 4 ))
{
case 0: v = new PsudoDragon(); break;
case 1: v = new Wyvern(); break;
case 2: v = new Drake(); break;
case 3: v = new Dragon(); break;
}
v.Location = from.Location;
v.Map = from.Map;
from.SendMessage( "You summon some Dragons." );
}
else
{
from.SendMessage( 22, "You need 100 Charges in your pack to work this spell." );
}
break;
}
case 8:
{
Item[] Charge = from.Backpack.FindItemsByType( typeof( Charge ) );
if ( from.Backpack.ConsumeTotal( typeof( Charge ), 500 ) )
{
new RKTimer( this, 900.0).Start();
from.SendMessage( "You are blessed by the power of Magius for the next 15 minutes" );
}
else
{
from.SendMessage( 22, "You need 500 Charges in your pack to work this spell." );
}
break;
}
}
}
}
}
[/code:1]
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 02-05-2004, 10:14 PM   #2 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

Quote:
Originally Posted by KillerBeez
- Error: Scripts\Pandora-Custom\Items\Pandora\weapons\Artifacts\StaffofMagi us.c
s: CS0246: (line 69, column 24) The type or namespace name 'StaffofMagiusGump' c
ould not be found (are you missing a using directive or an assembly reference?)
add the [code:1]using Server.Gumps;[/code:1] to the StaffofMaguis.cs file
XxSP1DERxX is offline   Reply With Quote
Old 02-05-2004, 10:15 PM   #3 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

[code:1]new RKTimer( this, 900.0).Start(); [/code:1]

You never defined the actual RKTimer with its own class, ctor, and ontick methods.
XxSP1DERxX is offline   Reply With Quote
Old 02-06-2004, 04:23 AM   #4 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default

Quote:
Originally Posted by XxSP1DERxX
[code:1]new RKTimer( this, 900.0).Start(); [/code:1]

You never defined the actual RKTimer with its own class, ctor, and ontick methods.
I'm not sure what you mean. I use the RKTimer.cs already to bless people on ressurect and it works fine, this is the RKTimer.cs file and the actual post is here
http://www.runuo.com/forum/viewtopic.php?t=24715&highlight=rktimer

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

namespace Server.Misc
{
// RKTimer: Anti-RezKill Timer, makes the player invulnerable for [t] seconds from start time.
// scripted by Tashanna
// --------------------------
// When using this script, add the following lines to playermobile.cs in the OnLogin function (around line 244)
// // Check for login of Blessed player and make unblessed
// if( ( pm.Blessed == true) && ( pm.AccessLevel == AccessLevel.Player))
// pm.Blessed = false;

public class RKTimer : Timer
{
private Mobile m_Mobile;

public RKTimer( Mobile m, double t) : base( TimeSpan.FromSeconds( t ))
{
m_Mobile = m;
m.Blessed = true;
m.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Head );
m.PlaySound( 0x1EA );
m.SendMessage( "You are granted temporary immunity!");

}

protected override void OnTick()
{
Mobile m = m_Mobile as Mobile;
m_Mobile.Blessed = false;
m.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Head );
m.PlaySound( 0x1EA );
m.SendMessage( "Your temporary immunity has ended.");

Stop();
}
}
}
[/code:1]

As for the Staff gump thing, thank you, I knew it was some stupid mistake.
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 02-06-2004, 04:44 AM   #5 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

Add [code:1]using Server.Misc;[/code:1]

to the file using RKTimer
XxSP1DERxX is offline   Reply With Quote
Old 02-06-2004, 04:50 AM   #6 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default

Quote:
Originally Posted by XxSP1DERxX
Add [code:1]using Server.Misc;[/code:1]

to the file using RKTimer
oh lol, yup just as I thought a stupid mistake. Thank you I'll try that now
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 02-06-2004, 05:15 AM   #7 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default

ok I got it working and it all works with one problem, monster summoning 1 or 2 and sticks to snakes only spawn 1 monster, did I miss something else?
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 02-06-2004, 05:20 AM   #8 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

[code:1]case 0:
v = new Snake();
v = new SilverSerpent();
v = new Snake();
break;[/code:1]

v will always be a normal snake.. you see it is being overwritten 2 times. Those other mobiles are probably lost in your internal map too

You need to switch case between those as well. (like you did with the others).
XxSP1DERxX is offline   Reply With Quote
Old 02-06-2004, 05:25 AM   #9 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default

Quote:
Originally Posted by XxSP1DERxX
[code:1]case 0:
v = new Snake();
v = new SilverSerpent();
v = new Snake();
break;[/code:1]

v will always be a normal snake.. you see it is being overwritten 2 times. Those other mobiles are probably lost in your internal map too

You need to switch case between those as well. (like you did with the others).
the others do the same thing as the snakes, only 1 spawns there too
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 02-06-2004, 05:31 AM   #10 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

okay bleh, yes i am tired.

The problem is, the way you are doing it, mobiles are getting put into the internal map permanently. Go and check it out, I bet you already put alot of them there.

You should do a switch case for the type, then use the activator create instance method to create the mobile.
XxSP1DERxX is offline   Reply With Quote
Old 02-06-2004, 05:33 AM   #11 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default

Quote:
Originally Posted by XxSP1DERxX
okay bleh, yes i am tired.

The problem is, the way you are doing it, mobiles are getting put into the internal map permanently. Go and check it out, I bet you already put alot of them there.

You should do a switch case for the type, then use the activator create instance method to create the mobile.
where would I check the internal map?

I understand that it is spawning multiple monsters in the internal map, but I dont understand what you are saying...
You should do a switch case for the type, then use the activator create instance method to create the mobile

what is "activator create instance method" I've never heard of it
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 02-06-2004, 07:37 AM   #12 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default

although I would like to know the answer to those 2 questions, I have desiced to just spawn 1 monster therefore it works, thank you.
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 02-07-2004, 06:18 AM   #13 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

[code:1]BaseCreature mob = Activator.CreateInstance( typeof(Orc) ) as BaseCreature;[/code:1]

where [code:1]typeof(Orc)[/code:1] is a random type of monster.


that is all I said.

And use the internal map cleanup script and type [internalmobiles to see the damage you caused
XxSP1DERxX is offline   Reply With Quote
Old 02-07-2004, 02:25 PM   #14 (permalink)
God of Pandora
 
KillerBeeZ's Avatar
 
Join Date: Jun 2003
Location: Gainesville GA
Age: 31
Posts: 2,000
Default

Quote:
Originally Posted by XxSP1DERxX
[code:1]BaseCreature mob = Activator.CreateInstance( typeof(Orc) ) as BaseCreature;[/code:1]

where [code:1]typeof(Orc)[/code:1] is a random type of monster.


that is all I said.

And use the internal map cleanup script and type [internalmobiles to see the damage you caused
says
[internalmobiles
is not a valid command

I dont think I did much damage anyway, I spawned a few snakes and a few dragons, but used [global delete where snake / dragon and got rid of most if not all of them.
__________________
The Den of KillerBeeZ...Kender's Komments, uncensored commentary from the Kender. Plus anything else the Kender might have in his pouches.
KillerBeeZ is offline   Reply With Quote
Old 02-07-2004, 03:11 PM   #15 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

okay, well use the method I gave you and you will have the same power with less recoil.
XxSP1DERxX is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5