xScatta Posted August 7, 2013 Posted August 7, 2013 Yeah so there we are here its a problem function brama() lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) x, y, z = 316.79, -1191.80, 74.90 x1, y1, z1 = getElementPosition ( lol ) if ( x1, y1, z1 == x, y, z ) then moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) elseif ( x1, y1, z1 == x, y, z ) then moveObject ( lol, 2.5, 316.79, -1191.80, 74.90, 0, 0, 40 ) end end addCommandHandler("brama", brama ) problem is in the if ( x1, y1, z1 == x, y, z ) then debug script says ')' expected near ',' i dont know why because i maked many scripts like this but this dont work why? any repair
xXMADEXx Posted August 7, 2013 Posted August 7, 2013 ((Not Tested)) lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) local isGateOpen = false; function brama() if ( not isGateOpen ) then moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) isGateOpen = true else moveObject ( lol, 2.5, 316.79, -1191.80, 74.90, 0, 0, 40 ) isGateOpen = false end end addCommandHandler("brama", brama )
xScatta Posted August 7, 2013 Author Posted August 7, 2013 Not working because after third use of command gate teleports not in the place it must.
isa_Khamdan Posted August 7, 2013 Posted August 7, 2013 (edited) Deleted Edited August 7, 2013 by Guest
xScatta Posted August 7, 2013 Author Posted August 7, 2013 Omg thats stupid i want to repair my script not edit someone else ;-; and i wanna make it at command... Any good scripter here?
iMr.3a[Z]eF Posted August 7, 2013 Posted August 7, 2013 lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) function move() if lol then moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) else moveObject ( lol, 2.5, 316.79, -1191.80, 74.90, 0, 0, 40 ) end end addCommandHandler("brama", move )
xScatta Posted August 7, 2013 Author Posted August 7, 2013 Opening gate only works when i say /brama then brama opens but when i say /brama again then nothing happen. any scripter here can help?
motax Posted August 7, 2013 Posted August 7, 2013 local lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) local state = 0 function move() if state == 0 then moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) state = state + 1 elseif state == 1 then moveObject ( lol, 2.5, 316.79, -1191.80, 74.90, 0, 0, 40 ) state = state - 1 end end addCommandHandler("brama", move ) Try this
xScatta Posted August 7, 2013 Author Posted August 7, 2013 Like before at third use of command the gate teleport not in the place it must.
motax Posted August 7, 2013 Posted August 7, 2013 local lol = createObject ( 987, 316.79, -1191.80, 74.90, 0, 0, 40 ) local state = 0 function move() if state == 0 then moveObject ( lol, 2.5, 316.79, -1191.80, 69 ) state = state + 1 elseif state == 1 then moveObject ( lol, 2.5, 316.79, -1191.80, 74.90) state = state - 1 end end addCommandHandler("brama", move ) It must be work this way now! I tested it. The problem was that, the rotation is relative when you use moveObject()
xScatta Posted August 7, 2013 Author Posted August 7, 2013 Ok it works thanks! But what means "relative"?
motax Posted August 7, 2013 Posted August 7, 2013 moveObject ( lol, 2.5, 316.79, -1191.80, 69, 0, 0, 40 ) It means that every time you use "brama" it'll rotate it's Z axis with +40 and not set it to 40.
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