Villr Owner/Leader
Total Posts : 312 Join date : 2011-07-24 Age : 25 Location : Sweden
| Subject: Creating an gate that opens and close. Sat Mar 30, 2013 6:46 pm | |
| Hello! Now im going to show you you make a gate open with a command example: You write /opengate and then will the gate open. /closegate and then will it close. Its pretty simple. First we just have to create our gate object. - Code:
-
local myVillrGate=createObject (988,0,0,3,0,0,90) In my case im using the gate with objectid 988, and i placed it at 0 0 3. The first 0 0 3 is x,y,z and the other 0,0,90 is the rotation on the gate. Ok so lets add the commands now also so we can move our gate. - Code:
-
local myVillrGate=createObject (988,0,0,3,0,0,90) function openVillrGate () moveObject ( myVillrGate,1000,0,5,3) end addCommandHandler ( "opengate", openVillrGate)
function closeVillrGate() moveObject ( myVillrGate ,1000,0,0,3) end addCommandHandler ( "closegate", closeVillrGate) Ok so what you have to type in to the moveObject script line is, - Code:
-
moveObject(theGateName,howmanyseconds,x,y,z) The seconds is how long it will take to move the gate. addCommandHandler is the thing that adds the /opengate and /closegate command. How im closing the gate is that im moving it back to the position where it was from the beginning where it was created. Voila!You have now put in the rest of the code and now you can create a gate you can open/close trough a command! | |
|