View Full Version : [Example] ItemUpgrader

03-22-2014, 12:41 PM
A very basic Item Upgrade script I tossed together as a request.
- Will open a Gossip menu with all available items the player has to upgrade, and you can select which item you want to upgrade.
- It will then remove the old item, the token, and give you the new item.
- This can very easily be expanded on to say open an upgrade quest as an example instead of just giving the player the new item.
- Can be triggered either by a spell, or an item with a dummy spell. (ie: Hearthstone).

This is fully functional AS IS, but should be expanded on based on your personal needs.


Opening the upgrade menu:

Selecting your desired upgrade item:

Retrieving your new item:

Remember this is just an example. It is made to be expanded on by the end user to suit their needs.

03-22-2014, 01:42 PM
didnt knew this could be done so easy i made a wastly more complicated system for my server.

03-22-2014, 02:39 PM
how do u make it so it sends that QuestTemp and Multiple and more than one Required items ?

03-22-2014, 03:07 PM
The quest itself would set the requirement for multiple items required to upgrade the said item. The script only toggles the quest from the gossip menu. You would have to re-purpose the item table to contain a quest ID instead of the new item ID.

03-22-2014, 03:19 PM
ahhh okay , but could u give a quick example on how ? because my lua skill is awfull XD

03-22-2014, 03:26 PM
Config table. Set your UpgradeSpell if this will be used, your token ID,
and what items should be upgradeable and what said item upgrades to.

local ItemUpgrade = {
UpgradeSpell = 61335, -- Temp spell to test OnCast
UpgradeToken = 6948, -- Hearthstone, use dummy token
Upgradeable_Items = {
-- {ItemEntry, QuestEntry},
{2092, 12345},
-- End config table. Do not touch anything below unless you know what you're doing.

function ItemUpgrade.GetUpgradeEntry(original_entry)
for i = 1, #ItemUpgrade.Upgradeable_Items do
if ItemUpgrade.Upgradeable_Items[i][1] == original_entry then
return ItemUpgrade.Upgradeable_Items[i][2];

function ItemUpgrade.OnCast(event, player, spell, skipCheck)
if spell:GetEntry() == ItemUpgrade.UpgradeSpell then
for i = 1, #ItemUpgrade.Upgradeable_Items do
if player:HasItem(ItemUpgrade.Upgradeable_Items[i][1]) then
ItemUpgrade.OnHello(event, player, original_item)

function ItemUpgrade.OnHello(event, player, original_item)

for i = 1, #ItemUpgrade.Upgradeable_Items do
if player:HasItem(ItemUpgrade.Upgradeable_Items[i][1]) then
player:GossipMenuAddItem(0, "Upgrade "..GetItemLink(ItemUpgrade.Upgradeable_Items[i][1]), 0, ItemUpgrade.Upgradeable_Items[i][1], 0, "Are you sure you want to upgrade "..GetItemLink(ItemUpgrade.Upgradeable_Items[i][1]).."?")

player:GossipSendMenu(1, player, 100)

function ItemUpgrade.OnSelect(event, player, original_item, sender, intid, code)
local old_entry = intid
local new_entry = ItemUpgrade.GetUpgradeEntry(old_entry)

-- This automatically removes the old item and adds the new item. This could be replaced
player:RemoveItem(ItemUpgrade.UpgradeToken, 1)
player:SendQuestTemplate(new_entry, true)

RegisterPlayerEvent(5, ItemUpgrade.OnCast)
RegisterItemGossipEvent(ItemUpgrade.UpgradeToken, 1, ItemUpgrade.OnHello)
RegisterPlayerGossipEvent(100, 2, ItemUpgrade.OnSelect)

This is untested, you would have to set the upgradeable item in Upgradeable_Items table, and the second entry the quest ID.

03-22-2014, 06:52 PM
inb4 foereaper release a dota gamemode in Lua

03-23-2014, 09:48 AM

03-23-2014, 01:39 PM
cool idea.

03-24-2014, 05:50 PM
there is a little prob , when i click Accept nothing happes and i all the items i need ??

02-29-2016, 08:51 PM
Hey Foereaper Could you by any chance help me to make this trigger by item use instead of spell use. and make this require more stuff aswell as sending it as a questtemplate?

03-01-2016, 11:20 PM
Hey Foereaper Could you by any chance help me to make this trigger by item use instead of spell use. and make this require more stuff aswell as sending it as a questtemplate?

Probably not, I'm not necessarily interested to work on this script right now unfortunately. I am sure someone else might be able to help you, and if not it's a fairly simple script for you to start expanding on if you have little experience with Eluna.

Also, an item trigger is a spell trigger, the item requires a spell to be cast on use.

05-06-2016, 08:02 PM
Awesome job dude, but one question, when im trying to use multiple scripts as this one for different items, with 1 upgrade token i can upgrade in all scripts and it gets the items from the table in all the scripts.
I use 4 scripts like this one with different Upgrade tokens.

05-06-2016, 10:48 PM
Don't use separate scripts, modify a single script to accept more than a single type of token.

05-06-2016, 11:17 PM
dude, if i had any idea trust me i would have done it long time ago, for now im advancing in simple lua boss script, the thing you are talking about flyes over my head by far.
If you cound help me i would really apreciate it.

Or if you could do a lil update to this script : http://pastebin.com/BS3mTx1x , upgrade it to the newest eluna
Sorry for being to pushy or sounding like a beggar, it`s just that this saves me like 300 quests to make :-s
Thank you very much

05-07-2016, 01:54 AM
thx for share