Go Back   RunUO - Ultima Online Emulation > RunUO > FAQ Forum

FAQ Forum A place to find answers to the most frequently asked questions, and a place to post said answers. Do NOT use this forum to ask questions.

Reply
 
Thread Tools Display Modes
Old 02-14-2006, 02:55 PM   #1 (permalink)
Forum Novice
 
Join Date: Aug 2004
Location: Quebec
Age: 20
Posts: 235
Default How to add new [props on PlayerMobile

This is a small tutorial to help you to add a new props on PlayerMobile

Open this file:

Scripts\Mobiles\PlayerMobile.cs

Find the part of code:

Code:
private int m_Profession;
We add (after) a new global variable private called m_Newprop with int proprieties. You have to use an int into this variable. You can chance it to whatever you want (bool,double,arraylist...)

Code:
private int m_Newprop;
Than, find this:

Code:
[CommandProperty( AccessLevel.GameMaster )]
public bool PublicMyRunUO
{
    get{ return GetFlag( PlayerFlag.PublicMyRunUO ); }
    set{ SetFlag( PlayerFlag.PublicMyRunUO, value ); InvalidateMyRunUO(); }
}
And add after : ( You can change the AccessLevel )

Code:
[CommandProperty( AccessLevel.GameMaster )]
public NewProp int
{
    get{ return m_Newprop; }
    set{ m_Newprop = value; }
}
Find this:

Code:
writer.Write( (int) X ); // version
And increment the version number :

Code:
writer.Write( (int) X+1 ); // version
Add after the serialize writer. ( I put a (int) because I setted it to a int )

Code:
writer.Write( (int) m_Newprop );
Than on deserialize, find :

Code:
case X:
{
And add a case by adding 1 at X. (18->19)
And the second X must be your version number.

Code:
case X+1:
{
m_Newprop = reader.ReadInt();
goto case X;
}
* The X in red is your current version number. All the variable in color is based on your own script.

If you want to correct me or add some stuffs, please contact me in PM. (Thanks Irian)
__________________
Airwalk
Web Programmer
RunUO THE best UO Emulator

The first step to getting the things you want out of life is this: Decide what you want.
- Ben Stein

Last edited by airwalk; 02-14-2006 at 05:09 PM.
airwalk is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5