View Single Post
Old 04-15-2006, 04:10 PM   #1 (permalink)
ygor
 
Join Date: Oct 2004
Location: São Paulo - Brazil
Age: 27
Posts: 4
Default Adding Custom Flags to Players

Intro
Sometimes you want to add a custom flag to the players, so you can control something, for example if they did or not a quest and if they will be able to do it again or not.
Of course you don´t want to delete players and restart the shard etc.

Description

Go to \Scripts\Mobiles and open PlayerMobile.cs

Now, look for private int m_Profession;

just below it, place your flag/variable, as example:private bool m_test;

Now, to keep this organized, lets add just below this declaration
Code:
//test flag for quest of the tutorial
             [CommandProperty( AccessLevel.GameMaster )]
		public bool test
		{
			get{ return m_test; }
			set{ m_test = value; }
		}
Now we must search for switch ( version ). This step is very important, and forgeting this will cause some doom
Code:
             switch ( version )
		{
		 case 19:
		            {
			m_test = reader.ReadBool();
			goto case 18;
			}

		case 18:
			{
				m_SolenFriendship = (SolenFriendship)...
Now, look for
Code:
writer.Write( (int) 18 ); // version
and change 18 for the newer version, 19

And finally, add below this last line,
Code:
writer.Write( m_test );
Presto!

Conclusion

Adding custom flags can be a powerfull tool when designing a quest, and as this tutorial shows, its easy to implement, and can be easily accessed from other classes.
Also note, the method above can use others variables too, with few changes.

This tutorial was based in FSGov script by Ronin.

Last edited by ygor; 04-16-2006 at 05:44 PM.
ygor is offline   Reply With Quote