will briggs Posted June 10, 2011 Share Posted June 10, 2011 Hey, Me again Well im trying to make a gate open on col shape hit but it isnt working... Barrier = createObject ( 968, 1544.6271972656, -1630.3720703125, 13.8182258605957, 0, 0, 0 ) <colrectangle posX="1534.768" posY="-1630.3720703125" posZ="13.8182258605957" width="100" depth="61.8"/> toggle = 0 function toggleBarrier(thePlayer,command) if toggle == 0 then setElementRotation (Barrier, 0, 0, 277) toggle = 1 else setElementRotation (Barrier, 0, 0, 0) toggle = 0 end end function toggleBarrier(thePlayer,command) if toggle == 0 then setElementRotation (Barrier, 0, 0, 277) toggle = 1 else setElementRotation (Barrier, 0, 0, 0) toggle = 0 end end addEventHandler( "onMarkerHit", marker, toggleBarrier ) addEventHandler( "onMarkerHit", marker, toggleBarrier ) Please can someone correct me ? Thanks Link to comment
JR10 Posted June 10, 2011 Share Posted June 10, 2011 (edited) your whole code is f***ed up 1- there are 2 function with the same name which does the same thing , 2- you are creating the colshape wrong its not a map file use createColCircle createColCuboid createColRectangle createColSphere createColTube createColPolygon 3- next time use [lua.][/lua] without the dot Edited June 10, 2011 by Guest Link to comment
Jaysds1 Posted June 10, 2011 Share Posted June 10, 2011 3- next time use [lua.][/lua.] without the dots Actually it's . Link to comment
will briggs Posted June 10, 2011 Author Share Posted June 10, 2011 your whole code is f***ed up1- there are 2 function with the same name which does the same thing , 2- you are creating the colshape wrong its not a map file use createColCircle createColCuboid createColRectangle createColSphere createColTube createColPolygon 3- next time use Dude, the point of this was to ask if someone could correct it for me, can you do so? Link to comment
JR10 Posted June 10, 2011 Share Posted June 10, 2011 Barrier = createObject ( 968, 1544.6271972656, -1630.3720703125, 13.8182258605957, 0, 0, 0 ) Col = createColTube(1534.768, -1630.3720703125, 13.8182258605957, 10, 10) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 277) end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 0) end end ) not tested but should work Link to comment
will briggs Posted June 11, 2011 Author Share Posted June 11, 2011 Ive tested it, and it aint working, can you test it and see please... Link to comment
JR10 Posted June 11, 2011 Share Posted June 11, 2011 Barrier = createObject ( 968, 1544.6271972656, -1630.3720703125, 13.8182258605957, 0, 0, 0 ) Col = createColTube(1544.768, -1630.3720703125, 11.8182258605957, 15, 15) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 277) end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 0) end end ) the col shape was a bit high Link to comment
karlis Posted June 11, 2011 Share Posted June 11, 2011 3- next time use [lua.][/lua.] without the dots Actually it's . both works. Link to comment
SDK Posted June 11, 2011 Share Posted June 11, 2011 Dude, the point of this was to ask if someone could correct it for me, can you do so? Actually, the purpose of this forum is: you have a problem with scripting, we offer guidance on how to fix the problem and how to learn from your mistakes. Not: fix my script plz. Link to comment
will briggs Posted June 11, 2011 Author Share Posted June 11, 2011 Does anyone know how to make it move in one sweep, not just cut to the position? Barrier = createObject ( 968, 1544.69, -1630.8, 13.3, 0, 89, 90 ) Col = createColTube(1544.8, -1630.3720703125, 11.8182258605957, 10, 10) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 0, 90) end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then setElementRotation (Barrier, 0, 90, 90) end end ) Thanks Link to comment
JR10 Posted June 11, 2011 Share Posted June 11, 2011 dont double post use the edit botton ... use move object use the map editor to get the coords of where the object should be and use moveObject(Barrier, 3000, x, y, z) Link to comment
will briggs Posted June 11, 2011 Author Share Posted June 11, 2011 Thanks and sorry for the double post. Link to comment
will briggs Posted June 11, 2011 Author Share Posted June 11, 2011 Hey, I changed it over to moveobject and its started doing alot of crazy stuff when i enter the colshape, can someone test it for me or tell me whats wrong with it... I think its because of the order setelementrotation was in... Heres the code Barrier = createObject ( 968, 1544.69, -1630.8, 13.3, 0, 89, 90 ) Col = createColTube(1544.8, -1630.3720703125, 11.8182258605957, 10, 10) addEventHandler('onColShapeHit', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then if getTeamName(getPlayerTeam(hitElement))=="Police" then playSoundFrontEnd ( 41 ) moveObject(Barrier, 3000, 1544.69, -1630.8, 13.3, 0, 0, 90) end end end ) addEventHandler('onColShapeLeave', Col, function(hitElement, dim) if getElementType(hitElement) == 'player' then if getTeamName(getPlayerTeam(hitElement))=="Police" then moveObject(Barrier, 3000, 1544.69, -1630.8, 13.3, 0, 89, 90) end end end ) Thanks Link to comment
Aibo Posted June 11, 2011 Share Posted June 11, 2011 moveObject uses relative rotation. so to place it back after you've rotated it 90 on Z axis you need to rotate it -90 degrees on Z axis (not by setting object rotation parameters from createObject) Link to comment
will briggs Posted June 11, 2011 Author Share Posted June 11, 2011 I added it and its still pretty messed up... Could you correct it for me? Thanks - You help me with everything 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