What does give your awesome swamp dragon armor. I'm sure we all love having are swamp dragons with armor.
Okay first i need you to make the deed its self. by adding this to your dfn scripts
[dragonbardingdeed]
{
NAME=dragon barding deed
ID=0x14F0
SCRIPT=4026
}
{
NAME=dragon barding deed
ID=0x14F0
SCRIPT=4026
}
dragonbardingdeed.js
function onUseChecked( pUser, iUsed )
{
var socket = pUser.socket;
if( socket && iUsed && iUsed.isItem )
{
var isInRange = pUser.InRange( iUsed, 3 );
if( !isInRange )
{
pUser.SysMessage( GetDictionaryEntry( 389, socket.Language ) ); // That is too far away and you cannot reach it.
return false;
}
socket.tempObj = iUsed;
pUser.socket.CustomTarget( 0, "Select the swamp dragon you wish to place the barding on." );
}
return false;
}
function onCallback0( pSock, myTarget )
{
var pUser = pSock.currentChar;
var StrangeByte = pSock.GetWord( 1 );
var tileID = pSock.GetWord( 17 );
if( !ValidateObject( myTarget ) || tileID == 0 )
{ //Target is invalid or a Maptile
pSock.SysMessage( "Select the swamp dragon you wish to place the barding on." );
}
else if( StrangeByte == 0 )
{
if( myTarget.isChar )
{ //Target is a Character
var isInRange = pUser.InRange( myTarget, 3 );
if( !isInRange )
{
pSock.SysMessage( GetDictionaryEntry( 461, pSock.Language ) ); // You are too far away.
return;
}
else if( myTarget.id == 0x031a )
TriggerEvent( 4025, "dragonbarding", pUser, myTarget );
else
pSock.SysMessage( "Select the swamp dragon you wish to place the barding on." );
return;
}
pSock.SysMessage( "Select the swamp dragon you wish to place the barding on." );
}
}
{
var socket = pUser.socket;
if( socket && iUsed && iUsed.isItem )
{
var isInRange = pUser.InRange( iUsed, 3 );
if( !isInRange )
{
pUser.SysMessage( GetDictionaryEntry( 389, socket.Language ) ); // That is too far away and you cannot reach it.
return false;
}
socket.tempObj = iUsed;
pUser.socket.CustomTarget( 0, "Select the swamp dragon you wish to place the barding on." );
}
return false;
}
function onCallback0( pSock, myTarget )
{
var pUser = pSock.currentChar;
var StrangeByte = pSock.GetWord( 1 );
var tileID = pSock.GetWord( 17 );
if( !ValidateObject( myTarget ) || tileID == 0 )
{ //Target is invalid or a Maptile
pSock.SysMessage( "Select the swamp dragon you wish to place the barding on." );
}
else if( StrangeByte == 0 )
{
if( myTarget.isChar )
{ //Target is a Character
var isInRange = pUser.InRange( myTarget, 3 );
if( !isInRange )
{
pSock.SysMessage( GetDictionaryEntry( 461, pSock.Language ) ); // You are too far away.
return;
}
else if( myTarget.id == 0x031a )
TriggerEvent( 4025, "dragonbarding", pUser, myTarget );
else
pSock.SysMessage( "Select the swamp dragon you wish to place the barding on." );
return;
}
pSock.SysMessage( "Select the swamp dragon you wish to place the barding on." );
}
}
function dragonbarding( pUser, dragon )
{
if( !dragon || !pUser )
return;
var pSock = pUser.socket;
// If dragon is already armored, do nothing
if( dragon.id == 0x031f )
pSock.SysMessage( "That is not an unarmored swamp dragon." );
if( dragon.owner == null )
pSock.SysMessage( "You can only put barding on a tamed swamp dragon that you own." );
else
{
pUser.SysMessage( "You place the barding on your swamp dragon. Use a bladed item on your dragon to remove the armor." );
pUser.UseResource( 1, 0x14F0 );
//dragon.SoundEffect( 0x0248, true );
// Change dragons id to armored dragon
dragon.id = 0x031f;
}
}
{
if( !dragon || !pUser )
return;
var pSock = pUser.socket;
// If dragon is already armored, do nothing
if( dragon.id == 0x031f )
pSock.SysMessage( "That is not an unarmored swamp dragon." );
if( dragon.owner == null )
pSock.SysMessage( "You can only put barding on a tamed swamp dragon that you own." );
else
{
pUser.SysMessage( "You place the barding on your swamp dragon. Use a bladed item on your dragon to remove the armor." );
pUser.UseResource( 1, 0x14F0 );
//dragon.SoundEffect( 0x0248, true );
// Change dragons id to armored dragon
dragon.id = 0x031f;
}
}
function removebarding( pUser, armoreddragon )
{
if( !armoreddragon || !pUser )
return;
var pSock = pUser.socket;
if( armoreddragon.owner == pUser )
pSock.SysMessage( "You cannot remove barding from a swamp dragon you do not own." );
else
{
// Change armored dragon id to swamp dragon
armoreddragon.id = 0x031a;
}
}
{
if( !armoreddragon || !pUser )
return;
var pSock = pUser.socket;
if( armoreddragon.owner == pUser )
pSock.SysMessage( "You cannot remove barding from a swamp dragon you do not own." );
else
{
// Change armored dragon id to swamp dragon
armoreddragon.id = 0x031a;
}
}
Go down and find this line of code
if( tileID == 0x00df || tileID == 0x00cf )
{
TriggerEvent( 2012, "shearSheep", mChar, ourObj );
return;
}
{
TriggerEvent( 2012, "shearSheep", mChar, ourObj );
return;
}
if( tileID == 0x031f )
{
TriggerEvent( 4027, "removebarding", mChar, ourObj );
return;
}
if( tileID == 0x031a )
{
socket.SysMessage( "You cannot remove barding from a swamp dragon you do not own." );
return false;
}
{
TriggerEvent( 4027, "removebarding", mChar, ourObj );
return;
}
if( tileID == 0x031a )
{
socket.SysMessage( "You cannot remove barding from a swamp dragon you do not own." );
return false;
}