Jump to content

getElementPosition and getElementData, problems


DarkLink

Recommended Posts

Okay guys, I changed abit my scripts, trying to make it working with edf files. and I guess, I am messed up things a bit :S

Now getElementPosition of element on map doesnt work, neither getElementData(element, posX) .. :S

I have on console bad argument at getElementData and getElementPosition , tryed each one.

My script:

  
local radar = getElementByID("radar") 
local x,y,z = getElementData(radar, "posX", false), getElementData(radar, "posY", false), getElementData(radar, "posZ", false) 
  

also tryed

  
local radar = getElementByID("radar") 
local x,y,z = getElementPosition(radar) 
  

both gave me errors.

And map file:

  
<map edf:definitions="borderpatrol,editor_main"> 
    <object id="radar" doublesided="false" model="4832" interior="0" dimension="0" posX="494.01837158203" posY="2283.5415039063" posZ="67.924118041992" rotX="0" rotY="0" rotZ="235.99731445313" /> 
.... 
... 
.. 
.. 
</map> 
  

on meta.xml:

  
<meta> 
     
     
     
     
    <info author="Tiago Martins" version="0.1" type="gamemode" name="DarkLink" description="A gamemode about border patrol and emigration" edf:definition="borderpatrol.edf"/> 
  
  
    <map src="teleporte.map" dimension="0" /> 
        ... 
        ... (many scripts here..) 
</meta> 
  
  

Thanks guys, any clue?

Link to comment

You should try to use debug techniques on your scripts.

Add outputChatBox(tostring(radar)) after the getElementByID line, see what it outputs. If it's "false", it didn't find the element, which means something is wrong between meta/script/map.

Link to comment
You should try to use debug techniques on your scripts.

Add outputChatBox(tostring(radar)) after the getElementByID line, see what it outputs. If it's "false", it didn't find the element, which means something is wrong between meta/script/map.

I guess its a problem with map file, but dont know how to fix it :S

I started doing my map with ctf definitions, now made my own definitions and set it on map, like u can see.

But something went wrong :S

Thanks for ur reply.

Link to comment
Try editing your script and your map file just down to the code you've pasted, because I can't see anything obvious wrong with them...

Thanks for your reply?

What do you mean by editing the files just down to the code I pasted? Its everything ok down..

Thanks.

Link to comment

Okay thanks guys, I found out what is causing the error.

When I have this on .map file I get error, when I dont have it, its ok.

  
.. 
  
<passage id="passage (1)" size="2" passage destination="passage (3)" posX="2486.3046875" posY="-1661.8643798828" posZ="12.374344825745" rotX="0" rotY="0" rotZ="0" /> 
    <passage id="passage (2)" size="2" passage destination="passage (4)" posX="2482.7746582031" posY="-1663.1722412109" posZ="12.382147789001" rotX="0" rotY="0" rotZ="0" /> 
    <passage id="passage (3)" size="2" passage destination="passage (1)" posX="2478.8254394531" posY="-1661.8198242188" posZ="12.382147789001" rotX="0" rotY="0" rotZ="0" /> 
    <passage id="passage (4)" size="2" passage destination="passage (2)" posX="2481.6726074219" posY="-1657.4172363281" posZ="12.365883827209" rotX="0" rotY="0" rotZ="0" /> 
.. 
  

This is a custom element, markers that will make teleport for the destination.

So you guys know what is wrong here?

Thanks.

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