Lua: Getting ID # of a traded item
Posted: Sat Jun 28, 2014 12:34 am
I want to create an onTrade script for an NPC, that will do something like this...
I think my best way to do it is a for loop of x=0~179, and check if the player traded an item of ID 12107+x?
so maybe...
Or is there an easy way to fetch the IDs of all the items traded in our lua script?
Other questions:
Do we have lua functions to get all the data of an Item that was traded?
IE
What parts are we missing to do the above?
Finally, do we have a way to play animitations/effects through lua? If not, do we have easy functions to use in the source code to make a lua function for such a thing?
Just a simple Player->PlayEffect(x) so I could play effect x at player through code.
This would be great for custom game quests and effects and stuff.
Code: Select all
onTrade()
if (Totaltradeditems==5 and One of the items ID is >12107 and <12285 ) then
//Its a piece of ebon type gear)
ItemID= 12108 - (the itemID that is >12107 and <12285) //This value will be 0~179)
ItemSlot = math.floor(ItemID/36) //(0-4, 0=head,1=body,2=hands,3=legs,4=feet)
ItemRank = ItemID - (ItemSlot * 36)// (Value 0~35)
so maybe...
Code: Select all
for x=0 to 179 do
if itemTraded(x+12107) then
DoStuff()
EndIf
Next
Other questions:
Do we have lua functions to get all the data of an Item that was traded?
IE
OurItem = tradedItem[slot1]
Signature = OurItem->GetSignature()
What parts are we missing to do the above?
Finally, do we have a way to play animitations/effects through lua? If not, do we have easy functions to use in the source code to make a lua function for such a thing?
Just a simple Player->PlayEffect(x) so I could play effect x at player through code.
This would be great for custom game quests and effects and stuff.