Boba ? isso e um Ótimo sistema usados em Servidores derivados, tem como fazer um ótimo proveito desse código, podendo dar use em Ossos e criar esqueletos.
So uma duvida ira funcionar em vários objetos ou em só nos oque eu configurar aqui?
specialItems = {}, -- items que mesmo não sendo "movable" que podem ganhar vida Ocorreu um erroVocê já atingiu seu limite de reputações positivas para hoje











info
Grupo: Visconde
Registrado: 21/04/08
Posts: 311
Reputação: +257
Inanimate Object
Bom venho trazer mais um script, sei que a idéia é meio boba, mais sei la, não tinha oque fazer, é o seguinte, vc pega uma pedra(configurado para o id: 8310) e dá use num objeto, espadas, armaduras, escudos, objetos de casa, qualquer o objeto que seje "moveable" ou seja objetos que vc pode arrastar, então o objetos tomara vida e sera seu summon, o atk e a vida dele, ira basear no seu level, quando o summon morre, o item volta ao normal aonde o summon morreu, é isso kkk, caso vc queira dar vida á algum objeto que não seja "moveable" tipo arvores, flores, etc, vc configura na tabela, e caso vc não quer que um item que é "moveable" ganhe vida, só configurar tbem, esta tudo comentado no script, para configurar do seu jeito, primeiramente vc deve criar o monstro.
inanimate object.xml
tag:
segundo passo crie outro xml, mais na pasta mod e cole o código:
inanimateObject.xml
<?xml version="1.0" encoding="UTF-8"?> <mod name="inanimateObject" enabled="yes" author="Miiller" forum="XTibia.com"> <config name="inanimateObjectLib"><![CDATA[ InanimateCfg = { levelForUse = 1, -- level para usar premium = false, -- somente premium pz = false, -- pode dar vida a objetos em pz house = false, -- pode dar vida a objetos em casas maxSummon = 1, -- maximo de summons specialItems = {}, -- items que mesmo não sendo "movable" que podem ganhar vida blockItems = {}, -- items que são "movable" mas não podem ganhar vida restoreItem = true, -- depois que o summon morre, restaurar o item } function object_attack(cid, object) if not isCreature(cid) or not isCreature(object) then return true end if getCreatureTarget(cid) > 0 then if getDistanceBetween(getThingPos(getCreatureTarget(cid)), getThingPos(object)) == 1 then doTargetCombatHealth(object, getCreatureTarget(cid), COMBAT_PHYSICALDAMAGE, -(getPlayerLevel(cid)/4), -(getPlayerLevel(cid)/2), CONST_ME_BLOCKHIT) end end addEvent(object_attack, 2000, cid, object) end ]]></config> <action itemid="8310" event="script"><![CDATA[ domodlib("inanimateObjectLib") function onUse(cid, item, frompos, item2, topos) if getPlayerLevel(cid) < InanimateCfg.levelForUse then return doPlayerSendCancel(cid, "You need level " .. InanimateCfg.levelForUse .. " for give life to an object.") end if not isPremium(cid) and InanimateCfg.premium then return doPlayerSendCancel(cid, "You need premium for give life to an object.") end if not isItemMovable(item2.itemid) and not isInArray(InanimateCfg.specialItems, item2.itemid) or isCorpse(item2.uid) or isCreature(item2.uid) or isInArray(InanimateCfg.blockItems, item2.itemid) then return doPlayerSendCancel(cid, "This object can not gain life.") end if #getCreatureSummons(cid) >= InanimateCfg.maxSummon then return doPlayerSendCancel(cid, "You already have many summons.") end if getPlayerItemCount(cid, item2.itemid) > 0 then return doPlayerSendCancel(cid, "Please, place this object in ground.") end if getTileHouseInfo(topos) and not InanimateCfg.house then return doPlayerSendCancel(cid, "This object can not gain life in house.") end if getTilePzInfo(topos) and not InanimateCfg.house then return doPlayerSendCancel(cid, "This object can not gain life in protection zone.") end local obj = doCreateMonster("Inanimate Object", topos) doConvinceCreature(cid, obj) setCreatureMaxHealth(obj, getPlayerLevel(cid)*2) doCreatureAddHealth(obj, getPlayerLevel(cid)*2) doSetItemOutfit(obj, item2.itemid) doSendMagicEffect(getThingPos(obj), 30) if InanimateCfg.restoreItem then doCreatureSetStorage(obj, 3214, item2.itemid) doCreatureSetStorage(obj, 3215, item2.type == 0 and 1 or item2.type) registerCreatureEvent(obj, "restoreItemSummonObj") end doRemoveItem(item.uid, 1) doRemoveItem(item2.uid, item2.type == 0 and 1 or item2.type) object_attack(cid, obj) return true end ]]></action> <creaturescript type="death" name="restoreItemSummonObj" event="script"><![CDATA[ function onDeath(cid, corpse, deathList) doCreateItem(getCreatureStorage(cid, 3214), getCreatureStorage(cid, 3215), getThingPos(cid)) doSendMagicEffect(getThingPos(cid), 30) return true end ]]></creaturescript> </mod>e acabou, as configurações esta no xml da pasta mod:
InanimateCfg = { levelForUse = 1, -- level para usar premium = false, -- somente premium pz = false, -- pode dar vida a objetos em pz house = false, -- pode dar vida a objetos em casas maxSummon = 1, -- maximo de summons specialItems = {}, -- items que mesmo não sendo "movable" que podem ganhar vida blockItems = {}, -- items que são "movable" mas não podem ganhar vida restoreItem = true, -- depois que o summon morre, restaurar o item }configura do seu jeito kk
só pegar o item 8310, e usar nos objetos, fico mto leegal kkkk
fui