Pilot

Moving Big amount of Objects

Recommended Posts

Hello,

I'm making maps for a server, Full Theft Auto

and I have some Map Editor problems:

I created a very good Club, but the location of it have been changed,

I need to move the club with all it's content (bottles, speakers, lights, etc.) to a different city, from LV to SF

Please help me, I don't know how to move it, is there some kind of a moving option or what?

Share this post


Link to post

no, you need script converter, or if you dont know scripting just change x,y,z values with notepad

Share this post


Link to post

Here's a basic mass move script:

local ElementTypes =  { "object", "pickup", "marker", "vehicle", "blip" }
 
function batchMoveElements(elements, dx, dy, dz)
for _,e in ipairs(elements) do
local x, y, z = getElementPosition(e)
	x = x + dx
	y = y + dy
	z = z + dz
setElementPosition(e, x, y, z)
triggerEvent("syncProperty", root, "position", {x, y, z}, e)
end
end
 
function consoleMoveObjects(playerSource, command, dx, dy, dz, elementTypes)
dx, dy, dz = tonumber(dx) or 0, tonumber(dy) or 0, tonumber(dz) or 0
for _,elementType in pairs(ElementTypes) do
if (elementTypes and elementType == elementTypes) or not elementTypes then
local elements = getElementsByType(elementType)
if elements then
			batchMoveElements(elements, dx, dy, dz)
end
end
end
end
addCommandHandler("mmove", consoleMoveObjects)

You just have to run this resource while editing your map, open up the console and type mmove x y z, where x, y, and z is the result of your guesswork. ;)

Share this post


Link to post

all fine, except that if you will rotate objects like this objects will get messed up, you need some trigonometrical functions for that

Share this post


Link to post

This script will only move objects from one place to another, as per OP request:

to move the club with all it's content (bottles, speakers, lights, etc.) to a different city, from LV to SF

Share this post


Link to post

It doesn't work, you said the resource, so I made a resource for my first time

I made meta.xml with this content:

And 1move.lua with with script that you gave me, I started the resource, opened the and typed: mmove X, Y, Z (coordinates instead of x, y, z ), It didn't do anything

and I did load the map.

What did I do wrong?

For 1move.lua I just copied the script you gave me

EDIT: IT does work but not what I need, It moves it back and forward by coordinates you tell it

i.e. I put mmove 0, 0, 22 it moves it forward by 22 coordinates

or it can go up or down by coordinates, mmove 0, 0, 0, 5 to go up by 5

the first 2 numbers don't do anything at all.

How do you go left and right? If I knew that I could solve my problem, could take a little longer, but I could solve it that way, if there was a way!

Share this post


Link to post

add it as resource with proper meta, and write mmove x y z objects but i dont see need for that trigger at line 10

Share this post


Link to post

With this script, the x y z coordinates, is that the change in x y z values that we want the items so +50 along z, +1000 in y etc? Or do we input the new coordinates that we want these items to be moved to?

if that makes sense.

Share this post


Link to post
With this script, the x y z coordinates, is that the change in x y z values that we want the items so +50 along z, +1000 in y etc?

Yes, the parameters should be deltas, not final coordinates.

Share this post


Link to post

dont work for the pickups and spawnpoints, very strangely with 40 pickups just 2 or 3 have moved

Share this post


Link to post

You can add more element types to move by editing first line:

local ElementTypes =  { "object", "pickup", "marker", "vehicle", "blip", "racepickup", "spawnpoint" }

Here, "racepickup" and "spawnpoint" are used in race maps. If you have maps for other game modes, you'll have to add the element types that those game modes require.

Share this post


Link to post
You can add more element types to move by editing first line:
local ElementTypes =  { "object", "pickup", "marker", "vehicle", "blip", "racepickup", "spawnpoint" }

Here, "racepickup" and "spawnpoint" are used in race maps. If you have maps for other game modes, you'll have to add the element types that those game modes require.

Thats rich man !!! Thanks im noob on this because i put pickup and not racepickup xD, but spawnpoint dont work I try, but thats is not bad at all, because spawnpoints are easy do do again , pickups no.

Share this post


Link to post

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.