Something like this:
Code:
  protected override void OnTarget(Mobile from, object targeted)
  {
  PlayerMobile player = from as PlayerMobile;
  if (targeted is PlayerMobile)
  {
  player.SendMessage("You cannot target yourself or other players.");

  }
  if (targeted is BaseCreature)
  {
  if (targeted is Dragon && bc.ControlMaster == player)
  {
  bc = (Dragon)targeted;
  player.SendMessage("You have selected a Dragon");
  bc.RawStr = test;
  }
  if (targeted is Nightmare)
  {
  bc = (Nightmare)targeted;
  player.SendMessage("You have selected a Nightmare");
  }
  }
  else
  {
  player.SendMessage("That is not a valid target");
  }
  }

Getting a crash not sure if this is the problem.
 
Code:
  if (targeted is Dragon && bc.ControlMaster == player)
  {
  bc = (BaseCreature)targeted;
  player.SendMessage("You have selected a Dragon");
  bc.RawStr = test;
  }

This bc should be correct, but for us to detect anymore we will need the full script and the crash log in the ServUO directory. :)
You cant cast a Dragon as a BaseCreature.
Example:
Code:
  Mobile m = (Mobile)targeted;
It has to be Whatever the thing you're trying to make it into.

But again any other crashes will require the crash log txt contents and the script in its entirety. :)
[doublepost=1526327346][/doublepost]
Code:
  if (targeted is BaseCreature)
  {
  bc = (BaseCreature)targeted;
  if (targeted is Dragon && bc.ControlMaster == player)
  {
  player.SendMessage("You have selected a Dragon");
  bc.RawStr = test;
  }
  if (targeted is Nightmare)
  {
  bc = (Nightmare)targeted;
  player.SendMessage("You have selected a Nightmare");
  }
  }
Also bc should be cast before asking whether the player is its controlmaster. as it will likely chuck a hissy about nothing being bc.
 
Last edited:
Back