Lukkie Posted April 3, 2010 Share Posted April 3, 2010 Hey 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. Quote Link to comment
SDK Posted April 3, 2010 Share Posted April 3, 2010 I assume you're already familiar with mta scripting? Timers : http://wiki.mtasa.com/wiki/SetTimer Quote Link to comment
Lukkie Posted April 3, 2010 Author Share Posted April 3, 2010 (edited) I came on setTimer as well so is this a good script?function ClientStarted ()setSkyGradient( 255, 0, 0, 255, 0, 0)endfunction 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)endsetTimer(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 April 3, 2010 by Lukkie Quote Link to comment
Lukkie Posted April 3, 2010 Author Share Posted April 3, 2010 (edited) BumpediebumpIf I try testing my map, it always says: Error loading map editor_test Edited April 3, 2010 by Lukkie Quote Link to comment
SDK Posted April 3, 2010 Share Posted April 3, 2010 BumpediebumpIf I try testing my map, it always says: Error loading map editor_testTry to test your scripts on your own server, and this patch for the map editor: http://forums.left4g...dpost__p__32618Script looks okay for me, but I'd let the moveObject start onResourceStart so that the objects moving will be synced to everyone Quote Link to comment
Lukkie Posted April 3, 2010 Author Share Posted April 3, 2010 (edited) BumpediebumpIf I try testing my map, it always says: Error loading map editor_testTry to test your scripts on your own server, and this patch for the map editor: http://forums.left4g...dpost__p__32618Script looks okay for me, but I'd let the moveObject start onResourceStart so that the objects moving will be synced to everyoneI 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 April 3, 2010 by Lukkie Quote Link to comment
BlueYoshi97 Posted April 3, 2010 Share Posted April 3, 2010 BumpediebumpIf I try testing my map, it always says: Error loading map editor_testTry to test your scripts on your own server, and this patch for the map editor: http://forums.left4g...dpost__p__32618I 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. Quote Link to comment
Lukkie Posted April 3, 2010 Author Share Posted April 3, 2010 Fix doesnt solve it.btw, is it right that most of the maps in server/mods/deathmatch/resources are .zip? Quote Link to comment
BlueYoshi97 Posted April 3, 2010 Share Posted April 3, 2010 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. Quote Link to comment
Lukkie Posted April 3, 2010 Author Share Posted April 3, 2010 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 I checked it and they have a meta.xml :lrace-strangersv2-lukkie.zipHere is my map if someone is willing to test it Quote Link to comment
BlueYoshi97 Posted April 3, 2010 Share Posted April 3, 2010 race-strangersv2-lukkie.zipHere is my map if someone is willing to test itTried to, but Map Editor can't seem to find it in the list, and I can't extract the file either. I don't know why though... may be my PC... Quote Link to comment
Lukkie Posted April 3, 2010 Author Share Posted April 3, 2010 I tested it in a server; I dont really like the objects I rotated but my speedboosts are working properly Quote Link to comment
Juggernaut Posted April 3, 2010 Share Posted April 3, 2010 It looks cool, and I like the speed boosts. Is this a DM map? Quote Link to comment
Lukkie Posted April 4, 2010 Author Share Posted April 4, 2010 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 That actually is useful if you dont want people to go to a high platform Quote Link to comment
Lukkie Posted April 4, 2010 Author Share Posted April 4, 2010 Can someone unbug my map?The objects wont spawn :lDo I also have to place them in my .map if im using createObject?race-strangersv2-lukkie.zip Quote Link to comment
SDK Posted April 4, 2010 Share Posted April 4, 2010 (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)endfunction 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)endobjectje1 = 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 April 4, 2010 by .:SDK:. Quote Link to comment
Lukkie Posted April 4, 2010 Author Share Posted April 4, 2010 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()endaddEventHandler ( "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 )endfunction BeweegTwee() myPoort = createObject ( 3458, -4528.239746, -2326.831055, 449.295074, -3.141592, 0.000000, 0.000000 )movePoort()endaddEventHandler ( "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 Quote Link to comment
SDK Posted April 4, 2010 Share Posted April 4, 2010 In the meta.xml: <script src="Movement.lua" type="client" />-to- <script src="Movement.lua"/>Debugging Quote Link to comment
Lukkie Posted April 4, 2010 Author Share Posted April 4, 2010 Worked; thanks Im working on a marker in wich you get a vehicle weapon Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.