Forum o Tibi w pamięci friziots.pun.pl
Jest to coś w stylu pokedex'a, czyli bierzemy use danym przedmiotem na potwora i wyświetlają nam się o nim bardzo dokładne informacje. Jeżeli skrypt Wam się spodoba mogę również dodać informację na temat summonów robionych przez potwora oraz informacje o jego atakach.
Oto skrypt:
data/actions/script/dex.lua
local config =
{
needQuestToUse = false, --true jeśli potrzeba questa aby używać
questStatus = 567890, -- wartość storage questa, jeśli wyżej true
showItem = 2148 --jaki item ma być widocznym w otwieranej książce
}
function onUse(cid, item, fromPos, itemEx, toPos)
local monsterInfo, loot, childLoot = {}, {}, {}
local monster = itemEx.uid
local infos = 0
local text, lootText, childLootText = "", "", ""
if(config.needQuestToUse == true) then
if(getPlayerStorageValue(cid, config.questStatus) == -1) then
doPlayerSendTextMessage(cid, 22, 'You need finish quest to use this item.')
return true
end
end
if(isMonster(monster) == false) then
doPlayerSendTextMessage(cid, 22, 'You can only use it on monsters.')
return true
end
infos = getMonsterInfo(getCreatureName(monster))
loot = infos.loot
childLoot = loot[#loot].child
for k, v in ipairs(loot) do
lootText = lootText..""..getItemNameById(v.id)..", chance: "..(tonumber(v.chance)/100)..'\n'
end
for k, v in ipairs(childLoot) do
childLootText = childLootText..""..getItemNameById(v.id)..", chance: "..(tonumber(v.chance)/100)..'\n'
end
monsterInfo =
{
' '..infos.name..'\n',
' Informations:\n\n',
'Health points: '..infos.healthMax..'\n',
'Experience: '..infos.experience..'\n',
'Speed: '..infos.baseSpeed..'\n',
'Armor: '..infos.armor..'\n',
'Defense: '..infos.defense..'\n\n',
' Special informations:\n\n',
'Summonable: '..convertBoolToString(infos.summonable)..'\n',
'Illusionable: '..convertBoolToString(infos.illusionable)..'\n',
'Convinceable: '..convertBoolToString(infos.convinceable)..'\n',
'Summonable: '..convertBoolToString(infos.summonable)..'\n\n',
' Loot:\n\n'..lootText..'\n',
' Loot in bag:\n\n'..childLootText
}
for k,v in ipairs(monsterInfo) do
text = text..""..v
end
doShowTextDialog(cid, config.showItem, text)
return true
end
function convertBoolToString(bool)
if(bool == true) then
return "Yes"
else
return "No"
end
endTeraz w data/actions/actions.xml dodajemy:
<action itemid="tutaj_id_item_ktory_ma_sprawdzac" event="script" value="dex.lua"/>
Offline