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

is it possible to auto equip gear in lua?

Status
Not open for further replies.

Ghostcrawler336

Epic Member
Hello everyone,

I was wondering if it was possible to make a lua multi vendor(I have the core mod which allows multi vendors), which will auto equip a players gear / weapons?

Or maybe in C++?

Thank you,
Ghostcrawler336.
 

slp13at420

Mad Scientist
k first question is what is a multivendor?

for Eluna you can use player:EquipItem(xx, yy)
xx is the item id
yy is inventory slot(0-18) for equipped gear slots.(http://collab.kpsn.org/display/tc/Character+inventory+tc2#Characterinventorytc2-slot)

Code:
{ "EquipItem", &LuaPlayer::EquipItem },   // :EquipItem(entry/item, slot) - Equips given item or item entry for player to given slot. Returns the equipped item or nil
maybe a vendor that when player selects a group of armor thru the gossip menu it checks if they meet the criteria then loop the player:EquipItem method and draw the id's from a table kinda like my dynamic vendor in the donator releases.
 

Rochet2

Moderator / Eluna Dev
Multivendor allows one NPC to show different vendor windows depending on which gossip option is clicked.

Would the bought items from vendor be auto equipped?
What about if a player has an item already equipped?

For eluna..
As you buy an item, you will get an item to your inventory. You can give EquipItem that item object.
Note that there is no item swap method .. yet, so you cant exactly swap the bought item with an equipped item.
( no way to move an item within inventory )

In C++ you can check out the item equip and or item move opcode handlers for the functions to use.

The hard part here is that you have ONE vendor, which should have special things to be done on buy.
There are no on buy hooks for C++ side and you would need to code a single special case (hard code) to the vendor system..
 

Ghostcrawler336

Epic Member
k first question is what is a multivendor?

for Eluna you can use player:EquipItem(xx, yy)
xx is the item id
yy is inventory slot(0-18) for equipped gear slots.(http://collab.kpsn.org/display/tc/Character+inventory+tc2#Characterinventorytc2-slot)

Code:
{ "EquipItem", &LuaPlayer::EquipItem },   // :EquipItem(entry/item, slot) - Equips given item or item entry for player to given slot. Returns the equipped item or nil
maybe a vendor that when player selects a group of armor thru the gossip menu it checks if they meet the criteria then loop the player:EquipItem method and draw the id's from a table kinda like my dynamic vendor in the donator releases.

Hmm I'll give it a try, thank you!

Multivendor allows one NPC to show different vendor windows depending on which gossip option is clicked.

Would the bought items from vendor be auto equipped?
What about if a player has an item already equipped?

For eluna..
As you buy an item, you will get an item to your inventory. You can give EquipItem that item object.
Note that there is no item swap method .. yet, so you cant exactly swap the bought item with an equipped item.
( no way to move an item within inventory )

In C++ you can check out the item equip and or item move opcode handlers for the functions to use.

The hard part here is that you have ONE vendor, which should have special things to be done on buy.
There are no on buy hooks for C++ side and you would need to code a single special case (hard code) to the vendor system..


Thank you for explaining that. And thank you, I also plan to use this as a "starter vendor" so players will start with no gear on. And they can go talk to this vendor, and it will auto equip there gear.
 
Status
Not open for further replies.
Top