Dragon barding

Want to contribute to the Ultima Offline eXperiment? Submit your JS/DFN/Code fixes and/or other UOX3 improvements 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

Dragon barding

Post 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 :)
lustrianna
UOX3 Newbie
Posts: 21
Joined: Fri Mar 02, 2012 10:20 pm
Has thanked: 0
Been thanked: 0

Post by lustrianna »

Woot! Ima try this out and post pics. :)
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 »

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
lustrianna
UOX3 Newbie
Posts: 21
Joined: Fri Mar 02, 2012 10:20 pm
Has thanked: 0
Been thanked: 0

Post 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.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post 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
-= Ho Eyo He Hum =-
Post Reply