Ir para conteúdo

Cart System (Andar de carrinho)


Killua

Posts Recomendados

Olá amigos, nessa terça venho trazer um mod que criei... É aquele sistema que o carrinho vai andando com vc. Para ver os outros scripts de terça, clique aqui.

 

Cart_System.png

 

Explicando:

Os caminhos são definidos pelo ot admin, ou seja, o player não poderá andar livremente. Enquanto estiver no carrinho, o jogador não poderá logar, entrar em batalha e nem andar.

 

Instalando:

Crie Killua Cart System.xml em data/mods e coloque esse código:

 

<?xml version="1.0" encoding="UTF-8"?>  
<mod name="Walking Cart System" version="1.0" author="Killua (Vitor Bertolucci)" enabled="yes">  
<config name="cartSystem"><![CDATA[


interval = 500


--=============================================================
--== Walking Cart System, created by Killua (Vitor Bertolucci)=                                
--== If you are planning to post this code, please contact me = 
--== first and/or keep my name in it                      =====
--== Based on TFS 0.4                                     =====                                                      
--== Created on 14/04/2014 (April 14th 2014)              =====   
--=============================================================
---------------------------------------------------------------                                           
--==================[[INSTRUCTIONS (read it)]]=================                               
--== Action ID 5191 means NORTH                           =====                                     
--== Action ID 5192 means EAST                            =====                                      
--== Action ID 5193 means SOUTH                           =====                                    
--== Action ID 5194 means WEST                            =====                                    
--== Action ID 5195 means STOP                            =====                                    
--== interval means the interval between car step(1000=1s)=====
--== CHANGE interval VARIABLE IN THE TOP  OF THE CODE     =====
--=============================================================




function moveCart(cid, dir)
    local sto_ = getPlayerStorageValue(cid, 1212123)
    if isInArray({0, 1, 2, 3}, dir) and sto_ == dir then
        local pos = getCreaturePosition(cid)
        if dir == 0 then
            doTeleportThing(cid, {x = pos.x, y = pos.y - 1, z = pos.z}, false)
        elseif dir == 1 then
            doTeleportThing(cid, {x = pos.x + 1, y = pos.y, z = pos.z}, false)
        elseif dir == 2 then
            doTeleportThing(cid, {x = pos.x, y = pos.y + 1, z = pos.z}, false)
        elseif dir == 3 then
            doTeleportThing(cid, {x = pos.x - 1, y = pos.y, z = pos.z}, false)
        end
        addEvent(moveCart, interval, cid, dir)
    end
end
]]></config>


<event type="login" name="cartsLogin" event="script"><![CDATA[
domodlib('cartSystem')
function onLogin(cid)
    registerCreatureEvent(cid, "cartsStats")
    registerCreatureEvent(cid, "cartsCombat")
    if getPlayerStorageValue(cid,1212123) ~= -1 then
        setPlayerStorageValue(cid,1212123, -1)
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end
    return true
end
]]></event>


<event type="combat" name="cartsCombat" event="script"><![CDATA[
domodlib('cartSystem')
function onCombat(cid, target)
    if getPlayerStorageValue(cid, 1212123) ~= -1 then
        return false
    end
    return true
end
]]></event>


<event type="statschange" name="cartsStats" event="script"><![CDATA[
domodlib('cartSystem')
function onStatsChange(cid, attacker, type, combat, value)
    if getPlayerStorageValue(cid, 1212123) ~= -1 and type == 1 then
        return false
    end
    return true
end
]]></event>


<event type="logout" name="cartsLogout" event="script"><![CDATA[
domodlib('cartSystem')
function onLogout(cid)
    if getPlayerStorageValue(cid, 1212123) ~= -1 then
        doPlayerSendCancel(cid, "You may not logout during your cart walking experience")
        return false
    end
    return true
end
]]></event>


<movement type="StepIn" actionid="5191;5192;5193;5194;5195" event="script"><![CDATA[
domodlib('cartSystem')


function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if item.actionid == 5191 then
        doSetItemOutfit(cid, 7132)
        mayNotMove(cid, true)        
        doPlayerSendTextMessage(cid, 20, "Moving North...")
        doPlayerSetStorageValue(cid, 1212123, 0)
        addEvent(moveCart, interval, cid, 0)
    elseif item.actionid == 5192 then
        doSetItemOutfit(cid, 7131)
        mayNotMove(cid, true)        
        doPlayerSendTextMessage(cid, 20, "Moving East...")
        doPlayerSetStorageValue(cid, 1212123, 1)
        addEvent(moveCart, interval, cid, 1)
    elseif item.actionid == 5193 then
        doSetItemOutfit(cid, 7132)
        mayNotMove(cid, true)        
        doPlayerSendTextMessage(cid, 20, "Moving South...")
        doPlayerSetStorageValue(cid, 1212123, 2)
        addEvent(moveCart, interval, cid, 2)
    elseif item.actionid == 5194 then
        doSetItemOutfit(cid, 7131)
        mayNotMove(cid, true)        
        doPlayerSendTextMessage(cid, 20, "Moving West...")
        doPlayerSetStorageValue(cid, 1212123, 3)
        addEvent(moveCart, interval, cid, 3)
    elseif item.actionid == 5195 then
        mayNotMove(cid, false)
        doRemoveCondition(cid, CONDITION_OUTFIT)
        doPlayerSendTextMessage(cid, 20, "You have reached your destiny, you may leave now...")
        doPlayerSetStorageValue(cid, 1212123, -1)
    end
    return true
end]]></movement>
</mod>

 

Configurando:

Simplesmente coloque action ID 5191 no piso que player deve pisar para começar a andar para o NORTE;

action ID 5192 para LESTE (direita);

action ID 5193 para SUL;

action ID 5194 para OESTE (esquerda);

action ID 5195 para o player parar de andar e sair do carrinho.

 

Seguem imagem de exemplo:

 

 

Cart_East.png

 

 

 

 

Editado por Killua
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...