Hiho!
Well, since I'm moving to WoW and not playing Tibia anymore, I've decided to release my fantastic TAXI NPC, aka FREE RIDE CAR.
It consists of an NPC who reacts to your talk actions (such as "Forward", "Backward", "Right" and "Left"). It will carry you on its back, and you'll be able to ride it wherever you want.
Here you have my YouTube video demonstration:
http://es.youtube.com/watch?v=nW3aGWmvd_Y
http://es.youtube.com/watch?v=ujYW5_lSr7c
And here is the script:
-Create a Taxi.xml file in your DATA/NPC folder.
-Paste this inside:
-After that, create a Taxi.lua file in your DATA/NPC/SCRIPTS folder.
-Paste this inside:
-Now add this to your login.lua file in your DATA/CREATURESCRIPTS/SCRIPTS folder. Must be inside the onLogin function:
-How it works? Just say "hi" to the NPC. He will ask you to say "ride". Say it, and now repeat the number he gives to you (this is to prevent getting up on more than one taxi xD xD). Then, say "ride" again, and you'll be pushed on the taxi. Now use any of the hotkeys below, and weee!!
HOTKEYS:
forward : you go ahead
backward : you go back
right : right way
left : left way
stop : the car stops
getdown : you can move out of the car, and this one stops
fast : increase speed
slow : decrease speed
floorup : while you are moving, you can go up 1 floor
floordown : while you are moving, you can go down 1 floor
And you're done!
Also take note that this car goes through EVERY WHERE (this includes any wall, water or ground tile), so if you plan to limit the car's roads, you'll have to make some item not to be walkable (this is easy thanks to the Walkback script on MOVEMENTS folder. Just copy and edit it so you are pushed back when you ride over an item.) Empty black tiles also work as a limit for the car, so you can make circuits just by surrounding both sides of the road with empty tiles (MapEditor).
*Please, take note that you need to keep free storage values 30069, 30068, 30067, 30066, since this script use them.
ALL CREDITS TO ME!! ^^
Well, since I'm moving to WoW and not playing Tibia anymore, I've decided to release my fantastic TAXI NPC, aka FREE RIDE CAR.
It consists of an NPC who reacts to your talk actions (such as "Forward", "Backward", "Right" and "Left"). It will carry you on its back, and you'll be able to ride it wherever you want.
Here you have my YouTube video demonstration:
http://es.youtube.com/watch?v=nW3aGWmvd_Y
http://es.youtube.com/watch?v=ujYW5_lSr7c
And here is the script:
-Create a Taxi.xml file in your DATA/NPC folder.
-Paste this inside:
PHP:
<npc name="Taxi" script="data/npc/scripts/taxi.lua" autowalk="0" floorchange="0" access="6" level="1" maglevel="1">
<health now="150" max="150"/>
<look typeex="7266" head="114" body="113" legs="113" feet="113" addons="3" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Brooom brom brom brom bom!!" />
<parameter key="message_farewell" value="-Engine stopped-" />
</parameters>
</npc>
-After that, create a Taxi.lua file in your DATA/NPC/SCRIPTS folder.
-Paste this inside:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
local talkstate = -1
local npcpos = {}
local newpos = {}
local npc = nil
local flight = 0
local height = {}
local started = nil
local speed = 250
local rand = nil
function creatureSayCallback(cid, type, msg)
msg = string.lower(msg)
target = isPlayer(getPlayerByName(getPlayerName(cid)))
if target ~= FALSE then
if(npcHandler.focus ~= cid) then
return FALSE
end
talkstate = getPlayerStorageValue(cid,30068) - 3
if (msg == 'bye') or (msg == 'cya') or (msg == 'getdown') then
mayNotMove(cid, 0)
flight = 1
speed = 250
setPlayerStorageValue(cid,30069, 0)
talkstate = -1
setPlayerStorageValue(cid,30068, talkstate + 3)
elseif (talkstate == -2) then
if isNumber(msg) == TRUE then
if tonumber(msg) == rand then
selfSay("YOU CHOSE ME. Say 'ride'.")
talkstate = 0
setPlayerStorageValue(cid,30068, talkstate + 3)
else
talkstate = -1
return FALSE
end
end
elseif (talkstate == -1) then
if (msg == 'ride') then
math.randomseed(getNpcCid())
math.random(0,9999999);math.random(0,9999999);math.random(0,9999999);
rand = math.random(0,9999999)
selfSay("Please, say this number: " .. tostring(rand))
talkstate = -2
setPlayerStorageValue(cid,30068, talkstate + 3)
else
selfSay("First get up by saying: 'ride'.")
end
elseif (msg == 'ride') then
if (talkstate == 0) then
selfSay("Ready!! Set these hotkeys: forward, backward, right, left, stop, getdown, fast, slow, floorup and floordown.")
npc = getNpcCid()
npcpos.x,npcpos.y,npcpos.z = selfGetPosition(npc)
doTeleportThing(cid,npcpos,1)
mayNotMove(cid, 1)
talkstate = 1
setPlayerStorageValue(cid,30068, talkstate + 3)
else
selfSay("Already riding!!")
end
elseif (msg == 'forward') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
talkstate = 2
setPlayerStorageValue(cid,30068, talkstate + 3)
end
elseif (msg == 'right') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
talkstate = 3
setPlayerStorageValue(cid,30068, talkstate + 3)
end
elseif (msg == 'backward') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
talkstate = 4
setPlayerStorageValue(cid,30068, talkstate + 3)
end
elseif (msg == 'left') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
talkstate = 5
setPlayerStorageValue(cid,30068, talkstate + 3)
end
elseif (msg == 'floorup') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
height = getPlayerPosition(cid)
if height.z > 1 then
flight = -1
setPlayerStorageValue(cid,30067, flight + 3)
else
selfSay("Max height")
end
end
elseif (msg == 'floordown') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
height = getPlayerPosition(cid)
if height.z < 7 then
flight = 1
setPlayerStorageValue(cid,30067, flight + 3)
else
selfSay("Min height")
end
end
elseif (msg == 'fast') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
if speed > 100 then
velreal = speed
velreal = velreal - 100
if velreal > 100 then
speed = velreal
else
speed = 100
end
setPlayerStorageValue(cid,30066, speed)
else
selfSay("Max speed")
end
end
elseif (msg == 'slow') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
if speed < 1000 then
velreal = speed
velreal = velreal + 100
if velreal < 1000 then
speed = velreal
else
speed = 1000
end
setPlayerStorageValue(cid,30066, speed)
else
selfSay("Min speed")
end
end
elseif (msg == 'stop') then
if (talkstate == 0) then
selfSay("First get up by saying: 'ride'.")
else
setPlayerStorageValue(cid,30069, 0)
talkstate = 69
setPlayerStorageValue(cid,30068, talkstate + 3)
end
end
talkstate = getPlayerStorageValue(cid,30068) - 3
if (talkstate >= 0) then
started = getPlayerStorageValue(cid,30069)
param = {}
npc = getNpcCid()
param.npc = npc
param.pla = getPlayerName(cid)
if (talkstate > 1) and (talkstate ~= 69) and (target ~= FALSE) and (started == 0) then
setPlayerStorageValue(cid,30069, 1)
local eventServ = addEvent(walk, speed, param)
end
end
else
talkstate = 0
end
return TRUE
end
function walk(param)
player = getPlayerByName(param.pla)
target = isPlayer(player)
talkstate = getPlayerStorageValue(player,30068) - 3
speed = getPlayerStorageValue(player,30066)
flight = getPlayerStorageValue(player,30067) - 3
if target ~= FALSE then
if talkstate == 2 then
target = isPlayer(player)
if target ~= FALSE then
npcpos = getPlayerPosition(player)
newpos = {x = npcpos.x, y = npcpos.y - 1, z = npcpos.z + (flight)}
flight = 0
setPlayerStorageValue(player,30067, flight + 3)
trajenpc = 7266
doSetItemOutfit(param.npc, trajenpc,-1)
doTeleportThing(player,newpos,0)
newpos = getPlayerPosition(player)
doTeleportThing(param.npc,newpos,0)
else
talkstate = 0
end
elseif talkstate == 3 then
target = isPlayer(player)
if target ~= FALSE then
npcpos = getPlayerPosition(player)
newpos = {x = npcpos.x + 1, y = npcpos.y, z = npcpos.z + (flight)}
flight = 0
setPlayerStorageValue(player,30067, flight + 3)
trajenpc = 7267
doSetItemOutfit(param.npc, trajenpc,-1)
doTeleportThing(player,newpos,0)
newpos = getPlayerPosition(player)
doTeleportThing(param.npc,newpos,0)
else
talkstate = 0
end
elseif talkstate == 4 then
target = isPlayer(player)
if target ~= FALSE then
npcpos = getPlayerPosition(player)
newpos = {x = npcpos.x, y = npcpos.y + 1, z = npcpos.z + (flight)}
flight = 0
setPlayerStorageValue(player,30067, flight + 3)
trajenpc = 7266
doSetItemOutfit(param.npc, trajenpc,-1)
doTeleportThing(player,newpos,0)
newpos = getPlayerPosition(player)
doTeleportThing(param.npc,newpos,0)
else
talkstate = 0
end
elseif talkstate == 5 then
target = isPlayer(player)
if target ~= FALSE then
npcpos = getPlayerPosition(player)
newpos = {x = npcpos.x - 1, y = npcpos.y, z = npcpos.z + (flight)}
flight = 0
setPlayerStorageValue(player,30067, flight + 3)
trajenpc = 7267
doSetItemOutfit(param.npc, trajenpc,-1)
doTeleportThing(player,newpos,0)
newpos = getPlayerPosition(player)
doTeleportThing(param.npc,newpos,0)
else
talkstate = 0
end
end
started = getPlayerStorageValue(player,30069)
if (target ~= FALSE) and (started == 1) then
local eventServ = addEvent(walk, speed, param)
end
else
talkstate = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
-Now add this to your login.lua file in your DATA/CREATURESCRIPTS/SCRIPTS folder. Must be inside the onLogin function:
PHP:
-------------------------
--Lets the player use the car
setPlayerStorageValue(cid,30069,0)
setPlayerStorageValue(cid,30068,2)
setPlayerStorageValue(cid,30067,3)
setPlayerStorageValue(cid,30066,250)
--------------------------
-How it works? Just say "hi" to the NPC. He will ask you to say "ride". Say it, and now repeat the number he gives to you (this is to prevent getting up on more than one taxi xD xD). Then, say "ride" again, and you'll be pushed on the taxi. Now use any of the hotkeys below, and weee!!
HOTKEYS:
forward : you go ahead
backward : you go back
right : right way
left : left way
stop : the car stops
getdown : you can move out of the car, and this one stops
fast : increase speed
slow : decrease speed
floorup : while you are moving, you can go up 1 floor
floordown : while you are moving, you can go down 1 floor
And you're done!
Also take note that this car goes through EVERY WHERE (this includes any wall, water or ground tile), so if you plan to limit the car's roads, you'll have to make some item not to be walkable (this is easy thanks to the Walkback script on MOVEMENTS folder. Just copy and edit it so you are pushed back when you ride over an item.) Empty black tiles also work as a limit for the car, so you can make circuits just by surrounding both sides of the road with empty tiles (MapEditor).
*Please, take note that you need to keep free storage values 30069, 30068, 30067, 30066, since this script use them.
ALL CREDITS TO ME!! ^^
Last edited: