Page 1 of 1

Dragon barding

Posted: Sun Mar 04, 2012 6:10 am
by dragon slayer
This script is dragon barding.
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
}
Then i need you to go in your custom js folder and make a new folder called dragon_barding and add this files in there and make sure you set the jse_fileassociations with all this file in it.

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." );
    }
}
dragonbarding.js
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;
    }
}
removebarding.js
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;
    }
}
Now you have to make some edits to swords.js in items folder
Go down and find this line of code
            if( tileID == 0x00df || tileID == 0x00cf )
            {
                TriggerEvent( 2012, "shearSheep", mChar, ourObj );
                return;
            }
After that code add this code
            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;
            }
Any questions just ask :)

Re: Dragon barding

Posted: Sun Mar 04, 2012 10:54 pm
by lustrianna
Woot! Ima try this out and post pics. :)

Re: Dragon barding

Posted: Mon Mar 05, 2012 12:14 am
by dragon slayer
still doesn't take the color of the ore you amke the deed att he moment. But you can script it to do differant ways you can even add maxhp to it. to give it more armor. or just add more def rating to it from its defualt rating :)

This script can aslo be used to make armored horses. just have it give more def and change the horses color to like a grey or something. or you can have its id changes the mondains horse make look like you gave it armor. but script is very flexiable

Re: Dragon barding

Posted: Wed Mar 07, 2012 7:35 pm
by lustrianna
i seem to be unable to locate or spawn via GM menu, a swamp dragon... maybe he hasent been added to the monster list yet? also. any chance you can make a horse barding script? i havent gotten that far in scripting yet.

Re: Dragon barding

Posted: Wed Mar 07, 2012 8:10 pm
by Xuri
Just fyi, you can spawn scripted items directly if you know their header-name (what's inside the [brackets]), without having to go through the GM menu. Use the following command:
'add item <itemheader>
So in this particular case, that would be:
'add item dragonbardingdeed