View Full Version : [SOLVED] Disable an item via C++ for a specific area

07-16-2014, 08:36 PM
Any way to disable a specific item (using the entry from item_template) for a specific areaid or zoneid using a C++ script?.

In the DB you can disable the only for arena and "disables" table cant be used with items.

Thanks, Eleinder.

07-16-2014, 09:01 PM
If the item has a spell you can disable that spell for the area and it would render the item useless, same could be done with C++ if the item has a spell.

It would be possible to prevent an item from being used/equipped though, although I'm not entirely sure how. I'll take a look in a few.

07-16-2014, 09:07 PM
Is a normal item, it do not use a spell. Maybe using an itemscript with bool onuse or onequip but im not sure.

Regards and thanks for the answer.

07-20-2014, 03:13 PM
So I have been trying first with a ItemScript with bool OnUse but seems to do not work with weapons and then I tried with a PlayerScript with void OnUpdateZone, so the player can't enter in the specific zone with the item equiped but If the player equip the item indise the zone nothings happens. Is there any way to check if the player has item equipped when he is inside the zone and automatically unequip the item or send to the bags or send to the mail?

Note that item 51392 has a correct scriptname http://gyazo.com/f9f1484800b06af5303787280539485d

07-20-2014, 03:16 PM
You need a core modification for on equip check.

It would help if we knew what item it was and if it has spells on equip etc.
In that case you could just check the spell cast of the on equip spell, then if that happens, teleport the player out if he is in wrong zone.

I see, it has no spells : |

07-20-2014, 08:01 PM
could you use something like this

like player script OnMapChanged()


// Called when a player enters the map.

// Called when a player leaves the map.

iterate though the equipment slots and remove the item if the player enters the map
then flag it

and remove the flag when they exit the map?

there must be a way to do this :/ i need something similar lol

07-20-2014, 09:14 PM
Like I said earlier, you could make a core modification for the on equip
Otherwise you could make a timer for the map / area / player, which checks if the item is equipped on the player or not.

Actually - you can prevent this with Eluna lua easily, easier than C++.

PLAYER_EVENT_ON_CAN_USE_ITEM = 31, // (event, player, itemEntry)
Use that player hook and return some error code (number) from InventoryResult Enum if the item entry and area match.

In addition to that you would need to prevent from having it equipped when entering the area.