Oneda
Aspiring Spriter
Hey guys! I've been developing my lua skills and I just finished a script which allows you to use your obsidian knife on alive creatures (which you can config. which creatures you would like to be skinnable when alive)
This version is still pretty simple, but could be used as a base for something more complex, I plan on adding the function of different creatures giving different products when skinned.
This version is still pretty simple, but could be used as a base for something more complex, I plan on adding the function of different creatures giving different products when skinned.
Lua:
local wool = {"Sheep", "Black Sheep"} -- Creatures configuration for the first table which gives wool when skinned
local leather = {"Deer", "Bear", "Rat"} -- Creatures configuration for the second table which gives minotaur leather when skinned (Should probably rename the item to leather by the way)
local dleather = {"Dragon", "Wyvern"} -- Creatures configuration for the third table which gives green dragon leather when skinned (Could also change this to green leather or something)
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if isCreature(target) and isInArray(wool, getCreatureName(target)) then
local tPos = getCreaturePosition(target)
doSendMagicEffect(tPos, 1) -- The magic effect that will be shown @ target's position when skinned.
player:addItem(11236, 3) -- Item which will be added when the mobs at "creature" table are skinned and its amount.
doCreatureAddHealth(target, -10)
elseif isCreature(target) and isInArray(leather, getCreatureName(target)) then
local tPos = getCreaturePosition(target)
doSendMagicEffect(tPos, 1) -- The magic effect that will be shown @ target's position when skinned.
player:addItem(5878, 3) -- Item which will be added when the mobs at "creature" table are skinned and its amount.
doCreatureAddHealth(target, -10)
elseif isCreature(target) and isInArray(dleather, getCreatureName(target)) then
local tPos = getCreaturePosition(target)
doSendMagicEffect(tPos, 1) -- The magic effect that will be shown @ target's position when skinned.
player:addItem(5877, 3) -- Item which will be added when the mobs at "creature" table are skinned and its amount.
doCreatureAddHealth(target, -10)
elseif isCreature(target) == false then
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You can only skin creatures.") -- The error message it will give if the player is trying to skin something that isn't a creature.
else
player:sendTextMessage(MESSAGE_STATUS_WARNING, "You cannot skin this creature.") -- The error message it will give if t he player is trying to skin a creature which isn't added in the configuration above.
return true
end
end
Last edited by a moderator: