CastorFlynn
Member
- Joined
- Aug 29, 2021
- Messages
- 88
- Reaction score
- 8
This script basically transforms construction kits into the respective items.
Could anyone help me modify it so that it performs the functions below?
-When using the construction kit it would transform into the item, but if I use the item it would return to being the construction kit.
-If use an item that is a container, it would only return to a construction kit if it is empty.
-The constructionKits table would accept more than one ID in the first parameter, considering items with rotation, for example something like: [1201,1202,1203,1204] = 3300 when using any of the items in the first parameter, it would return to being the construction kit
TFS 1.3+
Could anyone help me modify it so that it performs the functions below?
-When using the construction kit it would transform into the item, but if I use the item it would return to being the construction kit.
-If use an item that is a container, it would only return to a construction kit if it is empty.
-The constructionKits table would accept more than one ID in the first parameter, considering items with rotation, for example something like: [1201,1202,1203,1204] = 3300 when using any of the items in the first parameter, it would return to being the construction kit
TFS 1.3+
Lua:
local constructionKits = {
[3901] = 1666, [3902] = 1670, [3903] = 1652, [3904] = 1674, [3905] = 1658,
[3906] = 3813, [3907] = 3817, [3908] = 1619, [3909] = 12799, [3910] = 2105,
[3911] = 1614, [3912] = 3806, [3913] = 3807, [3914] = 3809, [3915] = 1716,
[3916] = 1724, [3917] = 1732, [3918] = 1775, [3919] = 1774, [3920] = 1750,
[3921] = 3832, [3922] = 2095, [3923] = 2098, [3924] = 2064, [3925] = 2582
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local kit = constructionKits[item.itemid]
if not kit then
return false
end
if fromPosition.x == CONTAINER_POSITION then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "Put the construction kit on the floor first.")
elseif not fromPosition:getTile():getHouse() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You may construct this only inside a house.")
else
item:transform(kit)
fromPosition:sendMagicEffect(CONST_ME_POFF)
player:addAchievementProgress('Interior Decorator', 1000)
end
return true
end