Estou muito ausente do forum, e hoje me deparei com um probleminha quando fui ajudar uns amigos.
Queriamos fazer a inquisition Quest, real. E infelizmente não tenho tempo para criar scripts e acabei me matando para achar um que funcionasse.
Lembro que esse script é simples, mas você deverá usar o cerebro. Pois é um pouco complexo entender como implementa-lo.
Então irei compartilha aqui
ELe é dividido em duas partes que funcionam juntas. Para faze-lo funcionar deve apenas colocar as Actionids necessarias em seus devidos teleports. No exemplo dando ele não usa o teleport convencional e sim o teleport 9773 que é apenas a sprite.
Vamos aos scripts:
Acrescente em data/libs/050-function.lua (Ou parecido):
function doCreatureSayWithDelay(cid,text,type,delay,e,pcid) if delay<=0 then doCreatureSay(cid,text,type, false,pcid) else local func=function(pars) doCreatureSay(pars.cid,pars.text,pars.type, false,pars.pcid) pars.e.done=TRUE end e.done=FALSE e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e,pcid=pcid}) end end
Em movements adicione o inquisition.lua e adicione:
local config = { bosses={---actionid, posicao para onde ira, valor que colocara, texto de entrada [1001] = {pos={x=1173, y=1137, z=12, stackpos=1}, value=1, text="Entering The Crystal Caves"}, [1002] = {pos={x=1128, y=1151, z=12, stackpos=1}, value=2, text="Entering The Blood Halls"}, [1003] = {pos={x=1045, y=1204, z=13, stackpos=1}, value=3, text="Entering The Vats"}, [1004] = {pos={x=1152, y=1195, z=13, stackpos=1}, value=4, text="Entering The Arcanum"}, [1005] = {pos={x=1247, y=1295, z=12, stackpos=1}, value=5, text="Entering The Hive"}, [1006] = {pos={x=1064, y=1308, z=13, stackpos=1}, value=6, text="Entering The Shadow Nexus. All hope desapear!"} }, mainroom={---actionid, posicao que ira,menor valor de storage que poder entrar, texto de entrada [2001] = {pos={x=1173, y=1137, z=12, stackpos=1}, value=1, text="Entering The Crystal Caves"}, [2002] = {pos={x=1128, y=1151, z=12, stackpos=1}, value=2, text="Entering The Blood Halls"}, [2003] = {pos={x=1045, y=1204, z=13, stackpos=1}, value=3, text="Entering The Vats"}, [2004] = {pos={x=1152, y=1195, z=13, stackpos=1}, value=4, text="Entering The Arcanum"}, [2005] = {pos={x=1247, y=1295, z=12, stackpos=1}, value=5, text="Entering The Hive"} }, portals={---actionid,texto de entrada [3000] = {pos={x=1065, y=1086, z=14}, text="Entering Inquisition Portals Room"}, [3001] = {pos={x=1098, y=1214, z=12}, text="Entering The Ward of Ushuriel"}, [3002] = {pos={x=1185, y=1067, z=12}, text="Entering The Undersea Kingdom"}, [3003] = {pos={x=1130, y=1213, z=12}, text="Entering The Ward of Zugurosh"}, [3004] = {pos={x=1148, y=1127, z=12}, text="Entering The Foundry"}, [3005] = {pos={x=1113, y=1254, z=12}, text="Entering The Ward of Madareth"}, [3006] = {pos={x=1043, y=1133, z=13}, text="Entering The Battlefield"}, [3007] = {pos={x=1148, y=1254, z=12}, text="Entering The Ward of The Demon Twins"}, [3008] = {pos={x=1195, y=1201, z=13}, text="Entering The Soul Wells"}, [3009] = {pos={x=1187, y=1213, z=12}, text="Entering The Ward of Annihilon"}, [3010] = {pos={x=1193, y=1254, z=12}, text="Entering The Ward of Hellgorak"} }, storage=56123,---storage usado nos teleportes da sala central walkback="You don't have enough energy to enter this portal",---Messagem que aparece se vc nao poder entrar no teleport da sala central e={} }----nao modificar, se nao tiver o creaturesaywithdelay} function onStepIn(cid, item, position, fromPosition) if isPlayer(cid) == TRUE then if(config.bosses[item.actionid]) then local t= config.bosses[item.actionid] if getPlayerStorageValue(cid, config.storage)< t.value then setPlayerStorageValue(cid, config.storage, t.value) end doTeleportThing(cid, t.pos) doCreatureSayWithDelay(cid,t.text,19,1, config.e) elseif(config.mainroom[item.actionid]) then local t= config.mainroom[item.actionid] if getPlayerStorageValue(cid, config.storage)>=t.value then doTeleportThing(cid, t.pos) doCreatureSayWithDelay(cid,t.text,19,1,config.e) else doTeleportThing(cid, fromPosition) doCreatureSay(cid, config.walkback, 19) end elseif(config.portals[item.actionid]) then local t= config.portals[item.actionid] doTeleportThing(cid, t.pos) doCreatureSayWithDelay(cid,t.text,19,1,config.e) end end end
E em movements.xml:
<movevent type="StepIn" itemid="9773" event="script" value="inquisition.lua"/>
E em data/creaturescripts adicione o inquisition.lua e coloque:
local config = { timeToRemove = 180, -- segundos message = "Go into the teleport in 180 seconds, else it will disappear.", teleportId = 9773, bosses = { -- Nome do monstro, Posicao do teleporte ["Ushuriel"] = { pos={x=1097, y=1214, z=12, stackpos=1}, aid=1001 }, ["Zugurosh"] = { pos={x=1129, y=1213, z=12, stackpos=1}, aid=1002}, ["Madareth"] = { pos={x=1112, y=1254, z=12, stackpos=1}, aid=1003}, ["Annihilon"] = { pos={x=1187, y=1214, z=12, stackpos=1}, aid=1005}, ["Hellgorak"] = { pos={x=1192, y=1256, z=12, stackpos=1}, aid=1006} }, brothers ={ ["Golgordan"] = {pos={x=1147, y=1254, z=12, stackpos=1},aid=1004, brother = "Latrivan"}, ["Latrivan"] = {pos={x=1147, y=1254, z=12, stackpos=1},aid=1004, brother = "Golgordan"}, brothersArea ={ fromPos = {x = 1139, y = 1244, z = 12}, toPos = {x = 1155, y = 1254, z = 12} } } } local function change(position) doItemSetAttribute(getTileItemById(position, config.teleportId).uid, "aid", 3000) return TRUE end function onKill(cid, target, lastHit) if(config.bosses[getCreatureName(target)]) then local t = config.bosses[getCreatureName(target)] local position = t.pos doItemSetAttribute(getTileItemById(position, config.teleportId).uid, "aid", t.aid) doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1) addEvent(change, config.timeToRemove * 1000, position) elseif(config.brothers[getCreatureName(target)]) then local t = config.brothers[getCreatureName(target)] local brother = getCreatureByName(t.brother) if(isMonster(brother) == true) then if(isInRange(getCreaturePosition(brother), config.brothers.brothersArea.fromPos, config.brothers.brothersArea.toPos) == true) then return TRUE end else local position = t.pos doItemSetAttribute(getTileItemById(position, config.teleportId).uid, "aid", t.aid) doItemSetAttribute(teleport, "aid", t.aid) doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1) addEvent(removal, config.timeToRemove * 1000, position) end end return TRUE end
E em creaturescripts.xml:
<event type="kill" name="Inquisition" event="script" value="inquisition.lua"/>
E finalmente em cada boss da inquistion deve-se adicionar isso após:
</flags>
Este codigo:
<script> <event name="Inquisition"/> </script>
Explicando:
Os teleportes da sala principal deverão ter os Actionid respectivos no script. Sendo que cada um levará ao seu devido lugar apenas se o player já tiver passado nele. Quando o boss morre, o script modifica o teleporte para o player poder voltar para a sala principal.
-Todo teleporte de Boss deverá ter o actionid 3000 como default. Pois senão o player não poderá voltar.
-Existem maiores explicações no proprio arquivo.
Creditos:zakius