• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[Example] ItemUpgrader

Foereaper

Founder
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:
hpb9.png


Selecting your desired upgrade item:
zPzQdV4.png


Retrieving your new item:
PiFYRW9.png



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

Mathias

Exalted Member
didnt knew this could be done so easy i made a wastly more complicated system for my server.
 

TheTwinkdude

Respected Member
how do u make it so it sends that QuestTemp and Multiple and more than one Required items ?
 
Last edited:

Foereaper

Founder
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.
 

Foereaper

Founder
Code:
--[[
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];
		end
	end
end

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)
			end
		end
	end
end

function ItemUpgrade.OnHello(event, player, original_item)
	player:GossipClearMenu()
	
	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]).."?")
		end
	end
	
	player:GossipSendMenu(1, player, 100)
end

function ItemUpgrade.OnSelect(event, player, original_item, sender, intid, code)
	local old_entry = intid
	local new_entry = ItemUpgrade.GetUpgradeEntry(old_entry)
	
	player:GossipComplete()
	-- 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)
end

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.
 
Upgrade item

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?
 

Foereaper

Founder
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.
 

lovekilz

Emulation Addict
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.
 

lovekilz

Emulation Addict
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
 
Top