|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#26 (permalink) |
|
Forum Novice
Join Date: Dec 2006
Posts: 480
|
Yes, I added a PlayerMobile property called Umbarian, and declared it as an integer, like this:
Code:
#region Custom Umbarian Edit
private int m_Umbarian;
[CommandProperty( AccessLevel.GameMaster )]
public int Umbarian
{
get { return m_Umbarian; }
set{ m_Umbarian = value; InvalidateProperties(); }
}
#endregion
Code:
if ( Umbarian == 1 ) If you are willing to give me some ideas on how you think it would be best, and some tips on how to do it without messing up the ser / deser that would be super. PS: on a sidenote, how can I stop players from being able to drop their guild robe to the floor, forcing it to always either be in their backpack, or on their paperdoll only. This would also have to prevent them from putting it in their bank, and in bags in house. Thanks and Regards
__________________
legendsofkaine.page.tl
Last edited by typhoonbot; 08-08-2008 at 12:57 PM. Reason: Spelling error |
|
|
|
|
|
#27 (permalink) |
|
Forum Expert
|
That is what is terrific about doing it with the dictionary in the stone itself, you don’t need to alter playermobile at all! All you have to do is add a method like this to the guild stone class:
Code:
public bool IsThiefGuildMember( Mobile from )
{
return m_UmbarianRooster.ContainsKey( from );
}
Code:
if( StoneClassName.IsThiefGuildMember( from ) )
{
// What is allowed if they are a member
}
As for moving things to the world, I am pretty sure it is possible, I know there is a method somewhere that is triggered when an item is dropped onto the ground, but I wouldn’t recommend going through all the trouble. You would have to add checks for trading between players, moving it to the world, dropping it into contains (bank boxes, secure boxes, trash cans, etc) ondeath movements, etc. Personally it just seems like way too much effort to keep someone from dropping a cloak. The way we have the code written now it doesn’t matter what they do with it, the guild system always knows where it is at and can remove it. The only thing I would suggest is making the robe only be wearable by the person it was originally assigned to. To do this just script the custom robe, and give it a Mobile m_Owner; value. When you add the robe set the person its being given to as the owner on creation: Code:
UmbraRobe robe = new UmbraRobe(); Robe.Owner = from; From.AddToPack( robe ); ![]()
__________________
Father Time Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "Holy Hell......What a ride!!!" Server: UO: Extinction ICQ: 146563794 FatherTime@UOExtinction.com UO: Extinction homepage UO: Extinction forum |
|
|
|
|
|
#28 (permalink) |
|
Forum Novice
Join Date: Dec 2006
Posts: 480
|
I think I can safely rule out the fact that I will ever be upgrading my version of RunUO. I have made countless modifications to Distros I cant even remember all the places. as well as my entire world being perfectly decorated and spawned just the way I want it. It would simply be WAY to much effort to locate every single MOD I have ever done, and redo it in a new version. Perhaps I should have kept a log of the changes I made.
Any, thanks for the help above, I will put it to practice now. Then it's on to designing the gump, and getting that to work ![]() regards
__________________
legendsofkaine.page.tl
|
|
|
|
|
|
#29 (permalink) |
|
Forum Expert
|
My pleasure. That's what I do, rather then keeping a log I just relocate any distro file I modify to a folder in my custom scripts folder called "Modified distros". It has the same file tree structure as the non modified to make finding scripts I have modified easier.
I hear you about the converting. I went through that when I went from 1.0 to 2.0, lesson learned. ![]()
__________________
Father Time Life's journey is not to arrive at the grave safely in a well preserved body, but rather to skid in sideways, totally worn out, shouting "Holy Hell......What a ride!!!" Server: UO: Extinction ICQ: 146563794 FatherTime@UOExtinction.com UO: Extinction homepage UO: Extinction forum |
|
|
|
|
|
#30 (permalink) |
|
Forum Novice
Join Date: Dec 2006
Posts: 480
|
Okay, quick question before I go ahead with making the changes above. if I just remove all instances of the Umbarian property in the Playermobile.cs (including the ser/ deser) will it give an error asking to delete all playermobiles like I have experienced before ?
__________________
legendsofkaine.page.tl
|
|
|
|
|
|
#32 (permalink) |
|
Forum Novice
Join Date: Dec 2006
Posts: 480
|
Because, playing around on a server that has been running for a while sometimes doesnt end so well
![]() What I will do is: make a test server, and practice a bit on that...Thanks for the tip ![]()
__________________
legendsofkaine.page.tl
|
|
|
|
|
|
#33 (permalink) |
|
Forum Novice
Join Date: Dec 2006
Posts: 480
|
Ok, I have removed the umbarian property, and added in those changes vermillion
![]() next problem: some errors I am getting that I cant seem to manage to deal with. Errors: + Mobiles/PlayerMobile.cs: CS0120: Line 3786: An object reference is required for the nonstatic field, method, or property 'Server.Items.UmbarianStone.IsThiefGuildMember(Ser ver.Mobile )' + Skills/Stealing.cs: CS0120: Line 58: An object reference is required for the nonstatic field, me thod, or property 'Server.Items.UmbarianStone.IsThiefGuildMember(Ser ver.Mobile)' Here is that line in the PlayerMobile.cs: Code:
if( UmbarianStone.IsThiefGuildMember( this ) ) Code:
if( !UmbarianStone.IsThiefGuildMember( from ) )
__________________
legendsofkaine.page.tl
|
|
|
|
|
|
#35 (permalink) |
|
Forum Novice
Join Date: Dec 2006
Posts: 480
|
Here is the whole TryStealItem Method:
Code:
private Item TryStealItem( Item toSteal, ref bool caught )
{
Mobile from = m_Thief;
Item stolen = null;
object root = toSteal.RootParent;
StealableArtifactsSpawner.StealableInstance si = null;
if ( toSteal.Parent == null || !toSteal.Movable )
si = StealableArtifactsSpawner.GetStealableInstance( toSteal );
if( !UmbarianStone.IsThiefGuildMember( from ) )
{
m_Thief.SendMessage(37, "You must be in the Umbarian Shadows thief guild to steal.");
m_Thief.Hidden = false;
m_Thief.Criminal = true;
}
else if ( !IsEmptyHanded( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1005584 ); // Both hands must be free to steal.
}
else if ( !m_Thief.CanSee( toSteal ) )
{
m_Thief.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold( m_Thief, toSteal, false, true ) )
{
m_Thief.SendLocalizedMessage( 1048147 ); // Your backpack can't hold anything else.
}
#region Sigils
else if ( toSteal is Sigil )
{
PlayerState pl = PlayerState.Find( m_Thief );
Faction faction = ( pl == null ? null : pl.Faction );
Sigil sig = (Sigil) toSteal;
if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) )
{
m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it.
}
else if ( root != null ) // not on the ground
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else if ( faction != null )
{
if ( !m_Thief.CanBeginAction( typeof( IncognitoSpell ) ) )
{
m_Thief.SendLocalizedMessage( 1010581 ); // You cannot steal the sigil when you are incognito
}
else if ( DisguiseGump.IsDisguised( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1010583 ); // You cannot steal the sigil while disguised
}
else if ( !m_Thief.CanBeginAction( typeof( PolymorphSpell ) ) )
{
m_Thief.SendLocalizedMessage( 1010582 ); // You cannot steal the sigil while polymorphed
}
else if ( TransformationSpell.UnderTransformation( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1061622 ); // You cannot steal the sigil while in that form.
}
else if ( Spells.Ninjitsu.AnimalForm.UnderTransformation( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1063222 ); // You cannot steal the sigil while mimicking an animal.
}
else if ( pl.IsLeaving )
{
m_Thief.SendLocalizedMessage( 1005589 ); // You are currently quitting a faction and cannot steal the town sigil
}
else if ( sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction )
{
m_Thief.SendLocalizedMessage( 1005590 ); // You cannot steal your own sigil
}
else if ( sig.IsPurifying )
{
m_Thief.SendLocalizedMessage( 1005592 ); // You cannot steal this sigil until it has been purified
}
else if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, 80.0, 80.0 ) )
{
if ( Sigil.ExistsOn( m_Thief ) )
{
m_Thief.SendLocalizedMessage( 1010258 ); // The sigil has gone back to its home location because you already have a sigil.
}
else if ( m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold( m_Thief, sig, false, true ) )
{
m_Thief.SendLocalizedMessage( 1010259 ); // The sigil has gone home because your backpack is full
}
else
{
if ( sig.IsBeingCorrupted )
sig.GraceStart = DateTime.Now; // begin grace period
m_Thief.SendLocalizedMessage( 1010586 ); // YOU STOLE THE SIGIL!!! (woah, calm down now)
if ( sig.LastMonolith != null )
sig.LastMonolith.Sigil = null;
sig.LastStolen = DateTime.Now;
return sig;
}
}
else
{
m_Thief.SendLocalizedMessage( 1005594 ); // You do not have enough skill to steal the sigil
}
}
else
{
m_Thief.SendLocalizedMessage( 1005588 ); // You must join a faction to do that
}
}
#endregion
else if ( si == null && ( toSteal.Parent == null || !toSteal.Movable ) )
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else if ( toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed( root ) )
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else if ( Core.AOS && si == null && toSteal is Container )
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else if ( !m_Thief.InRange( toSteal.GetWorldLocation(), 1 ) )
{
m_Thief.SendLocalizedMessage( 502703 ); // You must be standing next to an item to steal it.
}
else if ( si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0 )
{
m_Thief.SendLocalizedMessage( 1060025, "", 0x66D ); // You're not skilled enough to attempt the theft of this item.
}
else if ( toSteal.Parent is Mobile )
{
m_Thief.SendLocalizedMessage( 1005585 ); // You cannot steal items which are equiped.
}
else if ( root == m_Thief )
{
m_Thief.SendLocalizedMessage( 502704 ); // You catch yourself red-handed.
}
else if ( root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player )
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else if ( root is Mobile && !m_Thief.CanBeHarmful( (Mobile)root ) )
{
}
else if ( root is Corpse )
{
m_Thief.SendLocalizedMessage( 502710 ); // You can't steal that!
}
else
{
double w = toSteal.Weight + toSteal.TotalWeight;
if ( w > 10 )
{
m_Thief.SendMessage( "That is too heavy to steal." );
}
else
{
if ( toSteal.Stackable && toSteal.Amount > 1 )
{
int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);
if ( maxAmount < 1 )
maxAmount = 1;
else if ( maxAmount > toSteal.Amount )
maxAmount = toSteal.Amount;
int amount = Utility.RandomMinMax( 1, maxAmount );
if ( amount >= toSteal.Amount )
{
int pileWeight = (int)Math.Ceiling( toSteal.Weight * toSteal.Amount );
pileWeight *= 10;
if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
stolen = toSteal;
}
else
{
int pileWeight = (int)Math.Ceiling( toSteal.Weight * amount );
pileWeight *= 10;
if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5 ) )
{
stolen = Mobile.LiftItemDupe( toSteal, toSteal.Amount - amount );
if ( stolen == null )
stolen = toSteal;
}
}
}
else
{
int iw = (int)Math.Ceiling( w );
iw *= 10;
if ( m_Thief.CheckTargetSkill( SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5 ) )
stolen = toSteal;
}
if ( stolen != null )
{
m_Thief.SendLocalizedMessage( 502724 ); // You succesfully steal the item.
m_Thief.Criminal = true;
m_Thief.Hidden = false;
#region Exp Gain
if ( !(toSteal is StealingTokenOne) || !(toSteal is StealingTokenTwo) || !(toSteal is StealingTokenThree) && ((PlayerMobile)m_Thief).Level >= 20 )
{
((PlayerMobile)m_Thief).Exp += 250;
m_Thief.SendMessage(68, "You receive 250 experience for the successful steal.");
}
#endregion
if ( si != null )
{
toSteal.Movable = true;
si.Item = null;
}
}
else
{
m_Thief.SendLocalizedMessage( 502723 ); // You fail to steal the item.
m_Thief.CriminalAction( true );
m_Thief.Hidden = false;
}
caught = ( m_Thief.Skills[SkillName.Stealing].Value < Utility.Random( 150 ) );
}
}
return stolen;
}
__________________
legendsofkaine.page.tl
|
|
|
|
|
|
#40 (permalink) |
|
Forum Novice
Join Date: Dec 2006
Posts: 480
|
Uhm, I want to add "Umbarian Shadows Guild" to the discription under the Players name.
so Using the GetProperties method in playermobile.cs I did this: Code:
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
ArrayList strings = new ArrayList( );
strings.Add("Level: " + this.Level.ToString());
if( UmbarianStone.IsThiefGuildMember( this ) )
{
strings.Add("Umbarian Shadows Guild");
}
if ( SicknessType != SickType.None )
{
strings.Add("Sick: " + this.SicknessType.ToString());
}
string toAdd = "";
int amount = strings.Count;
int current = 1;
foreach( string str in strings )
{
toAdd += str;
if( current != amount )
toAdd += "\n";
++current;
}
if( toAdd != "" )
list.Add( 1070722, toAdd );
}
Why isnt it working ![]() regards
__________________
legendsofkaine.page.tl
|
|
|
|
|
|
#44 (permalink) |
|
Forum Novice
|
Do some research work. Find out what cause trouble: empty Dictionary, incorrect work of GetProperties() method or anything else. Add some Console.WriteLine method calls to your code and see what code sections don't work the way you want them
Didn't dig too deep into your code but it seems fine. Maybe kind of liitle bug anywhere but noone except you here is able to run this code and make any debug work Last edited by Soteric; 08-13-2008 at 03:36 PM. |
|
|
|
![]() |
| Bookmarks |
| Tags |
| player |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|