Ir para conteúdo

Featured Replies

  • Respostas 52
  • Visualizações 11k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • luanluciano93
    luanluciano93

    Tópico aprovado, obrigado por compartilhar. Este tópico foi movido: Para: "OTServ → Scripting → Sistemas e MODs" Esta horrivel esse código, se possível indentar o código e usar o "code" do bbcode.

  • Se ele moveu é porque seu tópico foi aprovado e movido para área correta... meu deus.

  • @Tiodarsaa   Tenta ai:   vai em creaturescripts/scripts/login.lua procure por onLogin Abaixo dessa linha adicione o seguinte código: local pos = { fromPos = {x= 994

  • 1 year later...
Postado
Em 13/08/2015 em 17:43, Sekk disse:

Bom, procurei esse Castle por MUITO TEMPO, mas não achei em NENHUM LUGAR DA INTERNET. Ontem, eu estava vendo alguns mapas do @Deathrocks, e vi nos prints, que o mapa possuia o evento que eu queria!

 

Então baixei o mapa e extrai o evento, então venho lhes trazer!

 

 

Nome: Castle 24H

Cliente: 8.6

Versão TFS: 0.4

Tipo: Evento

 

Bom, para começar, vamos em actions/scripts e crie 2 arquivos:

 

castledoor1.lua

  Ocultar conteúdo


function onUse(cid, item, frompos, item2, topos)

        local config =
        {
                STORAGE_GUILD = 123123, -- A 3ª storage configurada em Castle.lua
                MSG_WELCOME = "Seja bem vindo a vosso castelo!",
                MSG_FAIL = "Este castelo nao pertence a sua guild"
        }

        if getPlayerGuildId(cid) == getGlobalStorageValue(config.STORAGE_GUILD) then
                doTeleportThing(cid,getThingPos(item.uid))
                doTransformItem(item.uid, 1230)
                doPlayerSendTextMessage(cid, 22, config.MSG_WELCOME)  
        else
                doPlayerSendTextMessage(cid, 22, config.MSG_FAIL)
    end

        return true
end

 

 

castlewar1.lua

  Ocultar conteúdo


function onUse(cid, item, frompos, item2, topos) 

local castle_one_name = "Castle24h"                  -- Nome do castelo 1
local storages = {154154,54321,123123}               -- Storages ( se vc eh iniciante, deixe como está...)

local premio_por_vezes = 1         -- Premio por vezes de conquista de castelo. (1) = Ativo  (0) = Desativa. 
local premio_vezes = 15            -- Caso ativo, a quantidade de conquista que o player tem, para ganhar PREMIO.
local premio = 5468                -- ID do Premio
local premio_cont = 1              -- Quantidade do Premio
local premio_reset = 1             -- Resetar o contador do premio depois que atingir a meta?? (1) = SIM  (0) = NAO

local sto_ativ = getGlobalStorageValue(storages[2])
position = getCreaturePosition(cid)


   if isPlayerGuild(cid) == TRUE then
      if sto_ativ == 1 or sto_ativ == -1 then

         guildname = getPlayerGuildName(cid)     
         guild = getPlayerGuildId(cid)               
         guild_sto = getGlobalStorageValue(storages[3])
                  
            if guild ~= guild_sto then            
               setPlayerStorageValue(cid,guild_sto,guild)                      
               if getPlayerStorageValue(cid,storages[1]) == -1 then
                  setPlayerStorageValue(cid,storages[1],0)
               end
               
               sto_vezes = getPlayerStorageValue(cid,storages[1])                   
               
               setGlobalStorageValue(storages[3],getPlayerGuildId(cid))
               setPlayerStorageValue(cid,storages[1], sto_vezes + 1)
               
               sto_vezes_total = getPlayerStorageValue(cid,storages[1])
                        
               doBroadcastMessage("O(a) "..getCreatureName(cid).." acabou de conquistar o castelo "..castle_one_name.." para a guild \""..guildname.."\" pela "..sto_vezes_total.."ª vez(s).", 22)
               doSendMagicEffect(position, 39)  
                 
                 if premio_por_vezes == 1 then
                    if getPlayerStorageValue(cid,storages[1]) == premio_vezes then
                       if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
                          doBroadcastMessage("O "..getCreatureName(cid).." ganhou uma(o) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!", 21)
                          doPlayerAddItem(cid, premio,premio_cont)
                          doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
                        -----------------------------------------------  --  
                            if premio_reset == 1 then                    --
                               setPlayerStorageValue(cid,storages[1],0)  --  Resetar a contagem
                            end                                          --
                        -----------------------------------------------  --
                        
                       else
                       doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Vamos verificar novamente em 10 segundos!")
                       addEvent(additem,10000,cid,premio,premio_cont,premio_reset)
                       end
                    end                                        
                 end               
            else
              doPlayerSendCancel(cid,"Este castelo ja foi conquistado pela sua guild!")
              doSendMagicEffect(position, 2)
            end
      else
      doPlayerSendCancel(cid,"O sistema está desativado")
      end      
   else
   doPlayerSendCancel(cid,"É nescessario ter guild para dominar o castelo!")
   doSendMagicEffect(position, 2)
   end
end

function additem(cid,premio,premio_cont,premio_reset)

 if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
    doPlayerAddItem(cid, premio,premio_cont)
    doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
     if premio_reset == 1 then
        setPlayerStorageValue(cid,storages[1],0)
     end
    stopEvent(additem)
  else
  doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Verificando novamente em 10 segundos!")
  addEvent(additem,10000,cid)
  end
end

function isPlayerGuild(cid)
if getPlayerGuildName(cid) ~= "" then
return TRUE
else
return FALSE
end
end

 

 

 

Agora em actions.xml adicione as tags:

  Ocultar conteúdo



<!-- Castle 24Hrs -->
        <action actionid="9999" event="script" value="castlewar1.lua"/>
        <action actionid="4538" event="script" value="castledoor1.lua"/>

 

 

Agora em monster/traps crie 3 arquivos:

 

porta.xml

  Ocultar conteúdo


<?xml version="1.0" encoding="UTF-8"?>
<monster name="Castle" nameDescription="a Gate" race="undead" experience="25000" speed="0" manacost="0">
<health now="400000" max="400000"/>
<look typeex="9408"/>
<targetchange interval="5000" chance="20"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="0"/>
<flag canpushcreatures="1"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="100"/>
<flag hidehealth="0"/>
</flags>
<attacks>
<attack name="melee" interval="50000" skill="0" attack="0"/>
</attacks>
<defenses armor="1" defense="1"/>
<immunities>
<immunity physical="0"/>
<immunity energy="0"/>
<immunity fire="0"/>
<immunity poison="0"/>
<immunity ice="0"/>
<immunity holy="0"/>
<immunity death="0"/>
<immunity lifedrain="1"/>
<immunity manadrain="1"/>
<immunity paralyze="1"/>
<immunity drunk="1"/>
<immunity outfit="1"/>
<immunity invisible="1"/>
</immunities>
<loot>
<item id="2148" countmax="20" chance="100000"/><!-- gold coin -->
</loot>
</monster>

 

protectcastle.xml
  Ocultar conteúdo


<?xml version="1.0" encoding="UTF-8"?>
<monster name="Protect Castle" nameDescription="a Protect Castle" race="undead" experience="25000" speed="0" manacost="0">
<health now="110000" max="110000"/>
<look typeex="9779"/>
<targetchange interval="5000" chance="20"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="0"/>
<flag canpushcreatures="1"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="100"/>
<flag hidehealth="0"/>
</flags>
<attacks>
<attack name="energy" interval="2000" chance="100" target="3" range="10" radius="3" min="-200" max="-250">
<attribute key="areaEffect" value="teleport"/>
<attribute key="shootEffect" value="energyball"/>
</attack>
<attack name="fire" interval="2000" chance="100" target="3" range="10" radius="4" min="-200" max="-250">
<attribute key="areaEffect" value="fireattack"/>
<attribute key="shootEffect" value="energyball"/>
</attack>
</attacks>
<defenses armor="1" defense="1"/>
<immunities>
<immunity physical="0"/>
<immunity energy="1"/>
<immunity fire="1"/>
<immunity poison="0"/>
<immunity ice="0"/>
<immunity holy="0"/>
<immunity death="0"/>
<immunity lifedrain="1"/>
<immunity manadrain="1"/>
<immunity paralyze="1"/>
<immunity drunk="1"/>
<immunity outfit="1"/>
<immunity invisible="1"/>
</immunities>
<loot>
<item id="10313" countmax="1" chance="100000000"/><!-- gold coin -->
</loot>
</monster>

 

statue.xml
  Ocultar conteúdo


<?xml version="1.0" encoding="UTF-8"?>
<monster name="Protect Statue" nameDescription="a Protect Statue" race="undead" experience="15000" speed="0" manacost="0">
<health now="100000" max="100000"/>
<look typeex="11720"/>
<targetchange interval="5000" chance="20"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="0"/>
<flag canpushcreatures="1"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="100"/>
<flag hidehealth="0"/>
</flags>
<attacks>
<attack name="melee" interval="1000" skill="40" attack="40"/>
<attack name="fire" interval="1000" chance="100" range="7" min="-50" max="-100">
<attribute key="shootEffect" value="fire"/>
<attribute key="areaEffect" value="yellowspark"/>
</attack>
</attacks>
<defenses armor="1" defense="1"/>
<immunities>
<immunity physical="0"/>
<immunity energy="0"/>
<immunity fire="0"/>
<immunity poison="0"/>
<immunity ice="0"/>
<immunity holy="0"/>
<immunity death="0"/>
<immunity lifedrain="1"/>
<immunity manadrain="1"/>
<immunity paralyze="1"/>
<immunity drunk="1"/>
<immunity outfit="1"/>
<immunity invisible="1"/>
</immunities>
<loot>
<item id="2148" countmax="20" chance="100000"/><!-- gold coin -->
</loot>
</monster>

 

Agora em monsters.xml adicione as tags:
  Ocultar conteúdo


<monster name="Protect Statue" file="Traps/statue.xml"/>
<monster name="Castle" file="Traps/porta.xml"/>
<monster name="Protect Castle" file="Traps/protectcastle.xml"/>
 

 

Vamos para movements/scripts e crie 2 arquivos:

 

castlewar2.lua

  Ocultar conteúdo


function onStepIn(cid, item, position, fromPosition)


local castle_one_name = "Castle24H"   -- Nome do castelo 1
local storages = {154154,54321,123123}    -- Storages ( se vc eh iniciante, deixe como est&#225;...)




local sto_ativ = getGlobalStorageValue(storages[2])
position = getCreaturePosition(cid)




   if isPlayerGuild(cid) == TRUE then
 if sto_ativ == 1 or sto_ativ == -1 then


guildname = getPlayerGuildName(cid) 
guild = getPlayerGuildId(cid) 
guild_sto = getGlobalStorageValue(storages[3])


if guild ~= guild_sto then 


  doBroadcastMessage("O(a) Jogador "..getCreatureName(cid)..". Esta Tentando Invadir O "..castle_one_name.." Da Guild \""..guildname..". Aviso Donos Atuais", 22) 




else
 doPlayerSendCancel(cid,"Avance")
end
 else
 doPlayerSendCancel(cid,"Avance")
 end 
   else
   doPlayerSendCancel(cid,"Avance")
   end
   return true
end




function isPlayerGuild(cid)
if getPlayerGuildName(cid) ~= "" then
return TRUE
else
return FALSE
end
end

 

level.lua
  Ocultar conteúdo


function onStepIn(cid, item, position, fromPosition)

level = 300

if getPlayerLevel(cid) < level then
doTeleportThing(cid, fromPosition, true)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doPlayerSendCancel(cid,"Somente level " .. level .. " ou mais podem passar aqui.")
end
return TRUE
end

 

Agora em movements.xml adicione as tags:
  Ocultar conteúdo


<movevent type="StepIn" actionid="9998" event="script" value="castlewar2.lua"/>
<movevent type="StepIn" actionid="9995" event="script" value="level.lua"/>

 

 

Pronto. Agora você só precisa baixar o mapa, inserir o mesmo ao seu servidor, configurar os teleports, e as hunts dentro do castle etc.

 

PRINTS:

1ª parte

  Ocultar conteúdo

ndssah.png

 

2ª parte:

  Ocultar conteúdo

2yys5mb.png

 

Obs.: Todos os ActionID e monsters já estão no mapa! Você só precisa configurar as coordenadas dos teleports, e o que possui no castle!

 

Obs².: Tudo o que você pode configurar, já está escrito em cada script!

 

 

Créditos:

@DeathRocks

PC98

mapa.rar

entao, eu tentei botar no meu servidor de dbo esse script mais nao funcionou nao, e eu tambem nao achei nenhum Castle.lua para pegar a 3° storage nao, poderia me ajudar a configurar para meu dbo 8.6 tfs 0.4

 

nao deu nenhum erro na distro quando eu liguei o servidor

o que nao deu certo foi os pisos que nao impediram nada, nem level, guild, e também a porta passa quem quiser com ou sem guild

Editado por Emanueldk (veja o histórico de edições)

Postado
  • Autor
16 horas atrás, Emanueldk disse:

entao, eu tentei botar no meu servidor de dbo esse script mais nao funcionou nao, e eu tambem nao achei nenhum Castle.lua para pegar a 3° storage nao, poderia me ajudar a configurar para meu dbo 8.6 tfs 0.4

 

nao deu nenhum erro na distro quando eu liguei o servidor

o que nao deu certo foi os pisos que nao impediram nada, nem level, guild, e também a porta passa quem quiser com ou sem guild

 

talvez o seu server esteja bugado, pq comigo funciona normal

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo