|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
This code only works properly sometimes. It disappears and uses the item when dropped into the backpack of the mobile. It sets the default weapon to this new weapon. But, it when you restart the server the regular Fists are your default weapon again. Fists.cs has:
Code:
public static void Initialize()
{
Mobile.DefaultWeapon = new Fists();
}
Here is my code: Code:
using System;
using Server.Network;
using Server.Items;
namespace Server.Items
{
public class TatooedHands12to14: Fists
{
public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.DoubleStrike; } }
public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.Disarm; } }
public override int AosMinDamage{ get{ return 12; } }
public override int AosMaxDamage{ get{ return 14; } }
public override int AosSpeed{ get{ return 50; } }
public override int OldMinDamage{ get{ return 8; } }
public override int OldMaxDamage{ get{ return 32; } }
public override int OldSpeed{ get{ return 30; } }
public override int InitMinHits{ get{ return 31; } }
public override int InitMaxHits{ get{ return 70; } }
public override int DefHitSound{ get{ return -1; } }
public override int DefMissSound{ get{ return -1; } }
public override SkillName DefSkill{ get{ return SkillName.Wrestling; } }
public override WeaponType DefType{ get{ return WeaponType.Fists; } }
public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.Wrestle; } }
[Constructable]
public TatooedHands12to14() : base()
{
Name = "Tatooed Hands";
Hue = 0x0;
Visible = true;
Movable = true;
Weight = 0.0;
}
public TatooedHands12to14( Serial serial ) : base( serial )
{
}
public override void OnDoubleClick( Mobile from )
{
Mobile.DefaultWeapon = new TatooedHands12to14();
}
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();
}
}
}
|
|
|
|
|
|
|
#2 (permalink) |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
1st. How do you want to see an item with ItemID 0? Give it a visible ItemID, so you can properly access it.
Code:
public override void OnDoubleClick( Mobile from )
{
Mobile.DefaultWeapon = new TatooedHands12to14();
}
What you want is delete this hands you just doubleclicked and add a new property to the PlayerMobile, which you got to save, since the defaultweapon is not saved in the Mobile itself and gets generated after each serverrestart. Well... not the easiest task you got here... maybe you would rather work around it by giving the player a not movable item, which he can activate to replace his DefaultWeapon with the TatooedHands12to14. |
|
|
|
|
|
#3 (permalink) | |
|
Quote:
Code:
namespace Server.Mobiles
{
[Flags]
public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000
{
None = 0x00000000,
Glassblowing = 0x00000001,
Masonry = 0x00000002,
SandMining = 0x00000004,
StoneMining = 0x00000008,
ToggleMiningStone = 0x00000010,
KarmaLocked = 0x00000020,
AutoRenewInsurance = 0x00000040,
UseOwnFilter = 0x00000080,
PublicMyRunUO = 0x00000100,
PagingSquelched = 0x00000200,
Young = 0x00000400,
TatooedHands = 0x00010001
}
|
||
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
I can't help you more here. :/ You will have to code it somehow. But you did a mistake there, since you are not totally familliar with how the flags work.
0x00010000 <<< use that instead of 0x00010001... the last 1 is refering to glassblowing already. ^^ For another pair you could use 0x00020000, then 0x00040000 and so on. Have a closer look at the glassblowing stuff to understand this playerflag. the reason why I can't help you much is, because I do not know when it will Initialize your default weapon... You will have to try things out. maybe by overriding the default weapon, I donno. Sorry. |
|
|
|
|
|
#5 (permalink) | |
|
Quote:
|
||
|
|
|
|
|
#6 (permalink) |
|
OK I added this to PlayerMobile.cs:
Code:
private int m_TattooedHands;
[CommandProperty( AccessLevel.GameMaster )]
public int TattooedHands
{
get{ return m_TattooedHands; }
set{ m_TattooedHands = value; }
}
I changed this in Fists.cs Code:
Mobile.DefaultWeapon = new Fists(); Code:
if ( Mobile.TattooedHands = 0x1 )
{
Mobile.DefaultWeapon = new TattooedHands12to14();
}
else if ( Mobile.TattooedHands = 0x2 )
{
Mobile.DefaultWeapon = new TattooedHands22to30();
}
else if ( Mobile.TattooedHands = 0x3 )
{
Mobile.DefaultWeapon = new TattooedHands32to40();
}
else
{
Mobile.DefaultWeapon = new Fists();
}
Code:
- Error: Scripts\Items\Weapons\Fists.cs: CS0117: (Line 11, column 9) 'Server.Mobile' does not contain a definition for 'TattooedHands' - Error: Scripts\Items\Weapons\Fists.cs: CS0117: (Line 15, column 14) 'Server.Mobile' does not contain a definition for 'TattooedHands' - Error: Scripts\Items\Weapons\Fists.cs: CS0117: (Line 19, column 14) 'Server.Mobile' does not contain a definition for 'TattooedHands' |
|
|
|
|
|
|
#7 (permalink) | ||
|
RunUO Forum Moderator
|
Quote:
Quote:
You need to check if the mobile is playermobile and if so than cast it as playermobile and access this property using the playermobile instead.
__________________
I always try to help
![]() Sometimes, I don't know how.... ![]() My Web Page Forum Rules ------------------------------------------------------------- Extensive OWLTR System | Token System | World Teleporters ------------------------------------------------------------- |
||
|
|
|
|
|
#8 (permalink) | |
|
Quote:
Code:
if ( TattooedHands = 0x1 )
{
Mobile.DefaultWeapon = new TattooedHands12to14();
}
else if ( TattooedHands = 0x2 )
{
Mobile.DefaultWeapon = new TattooedHands22to30();
}
else if ( TattooedHands = 0x3 )
{
Mobile.DefaultWeapon = new TattooedHands32to40();
}
else
{
Mobile.DefaultWeapon = new Fists();
}
|
||
|
|
|
|
|
#9 (permalink) | |
|
Forum Expert
Join Date: Oct 2002
Location: Iowa, USA
Age: 38
Posts: 395
|
Quote:
this: Code:
if ( Mobile.TattooedHands = 0x1 ) Code:
if ( Mobile.DefaultWeapon == 0x1 ) |
|
|
|
|
|
|
#10 (permalink) | |
|
Quote:
|
||
|
|
|
|
|
#11 (permalink) | ||
|
Forum Expert
Join Date: Oct 2002
Location: Iowa, USA
Age: 38
Posts: 395
|
Quote:
what you need to do is this: edit loginstats.cs and add an if else statement. First cast the playermobile Code:
PlayerMobile mob = m as PlayerMobile;
If( mob.Class == ClassType.Monk )
{
If( Mobile.DefaultWeapon is Fists )
{
If( mob.TattooedHands <= 1 )
{
mob.DefaultWeapon = new TattooedHands12to24() ;
}
else if
Quote:
As a general rule of thumb and forum etiquette, don't argue with people offering support. |
||
|
|
|
|
|
#12 (permalink) |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
A couple of typos in that code there Axle. *drools*
But anyways, where should he put that? It won't work in the Initialize, would it? Code:
mob.Class == ClassType.Monk Code:
// Added for fists start
[CommandProperty( AccessLevel.GameMaster )]
public bool HasTatooedHands {
get{ return GetFlag( PlayerFlag.TatooedHands); }
set{ SetFlag( PlayerFlag.TatooedHands, value ); }
}
// Fists end
TatooedHands = 0x00010000 Then you just check for the Fists with if ( playermobileinstance.HasTatooedHands ) { //DoCode } |
|
|
|
|
|
#13 (permalink) | |
|
Forum Expert
Join Date: Oct 2002
Location: Iowa, USA
Age: 38
Posts: 395
|
Quote:
I don't see where a flag is really needed in this case, because fists are initialized by default. Oh yea, and somewhere underneath this: Code:
Mobile m = args.Mobile; |
|
|
|
|
|
|
#15 (permalink) | |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
Quote:
And the idea for a PlayerFlag comes from having multiple fists bools without having to change the PlayerMobile's ser/deser. Just natural not to touch that, hehe. Note: As long, as you don't have more than 4 fists... you should really do it with the playerflag. :P |
|
|
|
|
|
|
#16 (permalink) | |
|
Forum Expert
Join Date: Oct 2002
Location: Iowa, USA
Age: 38
Posts: 395
|
Quote:
If you want the tattoedhands to be specific to a class, or if you want all players to have access to these items. If you want it to be specific to classes, then do this: Code:
PlayerMobile mob = m as PlayerMobile;
If( mob.Class == ClassType.Monk )
{
If( Mobile.DefaultWeapon is Fists )
{
If( mob.TattooedHands <= 1 )
{
mob.DefaultWeapon = new TattooedHands12to24() ;
}
else if
Code:
Mobile.DefaultWeapon = new TattoedHands12to24();
if( Mobile.DefaultWeapon is TattoedHands12to24
{
// statements to check int TattoedHands
}
|
|
|
|
|
|
|
#17 (permalink) | |
|
Quote:
I want it to be a quest item. When you finish the monk quest you get Tattooed Hands and I will be writing a Ki skill to go along with it. I put this in loginstats.cs Code:
if ( TattooedHands = true )
{
Mobile.DefaultWeapon = new TattooedHands12to14();
}
else
{
Mobile.DefaultWeapon = new Fists();
|
||
|
|
|
|
|
#18 (permalink) |
|
I still cannot find where to stick my if statement. Or the statement is not written correctly to be in the Initializer. When I try it in Fists.cs it says it does not know what TattooedHands is but I declared it public in PlayerMobile.cs so it should know about it. Please someone help me out here. I cannot get this to work.
Here is my if statement. Code:
if ( TattooedHands = true )
{
Mobile.DefaultWeapon = new TattooedHands12to14();
}
else
{
Mobile.DefaultWeapon = new Fists();
}
Code:
[Flags]
public enum PlayerFlag // First 16 bits are reserved for default-distro use, start custom flags at 0x00010000
{
None = 0x00000000,
Glassblowing = 0x00000001,
Masonry = 0x00000002,
SandMining = 0x00000004,
StoneMining = 0x00000008,
ToggleMiningStone = 0x00000010,
KarmaLocked = 0x00000020,
AutoRenewInsurance = 0x00000040,
UseOwnFilter = 0x00000080,
PublicMyRunUO = 0x00000100,
PagingSquelched = 0x00000200,
Young = 0x00000400,
TattooedHands = 0x00010000
}
Code:
[CommandProperty( AccessLevel.GameMaster )]
public bool TattooedHands
{
get{ return GetFlag( PlayerFlag.TattooedHands ); }
set{ SetFlag( PlayerFlag.TattooedHands, value ); }
}
How do you copy text out of RunUO? I keep having to type my error messages out. |
|
|
|
|
|
|
#19 (permalink) |
|
Forum Expert
Join Date: Jan 2004
Location: England
Age: 20
Posts: 442
|
You need to use it like:
Code:
if ( pm.TattooedHands = true )
{
Mobile.DefaultWeapon = new TattooedHands12to14();
}
else
{
Mobile.DefaultWeapon = new Fists();
}
|
|
|
|
|
|
#20 (permalink) | |
|
Quote:
|
||
|
|
|
|
|
#21 (permalink) | |
|
Forum Expert
Join Date: Feb 2004
Age: 27
Posts: 1,834
|
Quote:
if ( pm.TattooedHands = true ) will always execute the code and set TattooedHands true... you only write the bool, like if ( pm.TattooedHand ). But I don't see how it should work that way anyways. |
|
|
|
|
|
|
#22 (permalink) | |
|
Quote:
|
||
|
|
|
|
|
#23 (permalink) |
|
Code:
if ( TattooedHands == true)
{
Mobile.DefaultWeapon = new TattooedHands12to14();
}
else
{
Mobile.DefaultWeapon = new Fists();
}
|
|
|
|
|