Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > C#

C# C# Discussion

Reply
 
Thread Tools Display Modes
Old 02-26-2007, 02:58 AM   #1 (permalink)
Forum Expert
 
IHaveRegistered's Avatar
 
Join Date: Jun 2003
Location: Ontario
Age: 20
Posts: 4,519
Send a message via MSN to IHaveRegistered
Default Changing a "Private" variable forcibly?

Hiya, I was wondering if there's any way I can edit a Private variable outside of that class, forcibly or by any other means. The reason I'm actually asking this instead of just changing the scope of the variable because it's within the core. I've looked around, and seemingly couldn't find an exact answer. For the exact code I'm wanting to change without editing the core... See below.

Lines 2679-2682 in Mobile.cs

Code:
        private static TimeSpan m_WalkFoot = TimeSpan.FromSeconds( 0.4 );
        private static TimeSpan m_RunFoot = TimeSpan.FromSeconds( 0.2 );
        private static TimeSpan m_WalkMount = TimeSpan.FromSeconds( 0.2 );
        private static TimeSpan m_RunMount = TimeSpan.FromSeconds( 0.1 );
Thanks for the help in advance!
__________________
IHaveRegistered is offline   Reply With Quote
Old 02-26-2007, 03:50 AM   #2 (permalink)
Forum Expert
 
Join Date: Jul 2005
Location: Istanbul/Turkey
Age: 27
Posts: 425
Default

well, when you have core files, it is really not necassary to use such a thing but here is what you can do:


Code:
Type mobileType = Type.GetType("Server.Mobile");
FieldInfo walkFoot = mobileType.GetField("m_WalkFoot", BindingFlags.NonPublic);
walkFoot.SetValue(null, newVal);
__________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
noobie is offline   Reply With Quote
Old 02-26-2007, 05:00 PM   #3 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,760
Default

Quote:
Originally Posted by noobie View Post
well, when you have core files, it is really not necassary to use such a thing but here is what you can do:


Code:
Type mobileType = Type.GetType("Server.Mobile");
FieldInfo walkFoot = mobileType.GetField("m_WalkFoot", BindingFlags.NonPublic);
walkFoot.SetValue(null, newVal);
wow, doesnt that defeat the purpose of private :/
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 02-26-2007, 07:59 PM   #4 (permalink)
Master of the Internet
 
TMSTKSBK's Avatar
 
Join Date: Feb 2004
Location: NC/NC State Univ
Age: 23
Posts: 16,422
Default

Ya gotta do what ya gotta do...
(I think really it's just the annoyance factor involved in changing it that keeps private relatively...well..."private".)
__________________
Goodbye, folks.
TMSTKSBK is offline   Reply With Quote
Old 02-27-2007, 01:36 AM   #5 (permalink)
Forum Expert
 
Join Date: Jul 2005
Location: Istanbul/Turkey
Age: 27
Posts: 425
Default

there is no such a thing as private

sometimes, changing a private value might mess up implementation, but here it is only cpu i guess
__________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
noobie is offline   Reply With Quote
Old 02-27-2007, 10:52 AM   #6 (permalink)
Master of the Internet
 
Join Date: Oct 2005
Age: 44
Posts: 6,283
Default

Well, the issue I see with what I believe you are trying to do is that since the members are static, if you change the value, it will change the value for all instances of Mobile in the world, which I think was pretty much what noobie was getting at.

[EDIT]

It also just occurred to me that since in BaseCreature, you can specify Active and Passive speed, there must be a way to change these values already in place since it seems that they corespond to same.
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him

Last edited by Malaperth; 02-27-2007 at 11:00 AM.
Malaperth is offline   Reply With Quote
Old 02-27-2007, 04:14 PM   #7 (permalink)
Forum Expert
 
IHaveRegistered's Avatar
 
Join Date: Jun 2003
Location: Ontario
Age: 20
Posts: 4,519
Send a message via MSN to IHaveRegistered
Default

Quote:
Originally Posted by Malaperth View Post
It also just occurred to me that since in BaseCreature, you can specify Active and Passive speed, there must be a way to change these values already in place since it seems that they corespond to same.
Uhh, you mean for a Mobile? PlayerMobile has some options for speed in it, though it has a very VERY small effect, if any Since I was taking lag into account, I'd say that's the only reason why one person was faster than another... The test was too run across a field, and the person who I changed their speed from the PlayerMobile ended up getting there just a few steps earlier.

That's why I wanted to edit the mobile. I've had a few speculations about it being a static variable, and thus editing all of the mobiles in the world. Though I was also wondering about the PlayerMobiles little movement speed things, and if they would have any effect. So I was just gonna do a bit of trial & error

At least once I get it to work the way I want it too...

It did kind of strike me though that you can change privates like that. Very interesting.
__________________
IHaveRegistered is offline   Reply With Quote
Old 02-27-2007, 04:16 PM   #8 (permalink)
Forum Expert
 
mordero's Avatar
 
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
Default

Yeah, noobie thats quite a trick, id ++ ya, but i cant
mordero is offline   Reply With Quote
Old 02-27-2007, 04:33 PM   #9 (permalink)
Forum Expert
 
Kenko's Avatar
 
Join Date: Dec 2004
Location: Land of the Poor
Posts: 1,828
Send a message via MSN to Kenko
Default

noobie brings it.
Kenko is offline   Reply With Quote
Old 02-27-2007, 05:28 PM   #10 (permalink)
Master of the Internet
 
Join Date: Oct 2005
Age: 44
Posts: 6,283
Default

In the constructor of a BaseCreature, you specify the Active and Passive speed, which, strangely coincide with the values you mention wanting to change. That means that speed IS already changeable.
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 02-27-2007, 09:54 PM   #11 (permalink)
Forum Expert
 
IHaveRegistered's Avatar
 
Join Date: Jun 2003
Location: Ontario
Age: 20
Posts: 4,519
Send a message via MSN to IHaveRegistered
Default

Quote:
Originally Posted by Malaperth View Post
In the constructor of a BaseCreature, you specify the Active and Passive speed, which, strangely coincide with the values you mention wanting to change. That means that speed IS already changeable.
Not trying to change it for a BaseCreature, i'm trying to change it for a playermobile. I've gone through PlayerMobile.cs, and the values there didn't help it any, as I said before. :\

I wish it was as easy as BaseCreature.
__________________
IHaveRegistered is offline   Reply With Quote
Old 02-28-2007, 08:22 AM   #12 (permalink)
Master of the Internet
 
Join Date: Oct 2005
Age: 44
Posts: 6,283
Default

Right, however, BaseCreature inherits from Mobile, so between those two classes, somewhere in there must be a way to change the speed since it is done in BaseCreature, so the capability is already there, you just need to find it.
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 02-28-2007, 02:14 PM   #13 (permalink)
Forum Expert
 
IHaveRegistered's Avatar
 
Join Date: Jun 2003
Location: Ontario
Age: 20
Posts: 4,519
Send a message via MSN to IHaveRegistered
Default

Quote:
Originally Posted by Malaperth View Post
Right, however, BaseCreature inherits from Mobile, so between those two classes, somewhere in there must be a way to change the speed since it is done in BaseCreature, so the capability is already there, you just need to find it.
Ohh true... Hmm... *looks*

Edit: Can't find anything that looks like it'll change that. SpeedInfo was the only really "different" thing in there, and SpeedInfo.cs really has nothing that'll change the mobile speed (I believe it just gets it, and sets a base setting). PlayerMobile.cs already HAD something inside itself for editing speeds... It just didn't alter anything.
__________________

Last edited by IHaveRegistered; 02-28-2007 at 03:41 PM.
IHaveRegistered is offline   Reply With Quote
Old 02-28-2007, 04:58 PM   #14 (permalink)
Master of the Internet
 
Join Date: Oct 2005
Age: 44
Posts: 6,283
Default

Well, from just a quick look at BaseCreature, I found this:

Code:
		public BaseCreature(AIType ai,
			FightMode mode,
			int iRangePerception,
			int iRangeFight,
			double dActiveSpeed, 
			double dPassiveSpeed)
which leads to this:

Code:
			SpeedInfo.GetSpeeds( this, ref dActiveSpeed, ref dPassiveSpeed );
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 03-01-2007, 09:38 PM   #15 (permalink)
Forum Expert
 
IHaveRegistered's Avatar
 
Join Date: Jun 2003
Location: Ontario
Age: 20
Posts: 4,519
Send a message via MSN to IHaveRegistered
Default

Quote:
Originally Posted by Malaperth View Post
Well, from just a quick look at BaseCreature, I found this:

Code:
        public BaseCreature(AIType ai,
            FightMode mode,
            int iRangePerception,
            int iRangeFight,
            double dActiveSpeed, 
            double dPassiveSpeed)
which leads to this:

Code:
            SpeedInfo.GetSpeeds( this, ref dActiveSpeed, ref dPassiveSpeed );
Yea, but the SpeedInfo doesn't change anything on the BaseCreature...

Code:
using System;
using System.Collections;
using Server;
using Server.Mobiles;
using Server.Factions;

namespace Server
{
    public class SpeedInfo
    {
        // Should we use the new method of speeds?
        private static bool Enabled = true;

        private double m_ActiveSpeed;
        private double m_PassiveSpeed;
        private Type[] m_Types;

        public double ActiveSpeed
        {
            get{ return m_ActiveSpeed; }
            set{ m_ActiveSpeed = value; }
        }

        public double PassiveSpeed
        {
            get{ return m_PassiveSpeed; }
            set{ m_PassiveSpeed = value; }
        }

        public Type[] Types
        {
            get{ return m_Types; }
            set{ m_Types = value; }
        }

        public SpeedInfo( double activeSpeed, double passiveSpeed, Type[] types )
        {
            m_ActiveSpeed = activeSpeed;
            m_PassiveSpeed = passiveSpeed;
            m_Types = types;
        }

        public static bool Contains( object obj )
        {
            if ( !Enabled )
                return false;

            if ( m_Table == null )
                LoadTable();

            SpeedInfo sp = (SpeedInfo)m_Table[obj.GetType()];

            return ( sp != null );
        }

        public static bool GetSpeeds( object obj, ref double activeSpeed, ref double passiveSpeed )
        {
            if ( !Enabled )
                return false;

            if ( m_Table == null )
                LoadTable();

            SpeedInfo sp = (SpeedInfo)m_Table[obj.GetType()];

            if ( sp == null )
                return false;

            activeSpeed = sp.ActiveSpeed;
            passiveSpeed = sp.PassiveSpeed;

            return true;
        }

        private static void LoadTable()
        {
            m_Table = new Hashtable();

            for ( int i = 0; i < m_Speeds.Length; ++i )
            {
                SpeedInfo info = m_Speeds[i];
                Type[] types = info.Types;

                for ( int j = 0; j < types.Length; ++j )
                    m_Table[types[j]] = info;
            }
        }

        private static Hashtable m_Table;

        private static SpeedInfo[] m_Speeds = new SpeedInfo[]
        {
            /* Slow */
            new SpeedInfo( 0.3, 0.6, new Type[]
            {
                typeof( AntLion ),            typeof( ArcticOgreLord ),    typeof( BogThing ),
                typeof( Bogle ),            typeof( BoneKnight ),        typeof( EarthElemental ),
                typeof( Ettin ),            typeof( FrostOoze ),        typeof( FrostTroll ),
                typeof( GazerLarva ),        typeof( Ghoul ),            typeof( Golem ),
                typeof( HeadlessOne ),        typeof( Jwilson ),            typeof( Mummy ),
                typeof( Ogre ),                typeof( OgreLord ),            typeof( PlagueBeast ),
                typeof( Quagmire ),            typeof( Rat ),                typeof( RottingCorpse ),
                typeof( Sewerrat ),            typeof( Skeleton ),            typeof( Slime ),
                typeof( Zombie ),            typeof( Walrus ),            typeof( RestlessSoul ),
                typeof( CrystalElemental ),    typeof( DarknightCreeper ),    typeof( MoundOfMaggots ),
                typeof( Juggernaut )
            } ),
            /* Fast */
            new SpeedInfo( 0.2, 0.4, new Type[]
            {
                typeof( LordOaks ),            typeof( Silvani ),            typeof( AirElemental ),
                typeof( AncientWyrm ),        typeof( Balron ),            typeof( BladeSpirits ),
                typeof( DreadSpider ),        typeof( Efreet ),            typeof( EtherealWarrior ),
                typeof( Lich ),                typeof( Nightmare ),        typeof( OphidianArchmage ),
                typeof( OphidianMage ),        typeof( OphidianWarrior ),    typeof( OphidianMatriarch ),
                typeof( OphidianKnight ),    typeof( PoisonElemental ),    typeof( Revenant ),
                typeof( SandVortex ),        typeof( SavageRider ),        typeof( SavageShaman ),
                typeof( SnowElemental ),    typeof( WhiteWyrm ),        typeof( Wisp ),
                typeof( SummonedAirElemental ),    typeof( GiantBlackWidow ), typeof( DemonKnight )
            } ),
            /* Very Fast */
            new SpeedInfo( 0.175, 0.350, new Type[]
            {
                typeof( Barracoon ),        typeof( Mephitis ),            typeof( Neira ),
                typeof( Rikktor ),            typeof( Semidar ),            typeof( EnergyVortex ),
                typeof( Beetle ),            typeof( Pixie ),            typeof( SilverSerpent ),
                typeof( VorpalBunny ),        typeof( FleshRenderer ),    typeof( KhaldunRevenant ),
                typeof( FactionDragoon ),    typeof( FactionKnight ),    typeof( FactionPaladin ),
                typeof( FactionHenchman ),    typeof( FactionMercenary ),    typeof( FactionNecromancer ),
                typeof( FactionSorceress ),    typeof( FactionWizard ),    typeof( FactionBerserker ),
                typeof( FactionDeathKnight )
            } ),
            /* Medium */
            new SpeedInfo( 0.25, 0.5, new Type[]
            {
                typeof( ToxicElemental ),    typeof( Agapitebeast ),    typeof( Alligator ),
                typeof( AncientLich ),        typeof( Betrayer ),            typeof( Bird ),
                typeof( BlackBear ),        typeof( BlackSolenInfiltratorQueen ), typeof( BlackSolenInfiltratorWarrior ),
                typeof( BlackSolenQueen ),    typeof( BlackSolenWarrior ), typeof( BlackSolenWorker ),
                typeof( BloodElemental ),    typeof( Boar ),                typeof( Bogling ),
                typeof( BoneMagi ),            typeof( Brigand ),            typeof( Bronzebeast ),
                typeof( BrownBear ),        typeof( Bull ),                typeof( BullFrog ),
                typeof( Cat ),                typeof( Centaur ),            typeof( ChaosDaemon ),
                typeof( Chicken ),            typeof( GolemController ),    typeof( Copperbeast ),
                typeof( Copperbeast ),    typeof( Cougar ),            typeof( Cow ),
                typeof( Cyclops ),            typeof( Daemon ),            typeof( DeepSeaSerpent ),
                typeof( DesertOstard ),        typeof( DireWolf ),            typeof( Dog ),
                typeof( Dolphin ),            typeof( Dragon ),            typeof( Drake ),
                typeof( DullCopperbeast ), typeof( Eagle ),            typeof( ElderGazer ),
                typeof( EvilMage ),            typeof( EvilMageLord ),        typeof( Executioner ),
                typeof( Savage ),            typeof( FireElemental ),    typeof( FireGargoyle ),
                typeof( FireSteed ),        typeof( ForestOstard ),        typeof( FrenziedOstard ),
                typeof( FrostSpider ),        typeof( Gargoyle ),            typeof( Gazer ),
                typeof( IceSerpent ),        typeof( GiantRat ),            typeof( GiantSerpent ),
                typeof( GiantSpider ),        typeof( GiantToad ),        typeof( Goat ),
                typeof( Goldenbeast ),    typeof( Gorilla ),            typeof( GreatHart ),
                typeof( GreyWolf ),            typeof( GrizzlyBear ),        typeof( Guardian ),
                typeof( Harpy ),            typeof( Harrower ),            typeof( HellHound ),
                typeof( Hind ),                typeof( HordeMinion ),        typeof( Horse ),
                typeof( Horse ),            typeof( IceElemental ),        typeof( IceFiend ),
                typeof( IceSnake ),            typeof( Imp ),                typeof( JackRabbit ),
                typeof( Kirin ),            typeof( Kraken ),            typeof( PredatorHellCat ),
                typeof( LavaLizard ),        typeof( LavaSerpent ),        typeof( LavaSnake ),
                typeof( Lizardman ),        typeof( Llama ),            typeof( Mongbat ),
                typeof( StrongMongbat ),    typeof( MountainGoat ),        typeof( Orc ),
                typeof( OrcBomber ),        typeof( OrcBrute ),            typeof( OrcCaptain ),
                typeof( OrcishLord ),        typeof( OrcishMage ),        typeof( PackHorse ),
                typeof( PackLlama ),        typeof( Panther ),            typeof( Pig ),
                typeof( PlagueSpawn ),        typeof( PolarBear ),        typeof( Rabbit ),
                typeof( Ratman ),            typeof( RatmanArcher ),        typeof( RatmanMage ),
                typeof( RedSolenInfiltratorQueen ), typeof( RedSolenInfiltratorWarrior ), typeof( RedSolenQueen ),
                typeof( RedSolenWarrior ),    typeof( RedSolenWorker ),    typeof( RidableLlama ),
                typeof( Ridgeback ),        typeof( Scorpion ),            typeof( SeaSerpent ),
                typeof( SerpentineDragon ),    typeof( Shade ),            typeof( ShadowIronbeast ),
                typeof( ShadowWisp ),        typeof( ShadowWyrm ),        typeof( Sheep ),
                typeof( SilverSteed ),        typeof( SkeletalDragon ),    typeof( SkeletalMage ),
                typeof( SkeletalMount ),    typeof( HellCat ),            typeof( Snake ),
                typeof( SnowLeopard ),        typeof( SpectralArmour ),    typeof( Spectre ),
                typeof( StoneGargoyle ),    typeof( StoneHarpy ),        typeof( SwampDragon ),
                typeof( ScaledSwampDragon ), typeof( SwampTentacle ),    typeof( TerathanAvenger ),
                typeof( TerathanDrone ),    typeof( TerathanMatriarch ), typeof( TerathanWarrior ),
                typeof( TimberWolf ),        typeof( Titan ),            typeof( Troll ),
                typeof( Unicorn ),            typeof( Valoritebeast ), typeof( Veritebeast ),
                typeof( CoMWarHorse ),        typeof( MinaxWarHorse ),    typeof( SLWarHorse ),
                typeof( TBWarHorse ),        typeof( WaterElemental ),    typeof( WhippingVine ),
                typeof( WhiteWolf ),        typeof( Wraith ),            typeof( Wyvern ),
                typeof( KhaldunZealot ),    typeof( KhaldunSummoner ),    typeof( SavageRidgeback ),
                typeof( LichLord ),            typeof( SkeletalKnight ),    typeof( SummonedDaemon ),
                typeof( SummonedEarthElemental ),    typeof( SummonedWaterElemental ), typeof( SummonedFireElemental ),
                typeof( MeerWarrior ),        typeof( MeerEternal ),        typeof( MeerMage ),
                typeof( MeerCaptain ),        typeof( JukaLord ),            typeof( JukaMage ),
                typeof( JukaWarrior ),        typeof( AbysmalHorror ),    typeof( BoneDemon ),
                typeof( Devourer ),            typeof( FleshGolem ),        typeof( Gibberling ),
                typeof( GoreFiend ),        typeof( Impaler ),            typeof( PatchworkSkeleton ),
                typeof( Ravager ),            typeof( ShadowKnight ),        typeof( SkitteringHopper ),
                typeof( Treefellow ),        typeof( VampireBat ),        typeof( WailingBanshee ),
                typeof( WandererOfTheVoid ),    typeof( Cursed ),            typeof( GrimmochDrummel ),
                typeof( LysanderGathenwale),    typeof( MorgBergen ),    typeof( ShadowFiend ),
                typeof( SpectralArmour ),    typeof( TavaraSewel ),        typeof( ArcaneDaemon ),
                typeof( Doppleganger ),        typeof( EnslavedGargoyle ), typeof( ExodusMinion ),
                typeof( ExodusOverseer ),    typeof( GargoyleDestroyer ),    typeof( GargoyleEnforcer ),
                typeof( Moloch )
            } )
        };
    }
}
Nothing in there showed me anything about changing their speeds in the slightest. Though I guess it won't hurt to try. Lemme give it a shot, and good thinking on the random tidbit there, i'll just declare a few things, then try this puppy out!
__________________
IHaveRegistered is offline   Reply With Quote
Old 03-02-2007, 12:42 AM   #16 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,760
Default

Code:
        public double ActiveSpeed
        {
            get{ return m_ActiveSpeed; }
            set{ m_ActiveSpeed = value; }
        }

        public double PassiveSpeed
        {
            get{ return m_PassiveSpeed; }
            set{ m_PassiveSpeed = value; }
        }
These control the speed of the creatures AI.
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 03-03-2007, 01:08 PM   #17 (permalink)
Forum Expert
 
IHaveRegistered's Avatar
 
Join Date: Jun 2003
Location: Ontario
Age: 20
Posts: 4,519
Send a message via MSN to IHaveRegistered
Default

Hmm, I just tried to use the code from BaseCreature.cs and it had no effect on my running/walking speeds.

Shame :\
__________________
IHaveRegistered is offline   Reply With Quote
Old 03-05-2007, 10:09 AM   #18 (permalink)
Master of the Internet
 
Join Date: Oct 2005
Age: 44
Posts: 6,283
Default

Quote:
Originally Posted by IHaveRegistered View Post
Hmm, I just tried to use the code from BaseCreature.cs and it had no effect on my running/walking speeds.

Shame :\
All I know is that when you change the values passed in to the BaseCreature constructor, it does effect the mobile's speed, so there must be a way to do it even if I/we do not exactly know how.
__________________
Why is it that I'm never as smart as I thought I was yesterday?
My vast knowledge is only surpassed by my infinite ignorance.
<TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him
Malaperth is offline   Reply With Quote
Old 03-05-2007, 11:39 AM   #19 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,760
Default

Quote:
Originally Posted by Malaperth View Post
All I know is that when you change the values passed in to the BaseCreature constructor, it does effect the mobile's speed, so there must be a way to do it even if I/we do not exactly know how.
Even when changed in [props it changes the mobiles movement speed.
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 03-05-2007, 11:40 AM   #20 (permalink)
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Location: In your mom
Age: 27
Posts: 4,760
Default

Quote:
Originally Posted by IHaveRegistered View Post
Hmm, I just tried to use the code from BaseCreature.cs and it had no effect on my running/walking speeds.

Shame :\
wait just a min, YOUR movement speeds....thats client based....
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote
Old 03-05-2007, 04:04 PM   #21 (permalink)
Forum Expert
 
IHaveRegistered's Avatar
 
Join Date: Jun 2003
Location: Ontario
Age: 20
Posts: 4,519
Send a message via MSN to IHaveRegistered
Default

Quote:
Originally Posted by Jeff View Post
wait just a min, YOUR movement speeds....thats client based....
Hmm, I guess there's no easy way to go through that one eh?

Only one thing I can think of is checking the [speedboost from the 2.0 core... But I think that just makes it act like you're on a mount... and i'm 1.0


Well that's just really a shame. I was looking forward to items with an EnhanceSpeed attribute or something like that.

Edit:
I attempted to use the following:

Quote:
Type mobileType = Type.GetType("Server.Mobile");
FieldInfo walkFoot = mobileType.GetField("m_WalkFoot", BindingFlags.NonPublic);
walkFoot.SetValue(null, newVal);
I was unable to use the SetValue, after looking into it a bit I was still unsuccessful (likely due to what Jeff said, it's client based... I thought about that, but then was still wondering how speedhacks and stuff worked... bleh :\). Anywho, I ended up with this script:

Code:
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Reflection;
using System.Collections;
using System.Diagnostics;
using Server;
using Server.Network;
using Server.Accounting;
using Server.Guilds;
using Server.Gumps;
using Server.Mobiles;
using Server.Items;
using System.Globalization;

namespace Server.Items
{ 
    public class ZDSSpeedEditor : Item 
    {
        private AccessLevel m_AccessLevelRequired = AccessLevel.Administrator;
        private TimeSpan m_NewWalkFoot = TimeSpan.FromSeconds( 0.4 );
        private TimeSpan m_NewRunFoot = TimeSpan.FromSeconds( 0.2 );
        private TimeSpan m_NewWalkMount = TimeSpan.FromSeconds( 0.2 );
        private TimeSpan m_NewRunMount = TimeSpan.FromSeconds( 0.1 );
        
        private TimeSpan m_WalkFoot = TimeSpan.FromSeconds( 0.4 );
        private TimeSpan m_RunFoot = TimeSpan.FromSeconds( 0.2 );
        private TimeSpan m_WalkMount = TimeSpan.FromSeconds( 0.2 );
        private TimeSpan m_RunMount = TimeSpan.FromSeconds( 0.1 );
        
        [CommandProperty( AccessLevel.Administrator )]
        public AccessLevel AccessLevelRequired { get{ return m_AccessLevelRequired; } set { m_AccessLevelRequired = value; } }

        [CommandProperty( AccessLevel.Administrator )]
        public TimeSpan NewWalkFoot { get{ return m_WalkFoot; } set { m_WalkFoot = value; } }
        [CommandProperty( AccessLevel.Administrator )]
        public TimeSpan NewRunFoot { get{ return m_RunFoot; } set { m_RunFoot = value; } }
        [CommandProperty( AccessLevel.Administrator )]
        public TimeSpan NewWalkMount { get{ return m_WalkMount; } set { m_WalkMount = value; } }
        [CommandProperty( AccessLevel.Administrator )]
        public TimeSpan NewRunMount { get{ return m_RunMount; } set { m_RunMount = value; } }
        
        [Constructable] 
        public ZDSSpeedEditor() : base( 0xED4 )
        { 
            Movable = false;
            Name = "Zeratuls Downfall In-Game Mobile Speed Editor [Admin Only]";
            Hue = 2243;
        } 

        public override void OnDoubleClick( Mobile from )
        {
            if( (from != null) && (from.AccessLevel >= m_AccessLevelRequired) )
            {
                int ErrorLoc = 0;
                string Comment = "//";
                StreamWriter op = new StreamWriter( "MobileSpeedEditor.log", true );
                StreamWriter op2 = new StreamWriter( "MobileSpeedEditorErrors.log", true );
                
                try
                {
                    from.SendMessage(94, "4. typeof(Server.Mobile): {0}", typeof(Server.Mobile).ToString());
                    
                    ErrorLoc = 1;
                    FieldInfo myFieldInfoWF = typeof(Server.Mobile).GetField("m_WalkFoot", BindingFlags.Public);
                    ErrorLoc = 2;
                    FieldInfo myFieldInfoRF = typeof(Server.Mobile).GetField("m_RunFoot", BindingFlags.Public | BindingFlags.Instance);
                    ErrorLoc = 3;
                    FieldInfo myFieldInfoWM = typeof(Server.Mobile).GetField("m_WalkMount", BindingFlags.NonPublic); //was "m_WalkMount"
                    ErrorLoc = 4;
                    FieldInfo myFieldInfoRM = typeof(Server.Mobile).GetField("m_RunMount", BindingFlags.NonPublic | BindingFlags.Instance); //
                    ErrorLoc = 5;
                    
                    
                    int i = 0;
                    int j = 0;
                    int k = 0;
                    
                    op.WriteLine( "{0}, ErrorLoc: {1}, myFieldInfoWF: {2}, i: {3}, j: {4}, k: {5} ({6}.{7}.{8})", Comment, ErrorLoc, myFieldInfoWF, i, j, k, i, j, k );
                    for( i = 0; i < 20; i++ )
                    {
                        if( i <= 9 )
                        {
                            object myObject = from;
                            if( i == 0 )