<?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 = 600
--=============================================================
--== 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 steps(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
doMoveCreature(cid, dir)
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>