RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[duel Targeting

yuri99

Wanderer
[duel Targeting

Well i've been working on scripts for someoen i know but im having trouble on this last script.

i bieleve it is here thats the problem. You see I want an admin to be able to choose the compeditors, then have them teleporter to fight zone(taken care of) and then have them stripped of clothes and armed with only a few things(still working on)

So im trying to make it so Admin picks challengers, not the players.

Code:
else
				{
					if( m_Item.Game == ChallengeGameType.OnePlayerTeam )
					{
						m_Item.AddOpponentPlayer( m );
						m.IsInChallenge = true;
						m.PublicOverheadMessage(MessageType.Regular, 1153, true, String.Format( ChallengeeFormat, from.Name ) );
						m.SendGump( new FinalGump( pm, m, m_Item ));
					}
					else if( m_Item.Game == ChallengeGameType.TwoPlayerTeam )
					{
						m.IsInChallenge = true;
						
						if(i < 2)
						{
							if(i == 0)
							{
								m_Item.ChallengeTeam.Add( m );
								m.PublicOverheadMessage(MessageType.Regular, 1153, true, String.Format( TeamFormat, from.Name ) );
							}
							if(i == 1)
							{
								m_Item.OpponentTeam.Add( m ); 
								m.PublicOverheadMessage(MessageType.Regular, 1153, true, String.Format( ChallengeeFormat, from.Name ) );
							}
							i++; 
							m.SendGump(new PartnerGump( pm, m_Item, i, m ));
						}
						else if( i == 2 )
						{
							m_Item.OpponentTeam.Add( m );
							m.PublicOverheadMessage(MessageType.Regular, 1153, true, String.Format( ChallengeeFormat, from.Name ) );
							m.SendGump( new FinalGump( pm, m, m_Item ) );
							i = 0;
						}
					}						
				}					
			}
		}

here is the whole script, but I might be wrong, it might be in playermobiles, or in another one of the scripts im using

Code:
using System;
using System.Collections;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
using Server.Multis;
using Server.Mobiles;
using Server.Gumps;

namespace Server.Items
{
	public class ChallengeTarget : Target
	{
		private PlayerMobile pm;
		private ChallengeStone m_Item;
		private const string ChallengeeFormat = "{0} is challenging me!";
		private const string TeamFormat = "{0} is selecting me to be a teammate!";
		private int i;

		public ChallengeTarget( PlayerMobile from, ChallengeStone item, int count ) :  base ( 100, false, TargetFlags.None )
		{
			pm = from;
			m_Item = item;
			i = count;			
		}
					
		protected override void OnCantSeeTarget (Mobile from, object target )
		{m_Item.ClearAll();}

		protected override void OnTargetCancel(Mobile from, TargetCancelType Overriden)
		{m_Item.ClearAll();}

		protected override void OnTargetDeleted (Mobile from, object target )
		{m_Item.ClearAll();}

		protected override void OnTargetNotAccessible(Mobile from, object target )
		{m_Item.ClearAll();}

		protected override void OnTargetOutOfLOS(Mobile from, object target )
		{m_Item.ClearAll();}

		protected override void OnTargetOutOfRange(Mobile from, object target )
		{m_Item.ClearAll();}

		protected override void OnTargetUntargetable(Mobile from, object target )
		{m_Item.ClearAll();}		

		protected override void OnTarget( Mobile from, object target )
		{	
			if( m_Item.ChallengeTeam.Contains(target))
			{
				from.SendMessage( "You can't add someone already on your team" );
				from.Target = new ChallengeTarget( pm, m_Item, i );
			}
			else if( m_Item.OpponentTeam.Contains(target))
			{
				from.SendMessage( "You can't challenge someone already on the opposing team" );
				from.Target = new ChallengeTarget( pm, m_Item, i );
			}
			else if( !(target is PlayerMobile) )
			{
				from.SendMessage( "You can't target that" );
				from.Target = new ChallengeTarget( pm, m_Item, i );
			}
			else if ( target is PlayerMobile )
			{	
				PlayerMobile m = (PlayerMobile)target;
	
				if ( m.GameTime < TimeSpan.FromMinutes( 1.0 ))
				{
					from.SendMessage( 33, "You can only challenge a character who has a character age of at least 30 minutes of in-game play, select again!" );
					m.SendMessage( 33, "The ladder system is usable by characters who have a character age of at least 30 minutes of in-game play!" );
					from.Target = new ChallengeTarget( pm, m_Item, i );
				}
				else if ( m.Frozen == true )
				{
					from.SendMessage( 33, "That player is frozen, select again!" );
					from.Target = new ChallengeTarget( pm, m_Item, i );
				}
				else if( m.Hits != m.HitsMax )
				{
					from.SendMessage( 33, "Player's health must be full in order to be challenged, select again!");
					from.Target = new ChallengeTarget( pm, m_Item, i );
				}
				else if ( m.IsInChallenge )
				{
					from.SendMessage( 33, "That player is currently being invited into a challenge, select again!" );
					from.Target = new ChallengeTarget( pm, m_Item, i );
				}
				else if ( !m.CanBeChallenged )
				{
					from.SendMessage( 33, "That player is currently not accepting challenge invitations, select again!" );
					from.Target = new ChallengeTarget( pm, m_Item, i );
				}
				else
				{
					if( m_Item.Game == ChallengeGameType.OnePlayerTeam )
					{
						m_Item.AddOpponentPlayer( m );
						m.IsInChallenge = true;
						m.PublicOverheadMessage(MessageType.Regular, 1153, true, String.Format( ChallengeeFormat, from.Name ) );
						m.SendGump( new FinalGump( pm, m, m_Item ));
					}
					else if( m_Item.Game == ChallengeGameType.TwoPlayerTeam )
					{
						m.IsInChallenge = true;
						
						if(i < 2)
						{
							if(i == 0)
							{
								m_Item.ChallengeTeam.Add( m );
								m.PublicOverheadMessage(MessageType.Regular, 1153, true, String.Format( TeamFormat, from.Name ) );
							}
							if(i == 1)
							{
								m_Item.OpponentTeam.Add( m ); 
								m.PublicOverheadMessage(MessageType.Regular, 1153, true, String.Format( ChallengeeFormat, from.Name ) );
							}
							i++; 
							m.SendGump(new PartnerGump( pm, m_Item, i, m ));
						}
						else if( i == 2 )
						{
							m_Item.OpponentTeam.Add( m );
							m.PublicOverheadMessage(MessageType.Regular, 1153, true, String.Format( ChallengeeFormat, from.Name ) );
							m.SendGump( new FinalGump( pm, m, m_Item ) );
							i = 0;
						}
					}						
				}					
			}
		}
	}
}
 

Phantom

Knight
What exactly do you not know how to do, you want staff to be able to choose the compeditors, so do you have a staff command to do this?

If you have the staff command, have you removed the command/code so players cannot do it themselfs?
 

yuri99

Wanderer
that exactly what i want, except im not sure which command is the Player code, or where to insert the staff command.
 

Phantom

Knight
yuri99 said:
that exactly what i want, except im not sure which command is the Player code, or where to insert the staff command.

You have not posted all the files to the system in question, so I cannot really tell you exactly where to find the code, so going to tell you to look for code that sends the target.

The system in question might not use a command, I believe it uses a stone, so you might want to check there.
 

Joeku

Lord
If you want to make this into a command, you should use Commands.cs for reference. It has code in there that only gives access to GMs. Also it has the commands themselves in there, so you can learn how a command works. Hope this helps!
 
Top