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 08-07-2008, 03:49 PM   #1 (permalink)
Newbie
 
CheeseUO's Avatar
 
Join Date: Jul 2008
Age: 16
Posts: 14
Default Item Rename Deed.

Uhm, I had an Item Rename Deed scripted, and Somehow I lost it..

I've tried to make another one, and epic failed.

Anyone got one? or can help me make one?..
__________________
CheeseUO is offline   Reply With Quote
Old 08-07-2008, 04:53 PM   #2 (permalink)
Forum Expert
 
Asmir3's Avatar
 
Join Date: Sep 2005
Location: A-Town Baby
Age: 19
Posts: 620
Default

I found one for you [2.0 RC1] Name Change Deed that works but next time just use the search forum and it will find it for you not to be mean or anything.
__________________

Now open - uo15.net - The best in Publish 15 emulation
Asmir3 is offline   Reply With Quote
Old 08-07-2008, 07:38 PM   #3 (permalink)
Newbie
 
CheeseUO's Avatar
 
Join Date: Jul 2008
Age: 16
Posts: 14
Default Keyword: ITEM

dude. ive already seen that, believe me. ive searched everything like 23984723 times. ......... i want
an

ITEM rename.. not just a rename for a player mobile... like
changing:

a doublet to
a sexy doublet?

that a player can do.
__________________
CheeseUO is offline   Reply With Quote
Old 08-07-2008, 08:10 PM   #4 (permalink)
Newbie
 
CheeseUO's Avatar
 
Join Date: Jul 2008
Age: 16
Posts: 14
Default basics.

Basically i need a deed that destroys after one use, and basically does
the command [set name "
for a player, in a deed.
__________________
CheeseUO is offline   Reply With Quote
Old 08-07-2008, 08:15 PM   #5 (permalink)
Forum Novice
 
Join Date: Dec 2005
Posts: 608
Default

jesus christ your ad campaign is even bigger than the american president campaigns.

Anyway if it doesn't exist you will have to write it. If you need help on it you can post the errors and your script and we will try to help you.

Asmir gave you a good hint on where to start. But noone will make it for you if that is what you were looking for.
b0b01 is offline   Reply With Quote
Old 08-07-2008, 08:17 PM   #6 (permalink)
Newbie
 
CheeseUO's Avatar
 
Join Date: Jul 2008
Age: 16
Posts: 14
Default

I've tried to make one. And failed. do you want to see my failure?
__________________
CheeseUO is offline   Reply With Quote
Old 08-07-2008, 08:34 PM   #7 (permalink)
Forum Novice
 
Join Date: Apr 2006
Posts: 188
Default

Quote:
Originally Posted by CheeseUO View Post
I've tried to make one. And failed. do you want to see my failure?
That's the idea. Show what you have tried.
__________________
http://www.crypticrealms.com
homergz is offline   Reply With Quote
Old 08-07-2008, 08:39 PM   #8 (permalink)
Newbie
 
CheeseUO's Avatar
 
Join Date: Jul 2008
Age: 16
Posts: 14
Default my lame faiilure

Code:
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Mobiles;
using Server.Misc;

namespace Server.Items
{
	public class ItemRenameDeed : Item
	{
		public override string DefaultName
		{
			get { return "a item rename deed"; }
		}

		[Constructable]
		public ItemRenameDeed() : base( 0x14F0 )
		{
			base.Weight = 1.0;
			base.Name = Item Rename Deed
		}

		public ItemRenameDeed( 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 ( !IsChildOf( from.Backpack ) ) 
      { 
        from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. 
      } 
      else 
      { 
        from.SendMessage( "Enter your desired name." ); 
        from.Prompt = new RenamePrompt( from, this );  
      } 
    } 

    private class RenamePrompt : Prompt 
    { 
      private Item m_from;
      private Item m_deed; 

      public RenamePrompt( Item from, Item deed ) 
      { 
        m_from = from;
        m_deed = deed;
      } 

      public override void OnResponse( Mobile from, string text ) 
      { 
        BaseArmor pm = (BaseArmor) from; 
        text = text.Trim();
        
        if ( !NameVerification.Validate( text, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote ) ) 
        {
          pm.SendMessage ( "Unacceptable name." );
          return;
        }
        else
        {
          pm.Name = text;                                
          pm.SendMessage( "You have named it to {0}!", text ); 
          m_deed.Delete();
        }
      }
      
      public override void OnCancel( Mobile from ) 
      { 
        BaseItem pm = (BaseArmor) from; 
        
        pm.SendMessage ( "Item Rename Change cancelled." );
        return;
      } 
    } 
	}
}
__________________
CheeseUO is offline   Reply With Quote
Old 08-07-2008, 09:19 PM   #9 (permalink)
Forum Novice
 
Tassyon T's Avatar
 
Join Date: Sep 2007
Posts: 367
Default

Quote:
Originally Posted by CheeseUO View Post
Code:
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Mobiles;
using Server.Misc;

namespace Server.Items
{
	public class ItemRenameDeed : Item
	{
		public override string DefaultName
		{
			get { return "a item rename deed"; }
		}

		[Constructable]
		public ItemRenameDeed() : base( 0x14F0 )
		{
			base.Weight = 1.0;
			base.Name = Item Rename Deed
		}

		public ItemRenameDeed( 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 ( !IsChildOf( from.Backpack ) ) 
      { 
        from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. 
      } 
      else 
      { 
        from.SendMessage( "Enter your desired name." ); 
        from.Prompt = new RenamePrompt( from, this );  
      } 
    } 

    private class RenamePrompt : Prompt 
    { 
      private Item m_from;
      private Item m_deed; 

      public RenamePrompt( Item from, Item deed ) 
      { 
        m_from = from;
        m_deed = deed;
      } 

      public override void OnResponse( Mobile from, string text ) 
      { 
        BaseArmor pm = (BaseArmor) from; 
        text = text.Trim();
        
        if ( !NameVerification.Validate( text, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote ) ) 
        {
          pm.SendMessage ( "Unacceptable name." );
          return;
        }
        else
        {
          pm.Name = text;                                
          pm.SendMessage( "You have named it to {0}!", text ); 
          m_deed.Delete();
        }
      }
      
      public override void OnCancel( Mobile from ) 
      { 
        BaseItem pm = (BaseArmor) from; 
        
        pm.SendMessage ( "Item Rename Change cancelled." );
        return;
      } 
    } 
	}
}
The line I highlighted in RED is where your problem begins.

The problem here is that your OnResponse method should send a message to the player asking "What item do you want to rename?"
Then you need to bring up an internal target (and you will need a separate method for this). Store the response as a string in your OnResponse method, and pass it on as an argument to your target.

Then, you need to add an OnTarget method that will do things to whatever target you select. In the OnTarget method you'll rename the item, not before.

Look at fireball.cs as an example of how to create an InternalTarget method, how to call up an InternalTarget, how to create an OnTarget method, how to call up an OnTarget, and what kind of code can go inside an OnTarget method.

You'll have to add

Code:
Using Server.Targeting
(or whatever it is) at the top of your script too.

Last edited by Tassyon T; 08-07-2008 at 09:24 PM.
Tassyon T is offline   Reply With Quote
Old 10-17-2008, 12:16 AM   #10 (permalink)
Forum Novice
 
FingersMcSteal's Avatar
 
Join Date: Mar 2006
Location: North East, England, UK
Posts: 865
Send a message via ICQ to FingersMcSteal Send a message via MSN to FingersMcSteal
Arrow

This is from a set of 5 i release, it's a LMC +%5 Deed... but can be changed easy to do a name change if needed...

Code:
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
using Server.Mobiles;
namespace Server.Items
{
publicclass LMCTarget : Target
{
private LMCDeed m_Deed;
private Mobile m_from;
public LMCTarget(LMCDeed deed) : base(1, false, TargetFlags.None)
{
m_Deed = deed;
}
protectedoverridevoid OnTarget(Mobile from, object target)
{
if (m_Deed.Deleted)
return;
if (target is BaseWeapon)
{
BaseWeapon weapon = (BaseWeapon)target;
int LMCadjust = weapon.Attributes.LowerManaCost;
if (LMCadjust >= 100)
{
from.SendMessage(0x35, "The weapons already at 100% !!!");
}
else
{
LMCadjust = LMCadjust + 5;
if (LMCadjust > 100)
{
LMCadjust = 100;
weapon.Attributes.LowerManaCost = LMCadjust;
from.SendMessage(0x35, "The weapon gets maxed out, 100% LMC obtained.");
m_Deed.Delete();
}
else
{
weapon.Attributes.LowerManaCost = LMCadjust;
from.SendMessage(0x35, "The weapon recieves an additional 5% LMC.");
m_Deed.Delete();
}
}
}
else
{
from.SendMessage( 0x35, "This deed only works on weapons.");
}
}
}
publicclass LMCDeed : Item // Create the item class which is derived from the base item class
{
[Constructable]
public LMCDeed() : base( 0x14F0 )
{
Weight = 1.0;
Name = "LMC +5% Deed";
LootType = LootType.Blessed;
Hue = 1278;
}
public LMCDeed(Serial serial) : base(serial)
{
}
publicoverridevoid Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
publicoverridevoid Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
publicoverridebool DisplayLootType{ get{ returnfalse; } }
publicoverridevoid OnDoubleClick( Mobile from )
{
if (!IsChildOf(from.Backpack))
{
from.SendMessage(0x35, "The Deed Must Be In Your Bag To Use It");
}
else
{
from.SendMessage(0x35, "Which weapon do you want to upgrade with LMC ?");
from.Target = new LMCTarget(this);
}
} 
}
}
Just needs to be altered after
protectedoverridevoid OnTarget(Mobile from, object target)
{

That's it.
__________________
We can be found on joinUO.com or listUO.com, come try us out.
FingersMcSteal 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