Stackable Item Script

Here's a simple XtremeWorlds Script to make stackable items. It allows you to make an item stackable without making it a potion. This script is an example of doing it with nails so you can have multiple nails without having to have it taking up tons of inventory space.


Put this in Sub UseItem(Index)

 'the nails

Nails =GetVar("stackitems.ini", ConvertToString(GetPlayerLogin(Index))&"_"&ConvertToString(GetPlayerName(Index)), "Nails")

If Nails = "" Then Nails = 0

If ItemNum = 5 Then ' The Nails

If Nails >= 1 Then

If HasItem(Index, 5) >= 5 Then ' 5 Or more boards

Call TakeItem(Index, 5, 5) ' Takes the boards

Call GiveItem(Index, 6, 1) ' Gives the player a ladder

Call PlayerMsg(Index, "You make a ladder", C_WHITE)

Call PutVar("stackitems.ini", ConvertToString(GetPlayerLogin(Index))&"_"&ConvertToString(GetPlayerName(Index)), "Nails",""&Nails - 1)

Call PlayerMsg(Index, "You have "&Nails&" Nails left.", C_WHITE)

End If 

End If

If Nails = 0 Then

Call TakeItem(Index, 5, 1)

End If 

End If


'the nail box

If ItemNum = 12 Then

Call TakeItem(Index, 12, 1)

Call PutVar("stackitems.ini", ConvertToString(GetPlayerLogin(Index))&"_"&ConvertToString(GetPlayerName(Index)), "Nails",""&Nails + 50)

End If

 To buy nails you would sell boxes of nails from a normal in game store.

HTML Comment Box is loading comments...