• 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.
any progression to the bumper cars script?

would be better if player x hits player y and he looses say 1 point from 3 points once players has 0 points hes out of the game

way it works if head on collision both loose 1 point, if player hits another player from the north while other player is either facing north east or west he looses a point.

that might be to much scripting lol but how is the bumper cars one coming along so far?
 
I came up with an idea, checkpoints, it maybe should work with points as @up.
Example, when the player crashes they get to the last checkpoint, after (3?) crashes they get out of the race :). And ye also as @up, if you can make the script check who is facing in the direction of a player while 2 ppl crash, then the one who was facing a player gets to the latest checkpoint xD.
 
cant get it to work.. what doesnt work: the level, so you cant basicly start the race. also tried to manually walk over the items to get to reward room.. didnt work.
Code:
local config = {
                timeToStart = 5, -- Time for the player to start 'driving' after using the switch
                startPos = {x=1023, y=1072, z=10}, -- 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=1015, y=1085, z=10} -- 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
 
to turn you have to press ctrl + arrow keys i guess
 
cant get it to work.. what doesnt work: the level, so you cant basicly start the race. also tried to manually walk over the items to get to reward room.. didnt work.
Code:
local config = {
                timeToStart = 5, -- Time for the player to start 'driving' after using the switch
                startPos = {x=1023, y=1072, z=10}, -- 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=1015, y=1085, z=10} -- 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

What do you mean, "what doesnt work: the level"?
And you can just finish the race if you're driving, not by walking on it.

wtf? I can't turn.
Ctrl+arrows
 
NEVERMIND! i found out :p i used the Wrong id on the switch xd
 
Really nice!
Remade it a bith with different failobjects,looktype and winitems and that. :D
Worked really nice, thanks for this!
 
upload mpa plx :D
nnphna.gif
 
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!
does anyone have a map for this quest?
 
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!
After teleporting, he still does the movement and gets no awards :(

how to fix it?
 
Status
Not open for further replies.
Back
Top