Jump to content

custom EDF (spawnpoint) problem


zocken212

Recommended Posts

Hello,

I want to create a custom EDF. Until now it worked fine, it gets the X,Y,Z and rotation X,Y,Z but not the vehicle ID.

First the EDF: (copied most from race)

  
<def name ="Shooter"> 
    <element name = "spawnpoint" friendlyname = "Shooter Spawnpoint"> 
        <data name = "position" type = "coord3d" required = "true" default = "0,0,0"/> 
        <data name = "rotation" type = "coord3d" required = "true" default = "0,0,0"/> 
        <data name = "vehicle" type = "vehicleID" default = "522"/> 
        <vehicle model="!vehicle!" rotation="!rotation!"/> 
    </element> 
</def> 
  

Now the code where I get the data from the spawnpoint:

  
function getRandomSpawnPoint() 
    local random = nil 
    for index, p in pairs(getElementsByType("spawnpoint")) do 
        if p ~= nil then 
            local toRandom = math.random(#getElementsByType("spawnpoint")) 
            if index == toRandom then 
                local x,y,z = getElementPosition(p) 
                local model = getElementModel(p) 
                random = { x = x, y = y, z = z, model = model} 
                toRandom = nil 
                break 
            end 
        end 
    end 
    return random 
end 
local test = getRandomSpawnPoint() 
outputChatBox(tostring(test.model)) 
  

Where is my problem?

Edit: local model = getElementData(p,"vehicle") works somehow, but just tried it now lol.. If there is another way, you can tell it me :D

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