Jump to content

I need help with a marker


Xeno

Recommended Posts

Iv done markers before when you hit them you teleport somwhere.

For some reason i cant put the teleport bit inside the function with the marker in it.

I put it in an nuther function and it doesent work, no errors on Debug or anything.

Heres my Script

function cUFO( player, commandname )
        setElementPosition ( player, -1587, 26, 37 )
        local UFO = createObject ( 17512, -1326, -67, 110, 180, 0, 0 )
        outputChatBox ( "**EVERYONE GET TO SF AIRPORT, IT IS BEING ATTACKED BY UFO'S!**",root,255,100,100 )
        local xup = -1430
        local yup = 50
        local zup = 110
        local xup1 = -1394	
        local yup1 = 107
        local zup1 = 110
        local xup2 = -1287
        local yup2 = -69
        local zup2 = 110
        local xup3 = -1386
        local yup3 = -158
        local zup3 = 110
        local xup4 = -1587
        local yup4 = 26
        local zup4 = 1000
        setTimer ( moveObject, 2000, 1, UFO, 10000, xup, yup, zup )
        setTimer ( moveObject, 15000, 1, UFO, 10000, xup1, yup1, zup1 )
        setTimer ( moveObject, 30000, 1, UFO, 10000, xup2, yup2, zup2 )
        setTimer ( moveObject, 37000, 1, UFO, 10000, xup3, yup3, zup3 )
        setTimer ( moveObject, 45000, 1, UFO, 10000, xup4, yup4, zup4 ) 
        beam = createMarker( 1616, 659, -50, "checkpoint", 5, 0, 255, 0, 150 )
        attachElements (beam, UFO, 0, 0, 50, 0, 0, 0)
end
 
addCommandHandler ( "UFO", cUFO )
 
function teleport(player)
 if getElementType( player ) == "player" and source == beam then      
setElementPosition(hitPlayer, 4027, -187, 112 )
end
end
 
function cUFO( player, commandname )
        setElementPosition ( player, -1587, 26, 37 )
        local UFO = createObject ( 17512, -1326, -67, 120, 0, 0, 0 )
        local xup = -1430
        local yup = 50
        local zup = 120
        local xup1 = -1394	
        local yup1 = 107
        local zup1 = 120
        local xup2 = -1287
        local yup2 = -69
        local zup2 = 120
        local xup3 = -1386
        local yup3 = -158
        local zup3 = 120
        local xup4 = -1587
        local yup4 = 26
        local zup4 = 1000
        setTimer ( moveObject, 2000, 1, UFO, 10000, xup, yup, zup )
        setTimer ( moveObject, 15000, 1, UFO, 10000, xup1, yup1, zup1 )
        setTimer ( moveObject, 30000, 1, UFO, 10000, xup2, yup2, zup2 )
        setTimer ( moveObject, 37000, 1, UFO, 10000, xup3, yup3, zup3 )
        setTimer ( moveObject, 46000, 1, UFO, 10000, xup4, yup4, zup4 ) 
end
 
addCommandHandler ( "UFO", cUFO )

Link to comment

first help people to help you:

1. why you have two event handlers and two functions with the same name?

2. where's the part that calls function teleport(player)?

3. use [lua] tag instead of

p.s.: hitPlayer in your teleport function isn't defined, cause i bet it's not a global var

Link to comment

He meant that there are 2 functions which appear to be exactly the same. And both are bound to the same command. He also noticed you aren't calling the teleport function. (god I should learn to read before posting D:) And finally, this is a tip for the use on the forum from him, to use [lua] (or

 ) instead of just [code]. It makes reading your code yet another bit easier.

Anyway, put that event handler I posted before into the cUFO function, just after you create the marker. If onMarkerHit would work with attached markers, it'll work properly. If not, then... It doesn't eh?

Link to comment

i think iv neally fixed it, this is it

local beam = createMarker( 1616, 659, -50, "checkpoint", 5, 0, 255, 0, 150 )

function cUFO( player, commandname )

setElementPosition ( player, -1587, 26, 37 )

local UFO = createObject ( 17512, -1326, -67, 110, 180, 0, 0 )

outputChatBox ( "** EVERYONE GET TO SF AIRPORT, IT IS BEING ATTACKED BY UFO'S! **",root,255,100,100 )

local xup = -1430

local yup = 50

local zup = 110

local xup1 = -1394

local yup1 = 107

local zup1 = 110

local xup2 = -1287

local yup2 = -69

local zup2 = 110

local xup3 = -1386

local yup3 = -158

local zup3 = 110

local xup4 = -1587

local yup4 = 26

local zup4 = 1000

setTimer ( moveObject, 2000, 1, UFO, 10000, xup, yup, zup )

setTimer ( moveObject, 15000, 1, UFO, 10000, xup1, yup1, zup1 )

setTimer ( moveObject, 30000, 1, UFO, 10000, xup2, yup2, zup2 )

setTimer ( moveObject, 37000, 1, UFO, 10000, xup3, yup3, zup3 )

setTimer ( moveObject, 45000, 1, UFO, 10000, xup4, yup4, zup4 )

attachElements (beam, UFO, 0, 0, 50, 0, 0, 0)

end

addCommandHandler ( "UFOsf", cUFO )

function teleport(player)

if (source == beam) then

setElementPosition(player, 4027, -187, 112 )

end

end

addEventHandler("onMarkerHit", beam, teleport)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...