Full Version : different idea
xmlspawner >>Scripting Support >>different idea
<< Prev | Next >>
ozzy- 01-15-2007
I know this may seem like a stupi idea to most ppl. I am trying to make a wep that when double clicked changes into a diff wep. I did the id change, but was wondering what I would have to add, to make the weps use there abilitys. I would also like them to all be one handed weps, and cicle threw all diff type of weps like a one handed bow that actually shoots arrows. Then double click and have a sword that doesnt use the arrows. Im sure its possible to do this but im not sure how to go about it. I have tryed a few diff ways but have not got it right yet. here is what i have so far, it only goes threw a few weps and only changes there id.

CODE
using System; using Server.Mobiles; using Server; namespace Server.Items {
public class OzzysMysteryWeapon : BaseSword
{
public override int InitMinHits{ get{ return 0; } }
public override int InitMaxHits{ get{ return 0; } }
public override int AosMinDamage{ get{ return 100; } }
public override int AosMaxDamage{ get{ return 150; } }
public override int AosSpeed{ get{ return 48; } }
public override int DefMaxRange{ get{return 3; } }
public override int DefHitSound{ get{ return 0x237; } }
public override int DefMissSound{ get{ return 0x23A; } }
[Constructable]
public OzzysMysteryWeapon() : base( 0x13FF )
{
Weight = 0;
Name = "Ozzy's Mystery Weapon";
Hue = 0;
AccuracyLevel = WeaponAccuracyLevel.Supremely;
DurabilityLevel = WeaponDurabilityLevel.Indestructible;
DamageLevel = WeaponDamageLevel.Vanq;
Quality = WeaponQuality.Exceptional;
Attributes.AttackChance = 100;
Attributes.WeaponDamage = 20;
Attributes.Luck = 200;
Attributes.RegenMana = 50;
Attributes.RegenHits = 50;
Attributes.RegenStam = 50;
Attributes.BonusDex = 20;
Attributes.BonusStr = 45;
Attributes.BonusInt = 20;
Attributes.SpellChanneling = 1;
WeaponAttributes.HitLeechMana = 100;
WeaponAttributes.HitLeechHits = 100;
WeaponAttributes.HitLeechStam = 100;
WeaponAttributes.HitHarm = 100;
WeaponAttributes.HitLowerAttack = 100;
WeaponAttributes.HitLowerDefend = 100;
WeaponAttributes.HitDispel = 100;
WeaponAttributes.HitFireball = 100;
WeaponAttributes.HitLightning = 100;
LootType = LootType.Blessed;
}
public override void GetProperties(ObjectPropertyList list)
{
list.Add(Name);
}
public override bool HandlesOnSpeech
{
get { return Parent is PlayerMobile; }
}
public override void OnSpeech(SpeechEventArgs e)
{
if (e.Speech == "change hue" && e.Mobile == Parent )
{
Hue = Utility.Random(2, 1200);
}
}
public override bool OnEquip( Mobile from )
{
from.Skills[SkillName.Swords].Base += 20.0;
from.Skills[SkillName.Tactics].Base += 20.0;
return base.OnEquip(from);
}
public override void OnRemoved( object parent )
{
if ( parent is Mobile )
{
Mobile m = (Mobile)parent;
m.Skills[SkillName.Swords].Base -= 20.0;
m.Skills[SkillName.Tactics].Base -= 20.0;
}
base.OnRemoved( parent );
}
public override void GetDamageTypes( Mobile weilder, out int phys, out int fire, out int cold, out int pois, out int nrgy )
{
phys = 0;
nrgy = 100;
pois = 100;
fire = 100;
cold = 100;
}
public override void OnDoubleClick( Mobile m )
{
if( Parent != m )
{
m.SendMessage( "You must be holding the weapon to use it!" );
}
else
{
if ( ItemID == 0x13FF )//katana
{
m.SendMessage( "You The Look of The Weapon" );
m.PlaySound( 0x57 );
ItemID = 0x1401;//kryss
}
else if ( ItemID == 0x1401 )//kryss
{
m.SendMessage( "You The Look of The Weapon" );
m.PlaySound( 0x57 );
ItemID = 0x143D;//hammer pick
}
else if ( ItemID == 0x143D )//hammer pick
{
m.SendMessage( "You The Look of The Weapon" );
m.PlaySound( 0x57 );
ItemID = 0x1405;//warfork
}
else if ( ItemID == 0x1405 )//warfork
{
m.SendMessage( "You The Look of The Weapon" );
m.PlaySound( 0x57 );
ItemID = 0x13FB;//large battle axe
}
else if ( ItemID == 0x13FB )//large battle axe
{
m.SendMessage( "You The Look of The Weapon" );
m.PlaySound( 0x57 );
ItemID = 0x13FF;//katana
}
}
}
public OzzysMysteryWeapon( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

Any help with this would be great. I want as many weps as possible just in the one item all one handed if possible.
ArteGordon- 01-16-2007
the only way that you can change a sword into a ranged weapon like a bow is to remove the sword and create a bow to replace it. They are derived from different classes so there is no way to just turn one into the other.
You would need to script each weapon separately, like OzzysMysteryKatana, and put something like this into their OnDoubleClick method

CODE
public override void OnDoubleClick( Mobile m ) { m.SendMessage( "You The Look of The Weapon" ); m.PlaySound( 0x57 ); this.Delete();
m.AddItem(new OzzysMysteryKatana());
}

and you would modify that method for each weapon to change into whatever you wanted.
ozzy- 01-16-2007
I changed the AddItem to EguipItem so it would add the skill gain i have in the on eguip method. That works great, but i realized i cant double click the axe to chop would. I changed it over to the speech comand and come up with an error. Here is that piece of code.

CODE
public override void OnSpeech(SpeechEventArgs e) { if (e.Speech == "change hue" && e.Mobile == Parent ) { Hue = Utility.Random(2, 1200);
}
else if (e.Speech == "change weapon" && e.Mobile == Parent )
{
if ( ItemID == 0x13FF )//katana
{
Mobile m = (Mobile)parent;
m.SendMessage( "You Change Weapons" );
m.PlaySound( 0x57 );
this.Delete();
m.EquipItem(new OzzysMysteryHammerPick());
}
}
}
[CODE]
The error comes in at this part.

Mobile m = (Mobile)parent;
[CODE]
The parent part is there something else i can put there that will make it work?
ArteGordon- 01-16-2007
you used lower case 'parent' when you needed to use 'Parent'
ozzy- 01-16-2007
AAHHH ok stupid me hey atleast im learning lol.