Anasayfa
UO Sunucular
Forumlar
Profilim
UO-Developer.COM
function onUseChecked( pUser, iUsed )
{
   var socket = pUser.socket;
        var numCannonballs = pUser.ResourceCount( 0x0E73 );

   if( socket && iUsed && iUsed.isItem )
   {
      //Check to see if it's locked down
      if( iUsed.movable == 2 || iUsed.movable == 3 )
      {
         socket.SysMessage( GetDictionaryEntry( 774, socket.Language ) ); //That is locked down and you cannot use it
         return false;
      }
      else if( pUser.isonhorse )
      {
         pUser.SysMessage( "You cannot use this while riding a mount." );
         return false;
      }
                if( numCannonballs >= 1)
                {
          if(pUser.GetTag("Cannon") == null || pUser.GetTag("Cannon") == 0)
          {
         socket.tempObj = iUsed;
         pUser.SetTag("Cannon", 1);
         
         //the addition of the false-flag in the TextMessage below tells the server to only
         //send the message to this character
         pUser.TextMessage("*You begin to load cannon...*", false );
         pUser.StartTimer(3000, 0, true);
           }
           else if(pUser.GetTag("Cannon") == 1)
           {
         pUser.SysMessage("You have to wait a few moments before you can use the cannon!");
           }
           else
         return true;
                }
                if ( numCannonballs < 1 )
                {
                   pUser.SysMessage( "You do not have any cannonballs." );
                   return false;
                }
   }
   return false;
}

function onCallback0( socket, myTarget)
{
   var pUser = socket.currentChar;
   var iUsed = socket.tempObj;

   if( !socket.GetWord( 1 ) && myTarget.isChar )
   {
      if( pUser.InRange( myTarget, 12 ))
      {
         if( myTarget.isonhorse )
         {
            myTarget.Dismount();
            pUser.DoAction( 0x9 );
            DoMovingEffect( pUser, myTarget, 0x0e73, 0x10, 0x00, false );
            myTarget.SysMessage( "You have been knocked off your mount!" );
                                myTarget.stamina = (myTarget.stamina -12);
                                myTarget.health = (myTarget.health -12);
                                pUser.UseResource( 1,  0x0E73 );
                                pUser.SoundEffect( 0x011c, true );
         }
         else
            DoMovingEffect( pUser, myTarget, 0x0e73, 0x10, 0x00, false );
                                myTarget.SysMessage( "You been hit by a cannon ball" );
                                myTarget.stamina = (myTarget.stamina -12);
                                myTarget.health = (myTarget.health -12);
                                pUser.UseResource( 1,  0x0E73 );
                                pUser.SoundEffect( 0x011c, true );
      }
      else
         pUser.SysMessage( "Your target is out of range." );
   }
   else
      pUser.SysMessage( "You cannot target that." );
}

function onTimer(pUser,timerID)
{
   var socket = pUser.socket;

   if(timerID == 0)
   {
      pUser.EmoteMessage( pUser.name + " lights fuse....");
      pUser.StartTimer(1000, 1, true);
   }

   if(timerID == 1)
   {
      pUser.SetTag("Cannon", null);
      socket.CustomTarget(0);
   }
}

UO-Dev SPONSOR

Paylaş

XFacebook

Faydalı mı?

Bu içerik size yardımcı oldu mu?

UO-Dev SPONSOR

Henüz yorum yapılmamış. Yorum yazabilmek için giriş yapmanız gerekir.

Üyelerin oylama ortalaması (10 dışında) :

Henüz Oylanmamış

Oylar: 0

Paylaş

XFacebook

Faydalı mı?

Bu içerik size yardımcı oldu mu?