Caduceus
Unknown Member
- Joined
- May 10, 2010
- Messages
- 321
- Solutions
- 2
- Reaction score
- 24
Server Version: TFS 1.2
Script seems to work fine with a standard 4 vocation setup. However when I try to add additional vocation to the lineup, I run into some issues.
error
script
Script seems to work fine with a standard 4 vocation setup. However when I try to add additional vocation to the lineup, I run into some issues.
error
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/custom/Vocation_addon.lua:onUse
data/actions/scripts/custom/Vocation_addon.lua:15: attempt to index local 'outfit' (a nil value)
stack traceback:
[C]: in function '__index'
data/actions/scripts/custom/Vocation_addon.lua:15: in function <data/actions/scripts/custom/Vocation_addon.lua:12>
script
Code:
local storage = 45554
local outfits = {
{female = 138, male = 130, addon = 3}, -- 1
{female = 148, male = 144, addon = 3}, -- 2
{female = 137, male = 129, addon = 3}, -- 3
{female = 139, male = 131, addon = 3}, -- 4
{female = 142, male = 134, addon = 3} -- 9 custom voc
}
local msg = ''
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(storage) == 2 then
local outfit = outfits[player:getVocation():getBase():getId()]
player:addOutfitAddon(outfit.female, outfit.addon)
player:addOutfitAddon(outfit.male, outfit.addon)
msg = "You received a free addon!"
player:setStorageValue(storage, 3)
else
msg = " The chest seems to be locked."
end
player:sendTextMessage(MESSAGE_INFO_DESCR, msg)
return true
end
Last edited: