Player pack Upgrade
Posted: Wed Aug 07, 2024 9:49 pm
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
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
}
{
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;
}
}
{
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;
}
}