|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Newbie
|
I've been trying to make a deed called Heavenly Creation Deed for my Heavenly Item system, but have encountered a problem...
The deed is supposed to, among other things, change the name of the item from "[name]" to "Heavenly [name]". The problem is many items don't have their names shown the 'normal' way (item.Name == null). My question is: How to check the items' names in such cases? ![]() edited: Oh... and by the way... is there any way to make existing items artifacts?
__________________
|Heavenly Item System|Neo's Level System| If anyone knows, how to put links here, please msg me. Last edited by i_am_neo; 05-04-2008 at 12:04 PM. |
|
|
|
|
|
#2 (permalink) |
|
Forum Master
|
for the name problem
add this section into your code: string name = this.Name; if ( name == null ) name = String.Format( "#{0}", LabelNumber ); that will get the name for you if none has been assigned then you can just add hevenaly, etc to it as for making stuff artifacts that are not in game Nope - can only via script overwrites upon creation not with out a lot of hassle have to modify base weapon & armor in a few spots and when i had done this correctly, it still gave problems down the line what you are better off doing is to just add in a whole new variable into them and set that variable and on the "property display" if true - display "artifact" or "heavenly Modified", etc but they will not be considered artifacts for quick references
__________________
http://www.AoAUO.com
:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :) |
|
|
|
|
|
#3 (permalink) | |
|
Newbie
|
Quote:
Humm... That doesn't seem to work... I put this: Code:
string name = item.Name;
if (name == null) name = String.Format("#{0}", item.LabelNumber);
item.Name = "Heavenly " + name;
Heavenly #1025397 ![]()
__________________
|Heavenly Item System|Neo's Level System| If anyone knows, how to put links here, please msg me. |
|
|
|
|
|
|
#4 (permalink) |
|
Newbie
|
Here's an example of what I got when I used the deed on a katana:
Guess what I'm looking for is a way to change the label number to text (probably some cliloc stuff).
__________________
|Heavenly Item System|Neo's Level System| If anyone knows, how to put links here, please msg me. |
|
|
|
|
|
#5 (permalink) |
|
Forum Master
|
remove the # from in there that i showed and try it
just the # itself, nothing else
__________________
http://www.AoAUO.com
:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :) |
|
|
|
|
|
#6 (permalink) |
|
Newbie
|
Now it shows just the number...
I guess the problem is it doesn't see it as a string, just as a number... All it does is just write the number... I'm not an expert, but it sees to be so... So guess the problem will be for it to see the number as a string (find the string in the cliloc?)... The question wold be... How?
__________________
|Heavenly Item System|Neo's Level System| If anyone knows, how to put links here, please msg me. |
|
|
|
|
|
#7 (permalink) |
|
Forum Master
|
i got this working before - just forget how now - let me try to find it
this is taken straight from basearmor: if ( name == null ) name = String.Format( "#{0}", LabelNumber ); make sure you are using the correct CaPs in there andf the rightr {}(), etc
__________________
http://www.AoAUO.com
:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :) |
|
|
|
|
|
#8 (permalink) | |
|
Newbie
|
Quote:
That would be something similar to what I have... Maybe it makes a difference, that item means BaseClothing here?? Well.. here's a bigger piece of code: Code:
/* Non-meaningful here */
if ( (target is BaseClothing) && !(target is BaseShoes) )
{
BaseClothing item = (BaseClothing)target;
/* Non-meaningful here */
string name = item.Name;
if (name == null) name = String.Format("{0}", item.LabelNumber);
item.Name = "Heavenly " + name;
/* Non-meaningful here */
__________________
|Heavenly Item System|Neo's Level System| If anyone knows, how to put links here, please msg me. |
|
|
|
|
|
|
#9 (permalink) |
|
Forum Master
|
you need the # symbol in there
this is from baseclothing - so putting the item. in front of label would be needed (shown in red and added), but it is how it works there Code:
private string GetNameString()
{
string name = this.Name;
if ( name == null )
name = String.Format( "#{0}", item.LabelNumber );
return name;
}
also what version of runuo are you using?
__________________
http://www.AoAUO.com
:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :) |
|
|
|
|
|
#10 (permalink) | |
|
Newbie
|
Quote:
And I'm running on RC1.
__________________
|Heavenly Item System|Neo's Level System| If anyone knows, how to put links here, please msg me. |
|
|
|
|
|
|
#13 (permalink) |
|
Forum Expert
|
Code:
item.Name = PrependName( item, "Heavenly" )
public string PrependName( Item item, string prepend )
{
if(item.Name==null)
return (prepend +" "+ string.Format( "#{0}", LabelNumber ) );
return ( prepend +" "+ item.Name );
}
__________________
![]() WWW.RPK-UO.COM - The WoW-UO Cross-Over Shard |
|
|
|
|
|
#14 (permalink) |
|
Newbie
|
What the...
Doesn't work either... So nothing seems to work... How about base.GetNameProperties( ... ), or something like that? Could it be used here? Or maybe something else?
__________________
|Heavenly Item System|Neo's Level System| If anyone knows, how to put links here, please msg me. |
|
|
|
|
|
#16 (permalink) |
|
Newbie
|
It changes the item's name to "Heavenly #xxxxx" (where xxxxx is the item's cliloc number).
Here's the script: Code:
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
namespace Server.Items
{
publicclass HeavenlyCreationTarget : Target // Create our targeting class (which we derive from the base target class)
{
private HeavenlyCreationDeed m_Deed;
public HeavenlyCreationTarget(HeavenlyCreationDeed deed)
: base(1, false, TargetFlags.None)
{
m_Deed = deed;
}
publicstring PrependName( Item item, string prepend )
{
if(item.Name==null)
return (prepend +" "+ string.Format( "#{0}", item.LabelNumber ) );
return ( prepend +" "+ item.Name );
}
protectedoverridevoid OnTarget( Mobile from, object target ) // Override the protected OnTarget() for our feature
{
if ( m_Deed.Deleted || m_Deed.RootParent != from )
return;
if ( (target is BaseClothing) && !(target is BaseShoes) )
{
BaseClothing item = (BaseClothing)target;
if (item.RootParent != from)
{
from.SendMessage("The item must be in your pack for you to convert it!");
return;
}
from.SendMessage( "You have successfully transferred heavenly powers to the item!" );
/* Adding Item Properties */
item.Weight = 2;
item.Name = PrependName(item, "Heavenly");
item.Hue = 1159;
item.MaxHitPoints = -1;
item.LootType = LootType.Blessed;
item.Resistances.Cold += 15 - Utility.Random(7);
item.Resistances.Energy += 15 - Utility.Random(7);
item.Resistances.Fire += 15 - Utility.Random(7);
item.Resistances.Physical += 15 - Utility.Random(7);
item.Resistances.Poison += 15 - Utility.Random(7);
item.Attributes.BonusDex = 5;
item.Attributes.BonusInt = 5;
item.Attributes.BonusStr = 5;
item.Attributes.BonusHits = 10;
item.Attributes.BonusMana = 10;
item.Attributes.BonusStam = 10;
item.Attributes.WeaponSpeed = 5;
item.Attributes.WeaponDamage = 5;
item.Attributes.SpellDamage = 5;
item.Attributes.LowerManaCost = 5;
item.Attributes.CastRecovery = 2;
item.Attributes.CastSpeed = 2;
item.Attributes.RegenHits = 4;
item.Attributes.RegenMana = 4;
item.Attributes.RegenStam = 4;
item.Attributes.AttackChance = 5;
item.Attributes.DefendChance = 5 + Utility.Random(5);
item.Attributes.NightSight = 1;
item.Attributes.ReflectPhysical = 5 + Utility.Random(5);
item.Attributes.Luck = 300;
/* Adding Item Properties */
m_Deed.Delete(); // Delete the deed
}
elseif (target is BaseShoes)
{
BaseShoes item = (BaseShoes)target;
if (item.RootParent != from)
{
from.SendMessage("The item must be in your pack for you to convert it!");
return;
}
from.SendMessage("You have successfully transferred heavenly powers to the item!");
/* Adding Item Properties */
item.Weight = 2;
item.Name = PrependName( item, "Heavenly" );
item.Hue = 1159;
item.MaxHitPoints = -1;
item.LootType = LootType.Blessed;
item.Resistances.Cold += 15 - Utility.Random(10);
item.Resistances.Energy += 15 - Utility.Random(10);
item.Resistances.Fire += 15 - Utility.Random(10);
item.Resistances.Physical += 15 - Utility.Random(5);
item.Resistances.Poison += 15 - Utility.Random(10);
item.Attributes.BonusDex = 5;
item.Attributes.BonusInt = 5;
item.Attributes.BonusStr = 5;
item.Attributes.BonusHits = 10;
item.Attributes.BonusMana = 10;
item.Attributes.BonusStam = 10 + Utility.Random(30);
item.Attributes.WeaponSpeed = 5;
item.Attributes.WeaponDamage = 5;
item.Attributes.SpellDamage = 5;
item.Attributes.LowerManaCost = 5;
item.Attributes.CastRecovery = 2;
item.Attributes.CastSpeed = 2;
item.Attributes.RegenHits = 4;
item.Attributes.RegenMana = 4;
item.Attributes.RegenStam = 4 + Utility.Random(6);
item.Attributes.AttackChance = 5;
item.Attributes.DefendChance = 5;
item.Attributes.NightSight = 1;
item.Attributes.ReflectPhysical = 5;
item.Attributes.Luck = 300;
/* Adding Item Properties */
m_Deed.Delete(); // Delete the deed
}
elseif (target is BaseArmor)
{
BaseArmor item = (BaseArmor)target;
if (item.RootParent != from)
{
from.SendMessage("The item must be in your pack for you to convert it!");
return;
}
from.SendMessage("You have successfully transferred heavenly powers to the item!");
/* Adding Item Properties */
item.Weight = 2;
item.Name = PrependName(item, "Heavenly");
item.Hue = 1159;
item.MaxHitPoints = -1;
item.LootType = LootType.Blessed;
item.ColdBonus += 25 - Utility.Random(10);
item.EnergyBonus += 25 - Utility.Random(10);
item.FireBonus += 25 - Utility.Random(10);
item.PhysicalBonus += 25 - Utility.Random(10);
item.PoisonBonus += 25 - Utility.Random(10);
item.Attributes.BonusDex = 10;
item.Attributes.BonusInt = 10;
item.Attributes.BonusStr = 10;
item.Attributes.BonusHits = 15;
item.Attributes.BonusMana = 15;
item.Attributes.BonusStam = 15;
item.Attributes.WeaponSpeed = 5;
item.Attributes.WeaponDamage = 5;
item.Attributes.SpellDamage = 5;
item.Attributes.LowerManaCost = 5;
item.Attributes.CastRecovery = 2;
item.Attributes.CastSpeed = 2;
item.Attributes.RegenHits = 5;
item.Attributes.RegenMana = 5;
item.Attributes.RegenStam = 10;
item.Attributes.AttackChance = 5;
item.Attributes.DefendChance = 5;
item.Attributes.NightSight = 1;
item.Attributes.ReflectPhysical = 5 + Utility.Random(20);
item.ArmorAttributes.MageArmor = 1;
item.Attributes.Luck = 300;
/* Adding Item Properties */
m_Deed.Delete(); // Delete the deed
}
elseif (target is BaseJewel)
{
BaseJewel item = (BaseJewel)target;
if (item.RootParent != from)
{
from.SendMessage("The item must be in your pack for you to convert it!");
return;
}
from.SendMessage("You have successfully transferred heavenly powers to the item!");
/* Adding Item Properties */
item.Weight = 2;
item.Name = PrependName(item, "Heavenly");
item.Hue = 1159;
item.LootType = LootType.Blessed;
item.Resistances.Cold = 4 + (4 - Utility.Random(8));
item.Resistances.Energy = 4 + (4 - Utility.Random(8));
item.Resistances.Fire = 4 + (4 - Utility.Random(8));
item.Resistances.Physical = 4 + (4 - Utility.Random(8));
item.Resistances.Poison = 4 + (4 - Utility.Random(8));
item.Attributes.BonusDex = 8 + Utility.Random(5);
item.Attributes.BonusInt = 8 + Utility.Random(5);
item.Attributes.BonusStr = 8 + Utility.Random(5);
item.Attributes.BonusHits = 15;
item.Attributes.BonusMana = 15;
item.Attributes.BonusStam = 15;
item.Attributes.WeaponSpeed = 5;
item.Attributes.WeaponDamage = 15;
item.Attributes.SpellDamage = 15;
item.Attributes.LowerManaCost = 10;
item.Attributes.CastRecovery = 3 + Utility.Random(5);
item.Attributes.CastSpeed = 3 + Utility.Random(5);
item.Attributes.RegenHits = 5;
item.Attributes.RegenMana = 5;
item.Attributes.RegenStam = 5;
item.Attributes.AttackChance = 5;
item.Attributes.DefendChance = 5;
item.Attributes.Luck = 400;
/* Adding Item Properties */
m_Deed.Delete(); // Delete the deed
}
elseif (target is BaseWeapon)
{
BaseWeapon item = (BaseWeapon)target;
if (item.RootParent != from)
{
from.SendMessage("The item must be in your pack for you to convert it!");
return;
}
from.SendMessage("You have successfully transferred heavenly powers to the item!");
/* Adding Item Properties */
item.Weight = 2;
item.Name = PrependName(item, "Heavenly");
item.Hue = 1159;
item.MaxHitPoints = -1;
item.LootType = LootType.Blessed;
item.MaxDamage = item.MinDamage = 20 + Utility.Random(15);
item.WeaponAttributes.HitLeechHits = 40 + (5 - Utility.Random(10));
item.WeaponAttributes.HitLeechMana = 40 + (5 - Utility.Random(10));
item.WeaponAttributes.HitLeechStam = 40 + (5 - Utility.Random(10));
item.Attributes.AttackChance = 15;
item.Attributes.DefendChance = 15;
item.Attributes.BonusDex = 8;
item.Attributes.BonusInt = 8;
item.Attributes.BonusStr = 8;
item.Attributes.BonusHits = 15;
item.Attributes.BonusMana = 15;
item.Attributes.BonusStam = 15;
item.Attributes.CastRecovery = 3;
item.Attributes.CastSpeed = 3;
item.Attributes.LowerManaCost = 5;
item.Attributes.RegenHits = 5;
item.Attributes.RegenMana = 5;
item.Attributes.RegenStam = 5;
item.Attributes.SpellChanneling = 1;
item.Attributes.WeaponSpeed = 20;
item.Attributes.Luck = 350;
/* Adding Item Properties */
m_Deed.Delete(); // Delete the deed
}
// BaseWeapon
else
{
from.SendMessage( "You cannot convert that!" );
}
}
}
publicclass HeavenlyCreationDeed : Item // Create the item class which is derived from the base item class
{
publicoverridestring DefaultName
{
get { return"a heavenly creation deed"; }
}
[Constructable]
public HeavenlyCreationDeed() : base( 0x14F0 )
{
Weight = 1.0;
Hue = 1159;
LootType = LootType.Blessed;
}
public HeavenlyCreationDeed(Serial serial)
: base(serial)
{
}
publicoverridevoid Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
publicoverridevoid Deserialize( GenericReader reader )
{
base.Deserialize( reader );
LootType = LootType.Blessed;
int version = reader.ReadInt();
}
publicoverridebool DisplayLootType{ get{ returnfalse; } }
publicoverridevoid OnDoubleClick( Mobile from ) // Override double click of the deed to call our target
{
if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else
{
from.SendMessage( "What would you like to enchant with heavenly powers?" ); // What would you like to bless? (Clothes Only)
from.Target = new HeavenlyCreationTarget(this); // Call our target
}
}
}
}
__________________
|Heavenly Item System|Neo's Level System| If anyone knows, how to put links here, please msg me. |
|
|
|
|
|
#17 (permalink) |
|
Forum Master
|
this may be a deal with it being 1.0 instead of 2.0
look in baseclothing, like i did for how they gat the name that way and use the same procedure apparently 1.0 does not convert the cliloc numbers over the same way
__________________
http://www.AoAUO.com
:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :) |
|
|
|
|
|
#18 (permalink) |
|
Newbie
|
So then my RunUO lies: Code:
RunUO - [www.runuo.com] Version 2.0, Build 2357.32527 ![]() I'm pretty sure it's 2.0 RC1 ![]() And It's a funny thing... I've also got the same thing in BaseClothing.cs... Here's the BaseClothing.cs thing: Code:
privatestring GetNameString()
{
string name = this.Name;
if ( name == null )
name = String.Format( "#{0}", LabelNumber );
return name;
}
Code:
if ( oreType != 0 )
list.Add( 1053099, "#{0}\t{1}", oreType, GetNameString() ); // ~1_oretype~ ~2_armortype~
elseif ( Name == null )
list.Add( LabelNumber );
else
list.Add( Name );
And what I have is: Code:
// (...)
publicstring PrependName( Item item, string prepend )
{
if(item.Name==null)
return (prepend +" "+ string.Format( "#{0}", item.LabelNumber ) );
return ( prepend +" "+ item.Name );
}
protectedoverridevoid OnTarget( Mobile from, object target ) // Override the protected OnTarget() for our feature
{
if ( m_Deed.Deleted || m_Deed.RootParent != from )
return;
if ( (target is BaseClothing) && !(target |