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

hcker2000

Wanderer
Custom Playermobile help

Ok here is what I got for my HNetPlayerMoble.cs file

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

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

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

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

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

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


public override void Serialize( GenericWriter writer )
{

base.Serialize( writer );

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

}
}
}
[/code:1]

And I get an error on line 12 column 7 saying 'TravledFrom' dose not exist in the class or namespace.

I was farly sure that its in both the class and name space but I could be wrong.
 

Ravenal

Knight
you proably need

[CommandProperty( AccessLevel.Administrator )]
public string Something
{
get{ return m_something; }
set{ m_something = value; }
}
 

hcker2000

Wanderer
Well let me take a wild stab at it and then u can tell me how it should be lol

private string TravledFrom;
...
TraveledFrom = "SomePlace";

should it be

public string TravledFrom;
...
TraveledFrom = "SomePlace";
 

hcker2000

Wanderer
Got it thanks. Another one of thoughs late night blunders. I also tryed what awakenlands said and I get errors with it.
 

Ravenal

Knight
well umm if you think about it...

one has to be private string m_RareName;

[code:1][CommandProperty( AccessLevel.Administrator )]
public string RareName
{
get{ return m_RareName; }
set{ m_RareName = null; }
}[/code:1]
 

Ravenal

Knight
this is my big playermobile that will soon be 2000+lines

[code:1]
using System;
using Server;
//using Server.Alliances;

namespace Server.Mobiles
{
public class AllianceMobile : ALQuestMobile
{
private int m_OrcishaGuards;
private int m_OrcishaElders;
private int m_OrcishaClan;
private int m_OrcishaMerchants;
private int m_RailothornGuards;

public AllianceMobile()
{
}

public AllianceMobile( Serial s ) : base( s )
{
}
[CommandProperty( AccessLevel.Administrator )]
public int OrcishaGuards { get{ return m_OrcishaGuards; } set{ m_OrcishaGuards = value; }
}
[CommandProperty( AccessLevel.Administrator )]
public int OrcishaElders { get{ return m_OrcishaElders; } set{ m_OrcishaElders = value; }
}
[CommandProperty( AccessLevel.Administrator )]
public int OrcishaClan { get{ return m_OrcishaGuards; } set{ m_OrcishaGuards = value; }
}
[CommandProperty( AccessLevel.Administrator )]
public int OrcishaMerchants { get{ return m_OrcishaMerchants; } set{ m_OrcishaMerchants = value; }
}
[CommandProperty( AccessLevel.Administrator )]
public int RailothornGuards { get{ return m_RailothornGuards; } set{ m_RailothornGuards = value; }
}


public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)1 );//version

//Version 1
writer.Write( (int)m_OrcishaGuards );
writer.Write( (int)m_OrcishaElders );
writer.Write( (int)m_OrcishaClan );
writer.Write( (int)m_OrcishaMerchants );
writer.Write( (int)m_RailothornGuards );
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
switch (version)
{
case 1:
m_OrcishaGuards = (int)reader.ReadInt();
m_OrcishaElders = (int)reader.ReadInt();
m_OrcishaClan = (int)reader.ReadInt();
m_OrcishaMerchants = (int)reader.ReadInt();
m_RailothornGuards = (int)reader.ReadInt();
goto case 0;
case 0:
break;
}
}
}
}
[/code:1]

I just have them as properties for now until the time being to make them not appear, but that is only 5 for testing with, their IsEnemy / Alliance Type system for like simular to Everquest hehe... It will be my 3rd Custom Mobile :p
 

hcker2000

Wanderer
Ok I got the script to compile ok now. Now I changed the CharacterCreation.cs file so that line 442 is

return (a = new HNetMobile());

But the item is still not showing up on the player when i do [props. And yes the account is a new account.
 

Ravenal

Knight
ok umm post the section you added in the mobile...

and umm did you add a command property? the one i demoed to ya?
 

hcker2000

Wanderer
Ok hear is my custom playermobile

[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]

It compiles fine just cant set the TravledFrom in game. Also if you could show an example of how to set the TravledFrom from an item that would be super great :)
 

hcker2000

Wanderer
Oh lol sory here we go

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