Jump to content

Problem with DayZ - car spawn


wgnsy123

Recommended Posts

Hello everybody...(sry from language, i from Poland) I have a problem. I was to add a new spawning car, and this is a problem.

(spawnyPojazdow- spawnVehicles maybe)

I have a lua file:

spawnyPojazdow={ 
  {601, 122.98459625244,2066.1225585938,16.934089660645, 2, 0, 50}, 
       
for i,v in ipairs(spawnyPojazdow) do 
    veh = createVehicle(v[1], v[2], v[3], v[4]) 
    vehCol = createColSphere(v[2], v[3], v[4], 1.5) 
    attachElements (vehCol, veh, 0, 0, 0 ) 
    setElementData(vehCol,"parent",veh) 
    setElementData(veh,"parent",vehCol) 
    setElementData(vehCol,"vehicle",true) 
    setElementData(vehCol,"MAX_Slots",20) 
    --Engine + Tires 
    local tires,engine,parts = getVehicleAddonInfos (getElementModel(veh)) 
    setElementData(vehCol,"Tire_inVehicle",math.random(v[5],tires)) 
    setElementData(vehCol,"Engine_inVehicle",math.random(v[6],engine)) 
    setElementData(vehCol,"Parts_inVehicle",math.random(v[7],parts)) 
    --vehicle_indentifikation 
    setElementData(vehCol,"spawn",{v[1], v[2], v[3], v[4]}) 
    --others 
    setElementData(vehCol,"fuel",60) 
  end 

And w "meta" i add line:

Helping somebody? ;/

Link to comment

What is happening? The car isn't spawning properly?

If you're creating a resource by yourself, I mean, in another folder (different of DayZ), remember: getVehicleAddonInfos() is a function of DayZ, and for use it, in this case, you should put your code inside DayZ resource.

Explain better your problem. As I said: the cars isn't spawning?

By the way, change - at meta.xml - the type property. Instead use client, use server.

Link to comment

try this no tested

spawnyPojazdow={ 
  {601, 122.98459625244,2066.1225585938,16.934089660645, 2, 0, 50}, 
      
for i=1,#spawnyPojazdow do 
    ieh = createVehicle(spawnyPojazdow[i][1], spawnyPojazdow[i][2], spawnyPojazdow[i][3], spawnyPojazdow[i][4]) 
    iehCol = createColSphere(spawnyPojazdow[i][2], spawnyPojazdow[i][3], spawnyPojazdow[i][4], 1.5) 
    attachElements (iehCol, ieh, 0, 0, 0 ) 
    setElementData(iehCol,"parent",ieh) 
    setElementData(ieh,"parent",iehCol) 
    setElementData(iehCol,"iehicle",true) 
    setElementData(iehCol,"MAX_Slots",20) 
    --Engine + Tires 
    local tires,engine,parts = getiehicleAddonInfos (getElementModel(ieh)) 
    setElementData(iehCol,"Tire_iniehicle",math.random(spawnyPojazdow[i][5],tires)) 
    setElementData(iehCol,"Engine_iniehicle",math.random(spawnyPojazdow[i][6],engine)) 
    setElementData(iehCol,"Parts_iniehicle",math.random(spawnyPojazdow[i][7],parts)) 
    --iehicle_indentifikation 
    setElementData(iehCol,"spawn",{spawnyPojazdow[i][1], spawnyPojazdow[i][2], spawnyPojazdow[i][3], spawnyPojazdow[i][4]}) 
    --others 
    setElementData(iehCol,"fuel",60) 
  end 

Link to comment

Guys, i succes add the car - and i have some problems. Other cars not spawning ;/

//Edit

I succes destroy this problem.

Next problems is:

I cant put Engine/Tank Parts/Tires to my added vehicle ;/

Code:

for i, veh in ipairs(tankSpawns) do 
    local x, y, z = veh[1], veh[2], veh[3] 
    veh = createVehicle(601, 122.98459625244, 2066.1225585938, 16.934089660645) 
    vehCol = createColSphere(x, y, z, 2) 
    attachElements(vehCol, veh, 0, 0, 0) 
    setElementData(vehCol, "parent", veh) 
    setElementData(veh, "parent", vehCol) 
    setElementData(vehCol, "vehicle", true) 
    setElementData(vehCol, "MAX_Slots", 80) 
    local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) 
    setElementData(vehCol, "Tire_inVehicle", math.random(5, tires)) 
    setElementData(vehCol, "Engine_inVehicle", math.random(6, engine)) 
    setElementData(vehCol, "Parts_inVehicle", math.random(7, parts)) 
    setElementData(vehCol, "spawn", { 
      601, 
      122.98459625244, 
      2066.1225585938, 
      16.934089660645 
     }) 
     setElementData(vehCol, "fuel", 60) 
   end  

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