Jump to content

Teleport to normal dimension


Thivenin

Recommended Posts

hai,

I'm learning the script and I start with the teleporting with marker

But when I come in my interior I have the marker to get out, when I take it but it's doing nothing so my first function is working well but not the secound for get back to normal dimension

I have the error, line 12 : 'then' excepted near 'hitElement'

here the script :

intoMarker = createMarker ( 1153, -1770, 18, "arrow", 1.5, 250, 0, 0, 250 ) 
  
function intoTeleport ( player ) 
    setElementInterior ( player, 900, 26, 42, 121 ) 
end 
addEventHandler ( "onMarkerHit", intoMarker, intoTeleport ) 
  
outMarker = createMarker ( 24, 42, 122.5, "arrow", 1.5, 250, 0, 0, 255 ) 
setElementInterior(outMarker,900) 
  
function outTeleport( hitElement, matchingDimension )  
    if ( "thePlayer" ) hitElement ( hitMarker ) then 
        local elementType = getElementType( hitElement )type 
        setElementDimension ( source, 0 ) 
    end 
end 
addEventHandler( "onMarkerHit", outMarker, outTeleport ) 

IntoMarker and the function intoTeleport is the function for get in the interior, that is working

the problem is the outMarker and the function outTeleport

so my problem is : I can't get my ass back to the normal dimension, can ya all help me pls ?

Link to comment

This time I tried it :

  
outMarker = createMarker ( 24, 42, 122.5, "arrow", 1.5, 250, 0, 0, 255 ) 
setElementInterior(outMarker,900) 
  
function outTeleport ( hitElement, matchingDimension, player ) 
    if (hitElement == "player") then 
        setElementDimension ( source, 0 ) 
        setElementPosition ( player, 1155, -1770, 18 ) 
    end 
end 

The marker is here, there is no any error message but when I take the marker it's not teleporting and there is still no error

Link to comment

Its better if you use "onPlayerMarkerHit" because its only triggered when a player hits a marker

onPlayerMarkerHit -- triggered only when a player enters a marker 
markerHit -- the marker that got hit 
matchingDimension -- if its in the same dimension as the hit player 
source -- is the player who got hit 

by the way when changing element interior it dose not change the dimension, it stays the same

intoMarker = createMarker ( 1153, -1770, 18, "arrow", 1.5, 250, 0, 0, 250 ) 
function intoTeleport (markerHit, matchingDimension) 
if (markerHit == intoMarker) then 
hitplayer = source 
    setElementInterior ( hitplayer, 900, 26, 42, 121 ) 
end 
end 
addEventHandler ( "onPlayerMarkerHit", getRootElement(), intoTeleport ) 
  
outMarker = createMarker ( 24, 42, 122.5, "arrow", 1.5, 250, 0, 0, 255 ) 
setElementInterior(outMarker,900) 
function outTeleport (markerHit, matchingDimension) 
    if markerHit == outMarker then 
    hitplayer = source 
        setElementInterior ( hitplayer , 0 ) 
        setElementPosition ( hitplayer , 1155, -1770, 18 ) 
    end 
end 
addEventHandler( "onPlayerMarkerHit", getRootElement(), outTeleport ) 

Link to comment

try this.. it works but spawns on air and kills me but i think its what u wanted

intoMarker = createMarker ( 1153, -1770, 18, "arrow", 1.5, 250, 0, 0, 250 ) 
function intoTeleport (markerHit, matchingDimension) 
if (markerHit == intoMarker) then 
hitplayer = source 
    setElementInterior ( hitplayer, 900, 26, 42, 121 ) 
end 
end 
addEventHandler ( "onPlayerMarkerHit", getRootElement(), intoTeleport ) 
  
outMarker = createMarker ( 24, 42, 122.5, "arrow", 1.5, 250, 0, 0, 255 ) 
setElementInterior(outMarker,900) 
function outTeleport (markerHit, matchingDimension) 
    if markerHit == outMarker then 
    hitplayer = source 
        setElementInterior ( hitplayer , 0, 1155, -1770, 18  ) 
    end 
end 
addEventHandler( "onPlayerMarkerHit", getRootElement(), outTeleport ) 
  

edit: when i check the interior from admin panel its 132

Edited by Guest
Link to comment

I have another problem now, this one is very weird

firstMarker = createMarker ( -35, 35, 121.5, "arrow", 250, 0, 250, 255 ) 
setElementInterior ( firstMarker, 900 ) 
  
function firstTP ( markerhit, matchingDimension ) 
    if ( markerhit == firstMarker ) then 
    hitplayer = source 
        setElementInterior ( hitplayer, 901, -214, 16, 197 ) 
    end 
end 
addEventHandler ( "onPlayerMarkerHit", firstMarker, firstTP ) 

the marker should be at the interior "900" and I should take the marker for being TP at the interior 901, but when I get in the interior 900, it's directly TPing le at the interior 901, I tried alot of thing but nothing help me pls ^^ (again sorry for all thse ask, I started the script yesterday

edit : now as I removed "getRootElement()" and added "firstMarker" at the event, it's not TPing me directly at the interior 901, it's TPing correctly at the interrior 900, but I don't see the marker to go at the interior 901

Link to comment
firstMarker = createMarker ( -35, 35, 121.5, "arrow", 250, 0, 250, 255 ) 
setElementInterior ( firstMarker, 900 ) 
  
function firstTP ( markerhit, matchingDimension ) 
    if ( markerhit == firstMarker ) then 
        setElementInterior ( source, 901, -214, 16, 197 ) 
    end 
end 
addEventHandler ( "onPlayerMarkerHit", root, firstTP ) 

Link to comment

yes, lol but I should first enter in the interior 900 to take the marker to go to the interior 901, but when I take the marker to go to the interior 900 it's directly TPing me at the interior 901

so when I wanna go to the interior 900, I can't because of that part of the script is bugged and TPing me directly at interior 901

Link to comment

bump

firstMarker = createMarker ( -35, 35, 121.5, "arrow", 250, 0, 250, 255 ) 
setElementInterior ( firstMarker, 900 ) 
  
function firstTP ( markerhit, matchingDimension ) 
    if ( markerhit == firstMarker ) then 
    hitplayer = source 
        setElementInterior ( hitplayer, 901, -214, 16, 197 ) 
    end 
end 
addEventHandler ( "onPlayerMarkerHit", firstMarker, firstTP ) 

with it, it's TPing me well to interior 900, but I can't see the marker :/

if I put "getRootElement()" or "root" at EventHandler, it's making the script bugged

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...