Jump to content
Mr. Green Gaming

Move objects


Recommended Posts

Posted

Hey :D

I'm editing an old map but I want to move some objects.

I already know how the moveObject function works, but I want it to return after an X amount of time.

Posted (edited)

I came on setTimer as well so is this a good script?

function ClientStarted ()
setSkyGradient( 255, 0, 0, 255, 0, 0)
end

function ObjectsRotateStart ()
moveObject(rotate1, 10000, -4475.867188, -2251.131836, 494.547363, 0, 180, 0)
moveObject(rotate2, 10000, -4475.867188, -2251.131836, 494.547363, 0, 180, 0)
end

setTimer(ObjectsRotateStart, 10000, 0)


addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), ClientStarted )
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), ObjectsRotateStart )

2 objects(Rotate1 and rotate2) will be continuously rotating and complete 1 rotation in 20 seconds, right?

Edited by Lukkie
Posted (edited)

Bumpediebump

If I try testing my map, it always says: Error loading map editor_test

Try to test your scripts on your own server, and this patch for the map editor: http://forums.left4g...dpost__p__32618

Script looks okay for me, but I'd let the moveObject start onResourceStart so that the objects moving will be synced to everyone

I think that patch won't work but I'll give it a try. EDIT: No download O_O?

And won't onClientResourceStart be better? Because it starts for players who joined after the resource has started.

Edited by Lukkie
Posted

Bumpediebump

If I try testing my map, it always says: Error loading map editor_test

Try to test your scripts on your own server, and this patch for the map editor: http://forums.left4g...dpost__p__32618

I think that patch won't work but I'll give it a try. EDIT: No download O_O?

I think this post. I have the same error too.. the patch doesn't work for me but I probably didn't do it right.

Posted

Fix doesnt solve it.

btw, is it right that most of the maps in server/mods/deathmatch/resources are .zip?

Most of them? I think that it are all ".zip"s, and in each zip is a mapfile and a meta.xml file.

Posted

Fix doesnt solve it.

btw, is it right that most of the maps in server/mods/deathmatch/resources are .zip?

Most of them? I think that it are all ".zip"s, and in each zip is a mapfile and a meta.xml file.

Yup, but I sometimes get an error saying that it failed loading the meta.xml :o

I checked it and they have a meta.xml :l

race-strangersv2-lukkie.zip

Here is my map if someone is willing to test it

Posted

Yup its a dm map, but the objects arent rotating yet.

Im working on a new script, I added a second type of speedboosts, wich multiplies your speed with 0.5 :lol:

That actually is useful if you dont want people to go to a high platform :o

Posted (edited)

Fixed your rotation problem with the previous version (but you used the same coordinates twice, still got to fix that one)

function ClientStarted ()
setSkyGradient( 255, 0, 0, 255, 0, 0)
end

function ObjectsRotateStart ()
moveObject(objectje1, 10000, -4475.867188, -2251.131836, 494.547363, 0, 180, 0)
moveObject(objectje2, 10000, -4475.867188, -2251.131836, 494.547363, 0, 180, 0)
end
objectje1 = getElementByID ( "rotate1" )
objectje2 = getElementByID ( "rotate2" )
setTimer(ObjectsRotateStart, 10000, 0)



addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), ClientStarted )
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), ObjectsRotateStart )

Perhaps it helps to figure out your new problems

Edited by .:SDK:.
Posted

The problem is, I deleted my moving objects because of this script..

function BeweegEen()
myGate = createObject ( 11292, -4517.195313, -2318.044678, 462.413910, 0.000000, 0.000000, 0.000000 )
moveIt()
end

addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), BeweegEen )

function moveIt ()
moveObject ( myGate, 6000, -4489.911621, -2269.242920, 455.263397, 0.000000, 0.000000, 0.000000 )
setTimer ( moveBack, 4000, 1 )
end

function moveBack ()
moveObject ( myGate, 6000, -4517.195313, -2318.044678, 462.413910, 0.000000, 0.000000, 0.000000 )
setTimer (moveIt, 4000, 1 )
end

function BeweegTwee()
myPoort = createObject ( 3458, -4528.239746, -2326.831055, 449.295074, -3.141592, 0.000000, 0.000000 )
movePoort()
end

addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), BeweegTwee )

function movePoort ()
moveObject ( myPoort, 6000, -4528.239746, -2324.831055, 469.820068, 0.000000, 0.000000, 0.000000 )
setTimer ( movepoortBack, 4000, 1 )
end

function movepoortBack ()
moveObject ( myPoort, 6000, -4528.239746, -2326.831055, 449.295074, 0.000000, 0.000000, 0.000000 )
setTimer (movePoort, 4000, 1 )
end

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...