Nickolas Deluca
Member
- Joined
- Dec 7, 2016
- Messages
- 22
- Reaction score
- 6
Sorry if this is dumb, I'm still learning lua and how to make lua functions for my TFS 1.3 distro.
I decided to ditch the default reward system for TFS 1.3 and make my own, I want to give crystal coins as a reward and I want to give 10 CCs to the player.
Now, I already figured out how to get the items inside a chest, I just need to find out how to get the count of said item.
Here is what I wrote so far...
The function is still missing player messages but that's not an issue, I already know how to do it.
I don't want to hard code this amount inside the lua function because I'll be setting up the rewards inside the map and triggering their scripts using actionids and uniqueids.
What I need to do is find out how many coins I have inside that chest so that I can give that to the player.
Do you guys have any idea how to do it?
Also, is there a list of properties that an Item has? I already know about the list of functions available on TFS 1.3, but I'd like a simple list of properties for objects.
I decided to ditch the default reward system for TFS 1.3 and make my own, I want to give crystal coins as a reward and I want to give 10 CCs to the player.
Now, I already figured out how to get the items inside a chest, I just need to find out how to get the count of said item.
Here is what I wrote so far...
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local size = isContainer(item.uid) and getContainerSize(item.uid) or 0
for i = 0, size do
local tmp = getContainerItem(item.uid, i)
if(tmp.itemid > 0) then
player:addItem(tmp.itemid, 1)
end
end
return true
end
I don't want to hard code this amount inside the lua function because I'll be setting up the rewards inside the map and triggering their scripts using actionids and uniqueids.
What I need to do is find out how many coins I have inside that chest so that I can give that to the player.
Do you guys have any idea how to do it?
Also, is there a list of properties that an Item has? I already know about the list of functions available on TFS 1.3, but I'd like a simple list of properties for objects.