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
Now we must search for switch ( version ). This step is very important, and forgeting this will cause some doom
Now, look for
and change 18 for the newer version, 19
And finally, add below this last line,
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.
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 [COLOR="Red"]19[/COLOR]:
{
m_test = reader.ReadBool();
goto case [COLOR="Blue"]18[/COLOR];
}
case [COLOR="blue"]18[/COLOR]:
{
m_SolenFriendship = (SolenFriendship)...
Code:
writer.Write( (int) [COLOR="blue"]18[/COLOR] ); // version
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.