Full Version : how they make this?
xmlspawner >>Scripting Support >>how they make this?


<< Prev | Next >>

ambak- 02-09-2006
user posted image
i saw this in a shard.
this player is not in a guild or anything else this is just a custom title
i saw different types of it in this shard
like 3 title lines like that
Shard Owner
Scripter
Designer


ArteGordon- 02-09-2006
check out this thread. Same idea. You could also do it in the AddNameProperties override.
http://xmlspawner.15.forumer.com/index.php?showtopic=261

ambak- 02-09-2006
where is the AddNameProperties in playermobile i didnt find it

ArteGordon- 02-09-2006
it is not there by default, but you can add it

CODE

 public override void AddNameProperties( ObjectPropertyList list )
 {
// put your custom name list stuff here
 }


it is where titles and guild names are added by default.

ambak- 02-09-2006
but i want to make it like this
think about a title1 ,title2 and title3 property
when i props a player i can add what i want from there
like the title and name in prop gump

ArteGordon- 02-09-2006
you would have to add those additional titles as custom properties to your playermobile, and then refer to them when you added strings to the properties list in the AddNameProperties or GetProperties overrides.

Note that if you added those custom properties, then you would also need to Serialize and Deserialize them.

ambak- 02-09-2006
can you show a little example ?

ArteGordon- 02-09-2006
to add a property accessible from the [props gump

CODE

private string m_Title1;

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


then you can refer to that property in the GetProperties override add add it to the properties list

ambak- 02-09-2006
am i right?
CODE
 
public override void GetProperties( ObjectPropertyList list )
 {
  base.GetProperties( list );
if (AccessLevel == AccessLevel.Player)
 {
   list.Add(1060660, "m_Title1");
 }


  if ( Map == Faction.Facet )
  {
   PlayerState pl = PlayerState.Find( this );

   if ( pl != null )
   {
    Faction faction = pl.Faction;

    if ( faction.Commander == this )
     list.Add( 1042733, faction.Definition.PropName ); // Commanding Lord of the ~1_FACTION_NAME~
    else if ( pl.Sheriff != null )
     list.Add( 1042734, "{0}\t{1}", pl.Sheriff.Definition.FriendlyName, faction.Definition.PropName ); // The Sheriff of  ~1_CITY~, ~2_FACTION_NAME~
    else if ( pl.Finance != null )
     list.Add( 1042735, "{0}\t{1}", pl.Finance.Definition.FriendlyName, faction.Definition.PropName ); // The Finance Minister of ~1_CITY~, ~2_FACTION_NAME~
    else if ( pl.MerchantTitle != MerchantTitle.None )
     list.Add( 1060776, "{0}\t{1}", MerchantTitles.GetInfo( pl.MerchantTitle ).Title, faction.Definition.PropName ); // ~1_val~, ~2_val~
    else
     list.Add( 1060776, "{0}\t{1}", pl.Rank.Title, faction.Definition.PropName ); // ~1_val~, ~2_val~
   }
  }
 }

ArteGordon- 02-09-2006
close. That particular cliloc, 1060660 requires two arguments ~1_val~:~2_val~ and will display them separated by a colon. You indicate separate arguments in a cliloc string by placing a tab char '\t' char between them, like

CODE

if (AccessLevel == AccessLevel.Player)
{
  list.Add(1060660, "Title\t{0}",m_Title1);  // ~1_val~:~2_val~
}

ambak- 02-09-2006
ok ill try but if they dont have a title1?

ArteGordon- 02-09-2006
it will just be an empty string after that. You could also just check for that condition with

CODE

if (AccessLevel == AccessLevel.Player && m_Title1 != null)
{
 list.Add(1060660, "Title\t{0}",m_Title1);  // ~1_val~:~2_val~
}

ambak- 02-09-2006
ok now i tried.no erros but i tried to give title1 to my staff char.but title1 isnt there in the props gump

ArteGordon- 02-09-2006
and you added all of this to your playermobile?

CODE

private string m_Title1;

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


if you did, then the Title1 property is there.

ambak- 02-09-2006
ohh you forgot something smile.gif
if a staff one to title1 himself this have to be like this i think
CODE

if (AccessLevel == AccessLevel.Administrator && m_Title1 != null)
{
list.Add(1060660, "Title\t{0}",m_Title1);  // ~1_val~:~2_val~
}


am i right?
because
when my level is admin
i type this command
[set title1 DEMO
it set the property but didnt shown.than i set my level to player than it shown smile.gif
i want it to set to every level.so my change is right i think?