[Ska]Vladmo Posted April 5, 2008 Share Posted April 5, 2008 OK, on WCFR (West Coast FreeRoam) theres a area51 and you can use commands to open the gates, like the gates open likeyou say open seasame, how would you do this? How do you create objects and how do you make it animate like that? Link to comment
Morelli Posted April 6, 2008 Share Posted April 6, 2008 Take a look at the Object Functions, which can be seen by a simple search on the MTA wiki. Link to comment
[Ska]Vladmo Posted April 6, 2008 Author Share Posted April 6, 2008 Take a look at the Object Functions, which can be seen by a simple search on the MTA wiki.That didn't really help me because they didn't explain, could anyone else explain this to me how to do this? Link to comment
Morelli Posted April 6, 2008 Share Posted April 6, 2008 Either make an object by importing a .map file, or with createObject. When you want to move an object, depending on how you want to trigger (command, etc.), use the function moveObject. Take a look at the 'Hay' code and you'll see how they move their objects. Link to comment
[Ska]Vladmo Posted April 6, 2008 Author Share Posted April 6, 2008 I took a look at the hay code and all they had was the random x y z, I want it to tell where I want it to go, just like a gate like this: |------------||------------| |------------||------------| |------------||------------| Then it opens like this: |------| <<<<<<< >>>>>>> |------| |------| <<<<<<< >>>>>>> |------| |------| <<<<<<< >>>>>>> |------| vv |---| <<<<<<< >>>>>>> |---| |---| <<<<<<< >>>>>>> |---| |---| <<<<<<< >>>>>>> |---| That's how I seen it, and when you type a command it opens like that, still need more help, and yes I did take a look at moveObject and createObject, I will double check. Link to comment
CodeMaster Posted April 6, 2008 Share Posted April 6, 2008 Valdmo Morelli has told you enough... And its normal that wiki uses random values. You can't say open seasame to wiki to it work out the script excatly how you need it! Theres example how its done, but u have to get right coords manually. I made a script for gaining needed coords. I'll ul them later, but everything u need is to get right coords for both states. And you will need some math skills if you want em to be perfectly positioned. Thats all you are gonna need I hope you can gather that I would do it, but I'm busy with another request, so I'll see what can I do later. Nidza Link to comment
[Ska]Vladmo Posted April 6, 2008 Author Share Posted April 6, 2008 Valdmo Morelli has told you enough...And its normal that wiki uses random values. You can't say open seasame to wiki to it work out the script excatly how you need it! Theres example how its done, but u have to get right coords manually. I made a script for gaining needed coords. I'll ul them later, but everything u need is to get right coords for both states. And you will need some math skills if you want em to be perfectly positioned. Thats all you are gonna need I hope you can gather that I would do it, but I'm busy with another request, so I'll see what can I do later. Nidza I know you can't just say open seasame in the chatbox and it will open.... I was saying an example, and he can do whatever he wants with his answers. Edit: and I said it has already been created, if other people can do it, I can too. Link to comment
CodeMaster Posted April 6, 2008 Share Posted April 6, 2008 Yeah my mistake, didn't read well, I was in a rush Sorry BTW: I made a bit advanced fuel script, I'll release it tomorrow, so you can check it out. This one is working with distance traveled not with time passed so it gives more accurate results Link to comment
[Ska]Vladmo Posted April 6, 2008 Author Share Posted April 6, 2008 BTW: I made a bit advanced fuel script, I'll release it tomorrow, so you can check it out. This one is working with distance traveled not with time passed so it gives more accurate results Yes! Please do so! That would be very thoughtful of you, me and my friends like traveling though the freeway and it would be way more fun with fuel! If this is what your talking about? Edit: Also please don't go off topic, post in my fuel topic. Link to comment
[Ska]Vladmo Posted April 8, 2008 Author Share Posted April 8, 2008 C-mon guys, I really want this to work. Link to comment
CodeMaster Posted April 8, 2008 Share Posted April 8, 2008 Vladmo I don't think we are able to make it fit perfectly without MTA's map editor. It's most precise tool to do such things, because I guess the ppl on server on which u saw that was doing a coords changing by script until it fit perfectly... Maybe I'm wrong, I'm also curious about that... Link to comment
Brophy Posted April 8, 2008 Share Posted April 8, 2008 You can position the gates right in map editor then convert the map from race > dm, then script them to open Link to comment
CodeMaster Posted April 8, 2008 Share Posted April 8, 2008 Yeah BrophY is right, I have totally forgoten that Race map editor exists ^^ Link to comment
TheDeepFriedBoot Posted April 8, 2008 Share Posted April 8, 2008 We did use the old MTA map editor to get the coordinates of the gates, but thats all. Link to comment
[Ska]Vladmo Posted April 8, 2008 Author Share Posted April 8, 2008 We did use the old MTA map editor to get the coordinates of the gates, but thats all. Okay Deepfried, i'll try and figure it out and thank you all. Link to comment
Vercetti1010 Posted April 10, 2008 Share Posted April 10, 2008 since I am the maker of this script i can shed some light about how to do it. im not copying and pasting becasue teh script is huge and you would need to have our map file for it to appear normal. what you need to do is this open map editor (mtasa race) and place objects that do not move place the gates in a closed position and note the object ID and the xyz coorinates do the same for the open position make a function that creates the gates (i.e. gate = createObject ( ObjectID, X, Y, Z )) make a function that moves the gates to an open poition and do the same for closed ( moveObject ( gate, time, openX, openY, openZ ) ) then put it in the way you want to trigger it, if command put addCommandHandler ( "opensesame", openGate ) or maybe if you are feeling crafty make a colSphere so it opens when you enter it and closes when you leave it. it is all up to you. just check the wiki for info if you are stuck. Link to comment
[Ska]Vladmo Posted April 10, 2008 Author Share Posted April 10, 2008 since I am the maker of this script i can shed some light about how to do it. im not copying and pasting becasue teh script is huge and you would need to have our map file for it to appear normal. what you need to do is thisopen map editor (mtasa race) and place objects that do not move place the gates in a closed position and note the object ID and the xyz coorinates do the same for the open position make a function that creates the gates (i.e. gate = createObject ( ObjectID, X, Y, Z )) make a function that moves the gates to an open poition and do the same for closed ( moveObject ( gate, time, openX, openY, openZ ) ) then put it in the way you want to trigger it, if command put addCommandHandler ( "opensesame", openGate ) or maybe if you are feeling crafty make a colSphere so it opens when you enter it and closes when you leave it. it is all up to you. just check the wiki for info if you are stuck. Ok thanks Vercetti and what do you mean do the same for the open position? Link to comment
tma Posted April 10, 2008 Share Posted April 10, 2008 Here's a quick gate thing - just dumps one in the world at (0,0,0) and two commands "up" and "down". Move it to where you want it (rotate it on create object also ?) and control it how you need. But it's basically something like this: gGate = { x = 0,y = 0, z = 6, zMove = 6, model = 971, moveTime = 3000, down = true } addEventHandler("onResourceStart",getRootElement(), function(res) if res == getThisResource() then gGate.object = createObject(gGate.model,gGate.x,gGate.y,gGate.z) end end ) function gGate.moveFinished() gGate.down = not gGate.down gGate.timer = nil end function gGate.move(gateState,zDiff) if (gGate.timer == nil) and (gGate.down == gateState) then local x,y,z = getElementPosition(gGate.object) moveObject(gGate.object,gGate.moveTime,x,y,z + zDiff) gGate.timer = setTimer(gGate.moveFinished,gGate.moveTime,1) end end addCommandHandler('up', function(player,cmd) gGate.move(true,gGate.zMove) end ) addCommandHandler('down', function(player,cmd) gGate.move(false,-gGate.zMove) end ) If you want more gates/control/options etc. get scripting and modify this (or a similar code snippet). Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now