Player pack Upgrade

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

Player pack Upgrade

Post by dragon slayer »

Here is a script you can use to upgrade the player’s backpack weight and the number of items it can carry.

Place these scripts in your custom folder and add the line for the script number in jse_fileassociations.scp.
50101=Custom/packupgrade.js
[packwupgradedeed]
{
GET=base_item
NAME=Pack Weight Upgrade Deed
ID=0x1F23
MOREY=1
SCRIPT=50101
}

[packiupgradedeed]
{
GET=base_item
NAME=Pack Item Upgrade Deed
ID=0x1F23
MOREY=2
SCRIPT=50101
}
function onUseChecked(pUser, iUsed)
{
    var pSock = pUser.socket;
    var itemContainer = iUsed.container;
    if (itemContainer && itemContainer.serial == pUser.pack.serial)
    {
        pSock.tempObj = iUsed;
        pUser.CustomTarget(0, "Select your characters backpack to upgrade carring amount.");
    }
    else
    {
        pUser.SysMessage(GetDictionaryEntry(1763, pSock.Language)); //That item must be in your backpack before it can be used.
    }
    return false;
}

function onCallback0(pSock, ourObj)
{
    var pUser = pSock.currentChar;
    var iUsed = pSock.tempObj;
    //var playerspack = ourObj.FindItemLayer(0x15);

    if (iUsed.container && iUsed.container == pUser.pack)
    {
        if (!pSock.GetWord(1) && ourObj.isItem && pUser.pack && ourObj.layer == 0x15)
        {
            if (ourObj.container && ((ourObj.container == pUser) || (ourObj.container == pUser.pack))) {
                if (iUsed.morey == 1 && ourObj.weightMax != 60000)
                {
                    pSock.SysMessage("Your backpack has been upgraded weight amount.");
                    ourObj.weightMax = ourObj.weightMax + 2500;
                    ourObj.Refresh();
                    iUsed.Delete();
                    return;
                }
                else if (iUsed.morey == 2 && ourObj.maxItem != 200)
                {
                    pSock.SysMessage("Your backpack has been upgraded carrying amount.");
                    ourObj.maxItems = ourObj.maxItems + 25;
                    ourObj.Refresh();
                    iUsed.Delete();
                    return;
                }
                else
                {
                    pSock.SysMessage("Your pack is at cap max");
                    return false;
                }
            }
        }
        pSock.SysMessage("You can only use this on your pack");
        return;
    }
    else
    {
        pUser.SysMessage("Your no longer carrying the pack upgrade deed.");
        return;
    }
}
Post Reply