Ainda é preciso testar tudo pra ver se estão funcionando corretamente.
Esse script adiciona ao player uma bp com os items do monster dentro.
creaturescripts/creaturescripts.xml
<event type="death" name="Loot" event="script" value="loot.lua"/>
creaturescripts/scripts/loot.lua
-- by Kydrai
local function getLoot(cid, container, bp)
for i=0, getContainerCap(container.uid)-1 do
local loot = getContainerItem(container.uid, 0)
-- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Loot.itemid = "..loot.itemid)
if loot.itemid ~= 0 then
if isContainer(loot.uid) then
local loot2 = getLoot(cid, loot, doCreateItemEx(loot.itemid))
doAddContainerItemEx(bp, loot2)
doRemoveItem(loot.uid)
else
local qnt = loot.type > 0 and loot.type or 1
doRemoveItem(loot.uid, qnt)
doAddContainerItem(bp, loot.itemid, qnt)
end
else
return bp
end
end
end
local function autoloot(cid, corpsePos)
local bp = doPlayerAddItem(cid, 1988) -- bp onde será add os items
local loot = getLoot(cid, getThingfromPos(corpsePos), bp)
doAddContainerItemEx(bp, loot)
end
function onDeath(cid, corpse, deathList)
addEvent(autoloot, 100, deathList[1], getCreaturePosition(cid))
return TRUE
end
monstername.xml
<script>
<event name="Loot"/>
</script>
Modificado e entregue pelo msn.
talkactions/talkactions.xml
<talkaction words="/open;/close" event="script" value="tile.lua"/>
talkactions/scripts/tile.lua
function onSay(cid, words, param, channel)
if words == "/open" then
setGlobalStorageValue(5001, 1)
else
setGlobalStorageValue(5001, 0)
end
return TRUE
end
movements/movements.xml
<movevent type="StepIn" actionid="2003" event="script" value="tile.lua"/>
movements/scripts/tile.lua
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getGlobalStorageValue(5001) <= 0 then
doTeleportThing(cid, fromPosition, false)
doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The tile seems to be protected against unwanted intruders.")
end
return TRUE
end
Entregue pelo msn.