Jump to content

[HELP]Apllying assignLod to..


Senna

Recommended Posts

Positions = {
    {1941,197.7,2352,25.9,0,0,0,1, true},
    {1943,412.20001,2455.1001,15.5,0,0,90,1, false},
    {1941,268.5,2396.7,25.5,0,0,0,1, true},
}



addEventHandler ("onResourceStart", resourceRoot,
    function()
        for i,v in pairs ( Positions ) do
			assignLOD(createObject(v[1], v[2],v[3], v[4], v[5], v[6], v[7]))
		end 
    end
)

function assignLOD(element)
    local lod = createObject(getElementModel(element),0, 0 ,0, 0, 0, 0, true)
    setElementDimension(lod,getElementDimension(element))
    setElementPosition(lod, getElementPosition(element))
    setElementRotation(lod, getElementRotation(element))
    setElementCollisionsEnabled(lod,false)
    setLowLODElement(element,lod)
    return lod
end

 

  • Like 1
Link to comment
  • Discord Moderators

Or actually not..
 

local positions = {
    {1941, 197.7, 2352,2 5.9, 0, 0, 0},
    {1943, 412.20001, 2455.1001, 15.5, 0, 0, 90},
    {1941, 268.5, 2396.7, 25.5, 0, 0, 0},
}

Now it should be fine.

  • Like 1
Link to comment
1 hour ago, Pirulax said:

Or actually not..
 


local positions = {
    {1941, 197.7, 2352,2 5.9, 0, 0, 0},
    {1943, 412.20001, 2455.1001, 15.5, 0, 0, 90},
    {1941, 268.5, 2396.7, 25.5, 0, 0, 0},
}

Now it should be fine.

 

well, you can do this with the old table

assignLOD(createObject(unpack(v, 1, 7)))

 

Edited by #,xiRocKyz
  • Like 1
  • Thanks 1
Link to comment
On 15.08.2018 at 22:28, !#NssoR_) said:

Positions = {
    {1941,197.7,2352,25.9,0,0,0,1, true},
    {1943,412.20001,2455.1001,15.5,0,0,90,1, false},
    {1941,268.5,2396.7,25.5,0,0,0,1, true},
}



addEventHandler ("onResourceStart", resourceRoot,
    function()
        for i,v in pairs ( Positions ) do
			assignLOD(createObject(v[1], v[2],v[3], v[4], v[5], v[6], v[7]))
		end 
    end
)

function assignLOD(element)
    local lod = createObject(getElementModel(element),0, 0 ,0, 0, 0, 0, true)
    setElementDimension(lod,getElementDimension(element))
    setElementPosition(lod, getElementPosition(element))
    setElementRotation(lod, getElementRotation(element))
    setElementCollisionsEnabled(lod,false)
    setLowLODElement(element,lod)
    return lod
end

 

 

20 hours ago, #,xiRocKyz said:

 

well, you can do this with the old table


assignLOD(createObject(unpack(v, 1, 7)))

 

These codes don't work.

Errors:

[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5270: Bad argument @ 'getElementModel' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5270: Bad argument @ 'createObject' [Expected number at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5271: Bad argument @ 'getElementDimension' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5271: Bad argument @ 'setElementDimension' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5272: Bad argument @ 'getElementPosition' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5272: Bad argument @ 'setElementPosition' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5273: Bad argument @ 'getElementRotation' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5273: Bad argument @ 'setElementRotation' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5274: Bad argument @ 'setElementCollisionsEnabled' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5275: Bad argument @ 'setLowLODElement' [Expected element at argument 1, got boolean]
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5264: Bad argument @ 'setObjectScale' [Expected object at argument 1, got number '1']
[2018-08-16 20:26:45] WARNING: servermapp\server.lua:5265: Bad argument @ 'setElementDoubleSided' [Expected element at argument 1, got boolean]

Also, objects don't create

Link to comment

 

Positions = {
    {1941,197.7,2352,25.9,0,0,0,1, true},
    {1943,412.20001,2455.1001,15.5,0,0,90,1, false},
    {1941,268.5,2396.7,25.5,0,0,0,1, true},
}



addEventHandler ("onResourceStart", resourceRoot,
    function()
        for i,v in ipairs ( Positions ) do
			local OB = createObject(unpack(v,1,7))
			setElementDoubleSided(OB, v[9]) 
			assignLOD(OB,v[8])
		end 
    end
)

function assignLOD(element,Scale)
    local lod = createObject(getElementModel(element),0, 0 ,0, 0, 0, 0, true)
    setElementDimension(lod,getElementDimension(element))
    setElementPosition(lod, getElementPosition(element))
    setElementRotation(lod, getElementRotation(element))
	setObjectScale(element, Scale)
	setObjectScale(lod, Scale)
    setElementCollisionsEnabled(lod,false)
    setLowLODElement(element,lod)
    return lod
end

 

  • Thanks 1
Link to comment
On 17.08.2018 at 15:27, !#NssoR_) said:

 


Positions = {
    {1941,197.7,2352,25.9,0,0,0,1, true},
    {1943,412.20001,2455.1001,15.5,0,0,90,1, false},
    {1941,268.5,2396.7,25.5,0,0,0,1, true},
}



addEventHandler ("onResourceStart", resourceRoot,
    function()
        for i,v in ipairs ( Positions ) do
			local OB = createObject(unpack(v,1,7))
			setElementDoubleSided(OB, v[9]) 
			assignLOD(OB,v[8])
		end 
    end
)

function assignLOD(element,Scale)
    local lod = createObject(getElementModel(element),0, 0 ,0, 0, 0, 0, true)
    setElementDimension(lod,getElementDimension(element))
    setElementPosition(lod, getElementPosition(element))
    setElementRotation(lod, getElementRotation(element))
	setObjectScale(element, Scale)
	setObjectScale(lod, Scale)
    setElementCollisionsEnabled(lod,false)
    setLowLODElement(element,lod)
    return lod
end

 

Thank you! Works fine! It is what I wanted 

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