problems with some code

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

problems with some code

Post by dragon slayer »

Okay here what i scripted.

Code: Select all

function onUseChecked( pUser, iUsed )
{
      var socket = pUser.socket;
      targX = socket.GetWord( 11 );
      targY = socket.GetWord( 13 ); 
      targZ = socket.GetSByte( 16 ) + GetTileHeight( socket.GetWord( 17 ) ); 
      var itemFound = FindItem( targX, targY, targZ, pUser.worldnumber, 0x0faf );
      if( itemFound && itemFound.x == targX && itemFound.y == targY ) 
      {
	if( socket && iUsed && iUsed.isItem )
	{
                iUsed.health -= 1;
                if(iUsed.health == 0)
                {
                  iUsed.Delete();
                  pUser.SysMessage( "You have worn out your tool!" );
	          return false;
                }
                else
		  socket.tempObj = iUsed;
		  var targMsg = GetDictionaryEntry( 445, socket.Language );
		  socket.CustomTarget( 1, targMsg );
	}
	return false;
      }
      else
         socket.SysMessage( "You must be near an anvil and a forge to smith items." );
	 return false;
}
i can't seem to get the function to check a range.

instead making char have to be right on top of anvil. I would like to make it have a range check so char can be like 2 spaces away from anvil.
Post Reply