• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Action Racing Quest

Status
Not open for further replies.

Ancores

Active Member
Joined
Jan 17, 2010
Messages
538
Reaction score
28
Made this script for a quest in my ot and decided to release it here.

Information:
o Pull a switch to get teleported to a racing map
o The race will begin and you will 'drive' in the direction you're looking
o If you hit a wall (or whatever you want) you will get teleported to the temple.
o Get to the end of the race map into the goal and you will get teleported to a room where you get your reward.

Also remember to put Non-Logout Zone in the race map

Example map (ugly one):


Aaand the script:
data/actions/scripts/race.lua
Lua:
local config = {
		timeToStart = 5, -- Time for the player to start 'driving' after using the switch
		startPos = {x=84, y=132, z=7}, -- Start race position
		startMsg = "Avoid the walls!", -- Message when the race starts
		startLookDirection = SOUTH, -- Look Direction when the race starts
		changeLookType = "yes", -- Change looktype of the player?
		itemIDLookType = 9937, -- Item ID of how the player should look like
		speed = 200, -- Speed
		failItems = {9119, 9118, 9120, 9124}, -- 'Driving' into these items makes the player lose
		failMsg = "You crashed and broke your neck!", -- Message if he loses
		winningItems = {5785, 7890}, -- The items the player should 'drive' into to win
		winningMsg = "You completed the race!", -- Message if the player wins
		rewardRoomPos = {x=113, y=126, z=7} -- Position of the reward room
		}

local function race(cid)
local dir, pos = getCreatureLookDirection(cid), getThingPos(cid)
local newPos = {x=(dir == 1 and pos.x+1 or dir == 3 and pos.x-1 or pos.x), y=(dir == 0 and pos.y-1 or dir == 2 and pos.y+1 or pos.y), z=pos.z, stackpos=1}

	if not isInArray(config.winningItems, getThingFromPos(newPos).itemid) then
		if not isInArray(config.failItems, getThingFromPos(newPos).itemid) then
			doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
			doTeleportThing(cid, newPos)
			addEvent(race, config.speed, cid)
		else
			doSendMagicEffect(getThingPos(cid), 6)
			doRemoveConditions(cid, false)
			doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doPlayerSendTextMessage(cid, 19, config.failMsg)
			doCreatureSetNoMove(cid, 0)
		end
	end
	
	if isInArray(config.winningItems, getThingFromPos(newPos).itemid) then
		doTeleportThing(cid, config.rewardRoomPos)
		doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid, 22, config.winningMsg)
		doRemoveConditions(cid, false)
		doCreatureSetNoMove(cid, 0)
	end
return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local dir = getCreatureLookDirection(cid)
	doTeleportThing(cid, config.startPos)
	doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
	doPlayerSendTextMessage(cid, 22, config.startMsg)
	doCreatureSetNoMove(cid, 1)
	doCreatureSetLookDirection(cid, config.startLookDirection)
	doSetItemOutfit(cid, config.changeLookType == "yes" and config.itemIDLookType or 0, -1)
	addEvent(race, config.timeToStart*1000, cid)
return true
end

data/actions/actions.xml
PHP:
<action actionid="5000" event="script" value="race.lua"/>

Hope you like it!
 
Last edited by a moderator:
so you drive like crazy frog?
 
i really like this script gunna make an awesome go-kart track with some pits of doom and traps to make it hard for them :) once im done il take a ss of the map and if people want i will release it.

you can use multiple floors on this quest? say using ramps works ?

also just had an amazing idea if you could script it
(dodge em's) like bumper cars (fair ground ride)
21jp3wx.jpg
but you have to aviod eachother in a big arena (players (x ammount) use a lever to teleport into an area and race around a track to avoid obstacles and eachother to try make other players crash)
if they hit eachother or an obstacle they loose.

think you could add that into it?
 
Last edited:
i really like this script gunna make an awesome go-kart track with some pits of doom and traps to make it hard for them :) once im done il take a ss of the map and if people want i will release it.

you can use multiple floors on this quest? say using ramps works ?

also just had an amazing idea if you could script it
(dodge em's) like bumper cars (fair ground ride)
21jp3wx.jpg
but you have to aviod eachother in a big arena (players (x ammount) use a lever to teleport into an area and race around a track to avoid obstacles and eachother to try make other players crash)
if they hit eachother or an obstacle they loose.

think you could add that into it?

I'm not sure if ramps will work with this script, you could try it and if it doesn't work I'll make it work.
Great idea with the bumper cars, I'll make one and release it later :)
 
Is it tested on 0.3 or 0.4?

Can we use protection zone instead of no pvp tiles? (Avoid auto cleaning?)
 
It's tested on 0.4 and should work on 0.3.
Protection zone/no pvp zone doesn't matter, what's needed is non logout zone to make players not able to relog when driving because that would make them able to walk around in there as usual.
 
I remade the script to work with Bumper Cars, would be great if someone could try it and report bugs.
I guess it's completely buggy since I really just made a fast change, but if you want it, help me try it :p
Code:
EDIT: I'll try it myself later.
 
Last edited:
i just built my race track and tested the script, once the race starts i just keep driving into and through the wall without being able to turn :eek: any idea?

also it didnt teleport me with a fail message when going through the wall

using 0.3.6pl1
 
Last edited:
i just built my race track and tested the script, once the race starts i just keep driving into and through the wall without being able to turn :eek: any idea?

also it didnt teleport me with a fail message when going through the wall

using 0.3.6pl1

Did you turn with ctrl+arrows?
Have you set the wall ids in the array "failItems"?
 
Did you turn with ctrl+arrows?
Have you set the wall ids in the array "failItems"?



my bad with the ctrl arrows, but if you dont turn at all when you go and you let it crash into the wall straight away it just puts you through it, item id 9119, like you have with your walls i can pass through them


the same wall id's you used for some reason i can pass through 9119 and 9118

aouek2.jpg


sometimes it works sometimes it doesnt as you can see in this picture



Does it make a difference if you use raw pallete or doodad palette?
 
Last edited:
its ok i fixed the problem what i set was the tile void all outside and made sure there was something under each wall tile and it seems to work well now.

if you use different floor grounds it seems to have trouble, it makes you pass through walls trying to read to many id's i think, might be wrong
 
Last edited:
The script I gave you is the one for the lever and everything else.
 
Cool, works on 0.3.6, but would be great to add, when you touch the wall, it kick you to pos.
 
Status
Not open for further replies.
Back
Top