RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Custom Playermobile help

Ravenal

Knight
this is how mine is seted up
[code:1]
private static Mobile CreateMobile( Account a )
{
{
for ( int i = 0; i < 5; ++i )
if ( a == null )
return (a = new AllianceMobile());

for ( int i = 0; i < 5; ++i )
if ( a == null )
return (a = new ALQuestMobile());

for ( int i = 0; i < 5; ++i )
if ( a == null )
return (a = new ALPlayerMobile());
return null;
}
}
[/code:1]
 

Ravenal

Knight
okay this is what you do...


in serialize do this
[code:1]
writer.Write( (string)m_RareName );
[/code:1]

in deserialize

[code:1]
m_RareName = (string)reader.ReadString();
[/code:1]
 

hcker2000

Wanderer
Ok just for referance and for other people to learn from this is my current custom player mobile

[code:1]using Server;
using Server.Network;

namespace Server.Mobiles
{
public class HNetMobile : PlayerMobile
{
private string m_TravledFrom;

[CommandProperty( AccessLevel.GameMaster )]
public string TravledFrom
{
get{ return m_TravledFrom; }
set{ m_TravledFrom = value; }
}

public HNetMobile()
{
TravledFrom = "SomePlace";
}

public HNetMobile( Serial serial ) : base( serial )
{
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();

switch ( version )
{
case 0:
{
m_TravledFrom = reader.ReadString();
break;
}
}
}


public override void Serialize( GenericWriter writer )
{

base.Serialize( writer );

writer.Write( (int) 0 ); // version
writer.Write( m_TravledFrom );

}
}
}
[/code:1]

And This is my charatercreation

[code:1]
private static Mobile CreateMobile( Account a )
{
for ( int i = 0; i < 5; ++i )
if ( a == null )
return (a = new Mobile());


for ( int i = 0; i < 5; ++i )
if ( a == null )
return (a = new HNetMobile());

return null;
}

[/code:1]
 

hcker2000

Wanderer
Ok corrected the lines like u said and i still cant see them in the [props. Dose it matter that im checking a newly made admin account?
 

hcker2000

Wanderer
ok so my file looks like this now

[code:1]
private static Mobile CreateMobile( Account a )
{
for ( int i = 0; i < 5; ++i )
if ( a == null )
return (a = new HNetMobile());

return null;
}
[/code:1]
 

hcker2000

Wanderer
I got it I freaking GOT IT :) now if you could tell me how to set the variable from a script that would be vary nice :) wouldent it be some thing like mobile.TravledFrom = "my whoo haa hear"?
 
If you're in a method that has from as a Mobile then you can use the following:

[code:1]if (from is HNetMobile)
((HNetMobile) from).TravelledFrom="blahblahblah";[/code:1]

Well, once you've got "travelled" spelt properly...
 

hcker2000

Wanderer
Ok that works. Oh if your still around awakenlands whats your script look like to convert old players to the new playermobiles?
 
Top