pet Parrot V1.0

Got any custom JavaScript additions/tweaks you think other people would like to see? Post 'em here!
Post Reply
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

pet Parrot V1.0

Post by dragon slayer »

Update Fixed couple things would cause script to crash and not run.

This script will allow you to place a pet parrot on a Perch. Makes them invul and makes them frozen so they can not move. You can also release your pet as well or rename it but if you release it he will just be there forever LOL.

Add this to your items.dfn or your custom items.dfn

Code: Select all

[petparrot]
{ 
GET=base_item
NAME=pet parrot
ID=0x20EE
SCRIPT=5081
}
Here is the code the pet parrot uses when double clicked.
function onUseChecked ( pUser, iUsed )
{
  var socket = pUser.socket;
  socket.tempObj = iUsed;
  if( iUsed.container != null )
  {
     var targMsg = ( "Target the Parrot Perch you wish to place this Parrot upon." );
     socket.CustomTarget(0, targMsg );
  }
  else
   pUser.SysMessage( "That must be in your pack for you to use it." );
   return false;
}

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

     if( !socket.GetWord( 1 ) && myTarget.isItem )
     {
    if( myTarget.id == 0x2FF4 || myTarget.id == 0x2FF5 || myTarget.id == 0x2FB6 )
    {
        if( pUser.InRange( myTarget, 4 ))
        {
                   var nSpawned = SpawnNPC( "parrot", myTarget.x, myTarget.y, myTarget.z, myTarget.worldnumber );
                   if( nSpawned )
                   {
                     nSpawned.owner = pUser;
                     nSpawned.aitype = 0;
                     nSpawned.wandertype = 0;
                     nSpawned.frozen = 1;
                     nSpawned.vulnerable = 0;
                     nSpawned.z += 12;
                     iUsed.Delete();
                   }
        }
        else
           pUser.SysMessage( "You must be closer to the Parrot Perch to place the Parrot upon it." );
    }
    else
       pUser.SysMessage( "You must place the Parrot on a Parrot Perch." );
     }
     else
    pUser.SysMessage( "You must place the Parrot on a Parrot Perch." );
}

Code: Select all

[parrot]
{
NAME=a parrot
ID=0x011A
STR=41 71
DEX=47 77
INT=27 57
HPMAX=27 41
FAME=300
PARRYING=375
MAGICRESISTANCE=268 445
TACTICS=298 475
WRESTLING=298 475
DAMAGE=5 18
DEF=10
TOPROV=273
TOPEACE=273 5
TOTAME=591
TAMEDHUNGER=600 30
}
Last edited by dragon slayer on Sat Feb 25, 2012 7:53 pm, edited 1 time in total.
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Post by dragon slayer »

Here is the Parrot Npc script that will make the npc say random lines when you drop a cracker on it,

Added this script to the NPC Parrot not the wafer :)
function onDropItemOnNpc( pDropper, pDroppedOn, iDropped )
{
      pDroppedOn.TurnToward( pDropper );
      var parrotWafer = pDropper.ResourceCount( 0x2FD6 );
      if( parrotWafer >= 1)
      {
         switch( RandomNumber( 0, 6 ) )
         {
            case 0:pDroppedOn.TextMessage( "Wind in the sails!  Wind in the sails!" );
                   pDropper.SoundEffect( 0xBF, false );
                   pDropper.UseResource( 1, 0x2FD6, 0x38 );
                   return 0;break;
            case 1:pDroppedOn.TextMessage( "Arrrr, matey!" );
                   pDropper.SoundEffect( 0xC3, false );
                   pDropper.UseResource( 1, 0x2FD6, 0x38 );
                   return 0;break;
            case 2:pDroppedOn.TextMessage( "Loot and plunder!  Loot and plunder!" );
                   pDropper.SoundEffect( 0xBF, false );
                   pDropper.UseResource( 1, 0x2FD6, 0x38  );
                   return 0;break;
            case 3:pDroppedOn.TextMessage( "I want a cracker!" );
                   pDropper.SoundEffect( 0xC3, false );
                   pDropper.UseResource( 1, 0x2FD6, 0x38  );
                   return 0;break;
            case 4:pDroppedOn.TextMessage( "I'm just a house pet!" );
                   pDropper.SoundEffect( 0xBF, false );
                   pDropper.UseResource( 1, 0x2FD6, 0x38  );
                   return 0;break;
            case 5:pDroppedOn.TextMessage( "UOX3 is best emu!  UOX3 is best emu!" );
                   pDropper.SoundEffect( 0xBF, false );
                   pDropper.UseResource( 1, 0x2FD6, 0x38  );
                   return 0;break;
            case 6:pDroppedOn.TextMessage( "I love Xuri!  I love Xuri!" );
                   pDropper.SoundEffect( 0xBF, false );
                   pDropper.UseResource( 1, 0x2FD6, 0x38  );
                   return 0;break;
         }
      }
      else if( parrotWafer <= 1 )
      {
         return 0;
      }
      return 0;
}
Parrot Wafers

Code: Select all

[ParrotWafer]
{ 
GET=base_item
NAME=Parrot Wafers
ID=0x2FD6
COLOR=0x38
}
Post Reply