Jump to content

Attach Object to (MOVE OBJECT TOGHETER)


DonPro

Recommended Posts

local object1 = createObject(9585, -2040.5999755859, 1442, 7, 0, 0, 0) 
local obj1X, obj1Y, obj1Z = getElementPosition(object1) 
local object2 = createObject(9586, obj1X-2.2998046875, obj1Y, obj1Z+10.1, 0, 0, 0) 
local object3 = createObject(9584, obj1X+20.400390625, obj1Y, obj1Z+17, 0, 0, 0) 
local object4 = createObject(9698, obj1X+31.9, obj1Y-1.17, obj1Z+19.9, 0, 0, 0) 
attachElements(object2,object1,-2.2998046875,0,10.1) -- attach object2 to object1 
attachElements(object3,object1,20.400390625,0,17) -- attach object2 to object1 
attachElements(object4,object1,31.9,-1.17,19.9) -- attach object2 to object1 
  
local moveTable = { 
--{time, x, y, z, rotX, rotY, rotZ}, 
{60000, -2040.59, 1598.5, 7, 0, 0, 0}, 
{60000, -3111.19, 1764.19, 7, 0, 0, 180}, 
{60000, -3204.80, -2873.5, 7, 0, 0, 270}, 
} 
  
function move() 
    for k,v in ipairs(moveTable) do 
        if k == 1 then 
        moveObject(object1, unpack(v)) 
        else 
        local time = 0 
            if k ~= 2 then 
                for i=1,k-1 do 
                time = time + moveTable[i][1] 
                end 
            else 
                time = moveTable[1][1] 
            end 
        setTimer(moveObject,time,1,object1, unpack(v)) 
        end 
    end 
end 
  
function moveGate(playerSource, cmd) 
    if cmd == "gostart" then 
        if isAclGroup(playerSource,"Maritime") then 
        move() 
        end 
    end 
end 
addCommandHandler("gostart", moveGate) 

Hi, i wonder why the ship speed up for each cordinat/check point it hit, then the object speed up and sometimes speed down i dont understand o.O i tought the speed should go down when i raise the value on the SPEED :P i hope you can help me with that, its pretty anoying, and i tryed to lower, and raise the speed but nothing helps. :P

Link to comment

{time, x, y, z, rotX, rotY, rotZ}

time = the time that the ship should move from position to the next position

when you put 2 points that are so far with 60000 milliseconds the ship gonna move with a diffrent speed if the 2 points was close with 60000 milliseconds

Link to comment
{time, x, y, z, rotX, rotY, rotZ}

time = the time that the ship should move from position to the next position

when you put 2 points that are so far with 60000 milliseconds the ship gonna move with a diffrent speed if the 2 points was close with 60000 milliseconds

Ahh okey, i didnt understand much :S but this is what i got now, this is just a test speed i made to test it fast on 5000time.

local moveTable = { 
--{time, x, y, z, rotX, rotY, rotZ}, 
{5000, 2896.19, -2397.39, 3.70, 0, 0, 0}, 
{5000, 2896.19, -2762.60, 3.70, 0, 0, -90}, 
{5000, 2854, -2874.60, 3.70, 0, 0, 90}, 
{-5000, 1162.09, -2874.60, 3.70, 0, 0, -90}, 
{45000, 880.70, -2146.5, 3.70, 0, 0, 90}, 
{55000, 880.70, -1884.09, 3.70, 0, 0, 90}, 
} 

Link to comment

so the ship have to go as fast as 50 millisecound? pleas show me in script what you mean :S i dont understand what ya'll talking about :/

Check the wiki page before u start asking all what you need is here : SetTimer

Thanks! i will check this out, i just started scripting just trying to learn :)

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