Postado Março 9, 2013 12 anos Então e um pedido de Tutorial ou apenas mim ajudar e terminar esse aqui q vejo como eh e eu mesmo faço o tuto e posto aqui já abri um topico pra isso e venho dando up a seculos e nada então eu já comecei e não deu certo queria saber pqê .. Aqui a mod: <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="BattleField" version="1.0" author="Vodkart" contact="none.com" enabled="yes"> <config name="battle_func"><![CDATA[ battle_info = { Reward = {6571,1}, TeamOne = {name = "Black Assassins",storages = {130022,130302},pos = {x=31577,y=32473,z=7}}, TeamTwo = {name = "Red Barbarians",storages = {130023,130303},pos = {x=31542,y=32471,z=7}}, storage_count = 150304, tpPos = {x=32342,y=32213,z=7} } timer = { days = { {"Monday","10:00",20},{"Tuesday","21:55",2},{"Wednesday","21:55",2},{"Thursday","20:52",2},{"Friday","21:55",2},{"Saturday","21:55",2},{"Sunday","21:55",2} }, limit_Time = 10 -- em minutos } function OpenWallBattle() local B = { {3517,{x=31558, y=32475, z=6, stackpos = 1}}, {3517,{x=31558, y=32476, z=6, stackpos = 1}}, {3517,{x=31558, y=32477, z=6, stackpos = 1}}, {3517,{x=31558, y=32478, z=6, stackpos = 1}} } for i = 1, #B do if getTileItemById(B[2], B[1]).uid == 0 then doCreateItem(B[1], 1, B[2]) else doRemoveItem(getThingfromPos(B[2]).uid,1) end end end function resetBattle() return setGlobalStorageValue(battle_info.TeamOne.storages[2], 0) and setGlobalStorageValue(battle_info.TeamTwo.storages[2], 0) end function doBroadCastBattle(type,msg) local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, battle_info.TeamOne.storages[1]) == 1 or getPlayerStorageValue(cid, battle_info.TeamTwo.storages[1]) == 1 then table.insert(players, cid) end end for i = 1, #players do doPlayerSendTextMessage(players,type,msg) end return true end function removeTp() local t = getTileItemById(battle_info.tpPos, 1387) if t then doRemoveItem(t.uid, 1) doSendMagicEffect(battle_info.tpPos, CONST_ME_POFF) end end function getWinnersBattle(storage) local players,str = {},"" for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, storage) == 1 then table.insert(players, cid) end end str = str .. ""..#players.." Player"..(#players > 1 and "s" or "").." from team "..(getGlobalStorageValue(battle_info.TeamOne.storages[2]) == 0 and battle_info.TeamTwo.name or battle_info.TeamOne.name).." won the event battlefield, they received a "..battle_info.Reward[2].." "..getItemNameById(battle_info.Reward[1]).."!" for i = 1, #players do doPlayerAddItem(players, battle_info.Reward[1], battle_info.Reward[2]) doRemoveCondition(players, CONDITION_OUTFIT) doTeleportThing(players, getTownTemplePosition(getPlayerTown(players))) setPlayerStorageValue(players, storage, -1) end resetBattle() OpenWallBattle() return doBroadcastMessage(str) end function CheckEvent(delay) if delay > 0 and getGlobalStorageValue(battle_info.storage_count) > 0 then doBroadcastMessage("[battleField Event] We are waiting "..getGlobalStorageValue(battle_info.storage_count).." players to Battlefield starts") elseif delay == 0 and getGlobalStorageValue(battle_info.storage_count) > 0 then local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerStorageValue(cid, battle_info.TeamOne.storages[1]) == 1 or getPlayerStorageValue(cid, battle_info.TeamTwo.storages[1]) == 1 then table.insert(players, cid) end end for i = 1, #players do doRemoveCondition(players, CONDITION_OUTFIT) doTeleportThing(players, getTownTemplePosition(getPlayerTown(players))) setPlayerStorageValue(players, getPlayerStorageValue(players, battle_info.TeamOne.storages[1]) == 1 and battle_info.TeamOne.storages[1] or battle_info.TeamTwo.storages[1], -1) end doBroadcastMessage("The event cannot be started because not had enough players.") setGlobalStorageValue(battle_info.storage_count, 0) resetBattle() removeTp() end addEvent(CheckEvent, 60000, delay-1) end]]></config> <globalevent name="BroadEvento" interval="60000" event="script"><![CDATA[ domodlib('battle_func') function onThink(interval, lastExecution) for i = 1, #timer.days do if isInArray(timer.days[1], os.date("%A")) and isInArray(timer.days[2], tostring(os.date("%X")):sub(1, 5)) and (timer.days[3] % 2) == 0 then local tp = doCreateItem(1387, 1, battle_info.tpPos) doItemSetAttribute(tp, "aid", 45000) CheckEvent(timer.limit_Time) doBroadcastMessage("The event BattleField was opened and We are waiting "..timer.days[3].." Players! Team divided into "..((timer.days[3])/2).." VS "..((timer.days[3])/2)) return setGlobalStorageValue(battle_info.storage_count, timer.days[3]) end end return true end]]></globalevent> <event type="login" name="Check Map" event="script"><![CDATA[ domodlib('battle_func') function onLogin(cid) if getGlobalStorageValue(battle_info.TeamOne.storages[2]) == -1 then setGlobalStorageValue(battle_info.TeamOne.storages[2], 0) setGlobalStorageValue(battle_info.TeamTwo.storages[2], 0) setGlobalStorageValue(battle_info.storage_count, 0) end registerCreatureEvent(cid, "NoAttackBattle") registerCreatureEvent(cid, "BattleDeath") return true end]]></event> <event type="combat" name="NoAttackBattle" event="script"><![CDATA[ domodlib('battle_func') if isPlayer(cid) == true and isPlayer(target) == true then if (getPlayerStorageValue(cid, battle_info.TeamOne.storages[1]) >= 1 and getPlayerStorageValue(target, battle_info.TeamOne.storages[1]) >= 1) or (getPlayerStorageValue(cid, battle_info.TeamTwo.storages[1]) >= 1 and getPlayerStorageValue(target, battle_info.TeamTwo.storages[1]) >= 1) then doPlayerSendCancel(cid, "You may not attack your team mates.") return false end end return true]]></event> <event type="preparedeath" name="BattleDeath" event="script"><![CDATA[ domodlib('battle_func') function onPrepareDeath(cid, deathList, lastHitKiller, mostDamageKiller) if getPlayerStorageValue(cid, battle_info.TeamOne.storages[1]) >= 1 then setPlayerStorageValue(cid, battle_info.TeamOne.storages[1], -1) setGlobalStorageValue(battle_info.TeamOne.storages[2], getGlobalStorageValue(battle_info.TeamOne.storages[2])-1) doRemoveCondition(cid, CONDITION_OUTFIT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[battle Field] You Are Dead!") if getGlobalStorageValue(battle_info.TeamOne.storages[2]) == 0 then getWinnersBattle(battle_info.TeamTwo.storages[1]) else doBroadCastBattle(23,"[battleField Information] "..battle_info.TeamOne.name.." "..getGlobalStorageValue(battle_info.TeamOne.storages[2]).." VS "..getGlobalStorageValue(battle_info.TeamTwo.storages[2]).." " ..battle_info.TeamTwo.name) end else if getPlayerStorageValue(cid, battle_info.TeamTwo.storages[1]) >= 1 then setPlayerStorageValue(cid, battle_info.TeamTwo.storages[1], -1) setGlobalStorageValue(battle_info.TeamTwo.storages[2], getGlobalStorageValue(battle_info.TeamTwo.storages[2])-1) doRemoveCondition(cid, CONDITION_OUTFIT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "[battle Field] You Are Dead!") if getGlobalStorageValue(battle_info.TeamTwo.storages[2]) == 0 then getWinnersBattle(battle_info.TeamOne.storages[1]) else doBroadCastBattle(23,"[battleField Information] "..battle_info.TeamOne.name.." "..getGlobalStorageValue(battle_info.TeamOne.storages[2]).." VS "..getGlobalStorageValue(battle_info.TeamTwo.storages[2]).." " ..battle_info.TeamTwo.name) end end end return true end]]></event> <movevent type="StepIn" actionid="45000" event="script"><![CDATA[ domodlib('battle_func') local conditionBlack = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditionBlack, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditionBlack, {lookType = 134, lookHead = 114, lookBody = 114, lookLegs = 114, lookFeet = 114, addons = 3}) local conditionRed = createConditionObject(CONDITION_OUTFIT) setConditionParam(conditionRed, CONDITION_PARAM_TICKS, -1) addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, addons = 3}) function onStepIn(cid, item, position, fromPosition) if getPlayerAccess(cid) > 3 then doTeleportThing(cid, battle_info.TeamOne.pos) return false elseif getGlobalStorageValue(battle_info.storage_count) > 0 then setGlobalStorageValue(battle_info.storage_count, getGlobalStorageValue(battle_info.storage_count)-1) end if getGlobalStorageValue(battle_info.storage_count) >= 0 then if getGlobalStorageValue(battle_info.TeamOne.storages[2]) < getGlobalStorageValue(battle_info.TeamTwo.storages[2]) then setPlayerStorageValue(cid, battle_info.TeamOne.storages[1], 1) doAddCondition(cid, conditionBlack) setGlobalStorageValue(battle_info.TeamOne.storages[2], getGlobalStorageValue(battle_info.TeamOne.storages[2])+1) doTeleportThing(cid, battle_info.TeamOne.pos) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. battle_info.TeamOne.name .. "!") else setPlayerStorageValue(cid, battle_info.TeamTwo.storages[1], 1) doAddCondition(cid, conditionRed) setGlobalStorageValue(battle_info.TeamTwo.storages[2], getGlobalStorageValue(battle_info.TeamTwo.storages[2])+1) doTeleportThing(cid, battle_info.TeamTwo.pos) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You will join the team " .. battle_info.TeamTwo.name .. "!") end end if getGlobalStorageValue(battle_info.storage_count) == 0 then removeTp() doBroadcastMessage("Battlefield will start in 3 minutes, please create your strategy!") addEvent(doBroadcastMessage, 5*60*1000-500, "BattleField will begin now!") addEvent(OpenWallBattle, 3*60*1000) end return true end]]></movevent> </mod> e aqui oq fiz e não funcionou a parte! só mudei a parte do CDATA até </talkaction>! for i = 1, #players do doRemoveCondition(players[i], CONDITION_OUTFIT) doTeleportThing(players[i], getTownTemplePosition(getPlayerTown(players[i]))) setPlayerStorageValue(players[i], getPlayerStorageValue(players[i], battle_info.TeamOne.storages[1]) == 1 and battle_info.TeamOne.storages[1] or battle_info.TeamTwo.storages[1], -1) end doBroadcastMessage("The event cannot be started because not had enough players.") setGlobalStorageValue(battle_info.storage_count, 0) resetBattle() removeTp() end addEvent(CheckEvent, 60000, delay-1) end]]></config> <![CDATA[ domodlib('battle_func') function onSay(cid, words, param, channel) <talkaction words="/battle" access="5" event="script"> if(param == 'on') then for i = 1, #timer.days do local tp = doCreateItem(1387, 1, battle_info.tpPos) doItemSetAttribute(tp, "aid", 45000) CheckEvent(timer.limit_Time) doBroadcastMessage("The event BattleField was opened and We are waiting "..timer.days[i][3].." Players! Team divided into "..((timer.days[i][3])/2).." VS "..((timer.days[i][3])/2)) return setGlobalStorageValue(battle_info.storage_count, timer.days[i][3]) end end return true end]]></talkaction> <event type="login" name="Check Map" event="script"><![CDATA[ domodlib('battle_func') function onLogin(cid) if getGlobalStorageValue(battle_info.TeamOne.storages[2]) == -1 then setGlobalStorageValue(battle_info.TeamOne.storages[2], 0) setGlobalStorageValue(battle_info.TeamTwo.storages[2], 0) setGlobalStorageValue(battle_info.storage_count, 0) end Dou o comando a plavra não sai como c fosse uma talk mesmo mais nada acontece nem na distro ... /topico original :http://tibiaking.com/forum/topic/23705-modificacao-battlefield-script-advanced/ Editado Março 9, 2013 12 anos por Fausto32 (veja o histórico de edições) Procuro Equipe para projeto sério com remuneração, maior necessidade Programador em C\C++.
Postado Março 17, 2013 12 anos Autor @Sobe pomba, @Sobe pomba, @Sobe pomba, @Sobe pomba, @Sobe pomba, @Sobe pomba, @Sobe pomba, @Sobe pomba HelpME! Procuro Equipe para projeto sério com remuneração, maior necessidade Programador em C\C++.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.