manve1 Posted August 23, 2012 Share Posted August 23, 2012 i'm trying to make another script for my server and again it has something wrong with it, debugscript 3 shows no errors, same with console, help me if you can gate = createObject( 980, 2771.3999023438, -2417.8000488281, 15.39999961853, 0, 0, 270 ) createObject( 3749, 2772, -2417.8000488281, 18.299999237061, 0, 0, 90 ) createObject( 2909, 2798, -2430.1999511719, 14.60000038147, 0, 0, 90 ) createObject( 2909, 2797.6000976563, -2405.3000488281, 14.60000038147, 0, 0, 90 ) col = createColRectangle( 2773.0812988281, -2422.6938476563, 2.75, 2 ) function hit() for key, gate in ipairs ( allObjects ) do local origX, origY, origZ = getElementPosition ( gate ) moveObject( gate, 100, 2771.3999023438, -2417.8000488281, 18 ) end end addEventHandler("onColShapeHit", gate, hit) function leave() moveObject( gate, 15000, 2771.3999023438, -2417.8000488281, 15.39999961853) end addEventHandler("onColShapeLeave", gate, leave) EDIT: The gate doesnt move when i hit col, or is something wrong with col shape? please help Link to comment
toptional Posted August 23, 2012 Share Posted August 23, 2012 col = createColRectangle( 2773.0812988281, -2422.6938476563, 2.75, 2 ) gate = createObject( 980, 2771.3999023438, -2417.8000488281, 15.39999961853, 0, 0, 270 ) createObject( 3749, 2772, -2417.8000488281, 18.299999237061, 0, 0, 90 ) createObject( 2909, 2798, -2430.1999511719, 14.60000038147, 0, 0, 90 ) createObject( 2909, 2797.6000976563, -2405.3000488281, 14.60000038147, 0, 0, 90 ) function hit() for key, gate in ipairs ( allObjects ) do local origX, origY, origZ = getElementPosition ( gate ) moveObject( gate, 100, 2771.3999023438, -2417.8000488281, 18 ) end end addEventHandler("onColShapeHit", gate, hit) function leave() moveObject( gate, 15000, 2771.3999023438, -2417.8000488281, 15.39999961853) end addEventHandler("onColShapeLeave", gate, leave) im not sure but try that Link to comment
manve1 Posted August 23, 2012 Author Share Posted August 23, 2012 it wont work... its same thing.. nothing is changed, everything is the same writen, i missed out a part which i dont know about it. But still thx for a try Link to comment
Castillo Posted August 23, 2012 Share Posted August 23, 2012 addEventHandler("onColShapeHit", gate, hit) Here, you are attaching the event to the object, not to the colshape, it should be: addEventHandler("onColShapeHit", col, hit) Link to comment
manve1 Posted August 23, 2012 Author Share Posted August 23, 2012 still doesn't move.. Link to comment
Castillo Posted August 23, 2012 Share Posted August 23, 2012 That's because "allObjects" table is not defined anywhere. gate = createObject( 980, 2771.3999023438, -2417.8000488281, 15.39999961853, 0, 0, 270 ) allObjects = { createObject( 3749, 2772, -2417.8000488281, 18.299999237061, 0, 0, 90 ), createObject( 2909, 2798, -2430.1999511719, 14.60000038147, 0, 0, 90 ), createObject( 2909, 2797.6000976563, -2405.3000488281, 14.60000038147, 0, 0, 90 ) } col = createColRectangle( 2773.0812988281, -2422.6938476563, 2.75, 2 ) function hit() for key, gate in ipairs ( allObjects ) do moveObject( gate, 100, 2771.3999023438, -2417.8000488281, 18 ) end end addEventHandler("onColShapeHit", col, hit) function leave() moveObject( gate, 15000, 2771.3999023438, -2417.8000488281, 15.39999961853) end addEventHandler("onColShapeLeave", col, leave) Link to comment
manve1 Posted August 23, 2012 Author Share Posted August 23, 2012 in the {} bit you forgot "," after 2 objects just letting you know EDIT: it don't move Link to comment
Castillo Posted August 23, 2012 Share Posted August 23, 2012 It is moving the objects, but maybe you didn't want to move these, but the fence. gate = createObject ( 980, 2771.3999023438, -2417.8000488281, 15.39999961853, 0, 0, 270 ) allObjects = { createObject ( 3749, 2772, -2417.8000488281, 18.299999237061, 0, 0, 90 ), createObject ( 2909, 2798, -2430.1999511719, 14.60000038147, 0, 0, 90 ), createObject ( 2909, 2797.6000976563, -2405.3000488281, 14.60000038147, 0, 0, 90 ) } col = createColRectangle ( 2773.0812988281, -2422.6938476563, 2.75, 2 ) function hit ( ) moveObject ( gate, 100, 2771.3999023438, -2417.8000488281, 18 ) end addEventHandler ( "onColShapeHit", col, hit ) function leave ( ) moveObject ( gate, 15000, 2771.3999023438, -2417.8000488281, 15.39999961853 ) end addEventHandler ( "onColShapeLeave", col, leave ) Link to comment
manve1 Posted August 23, 2012 Author Share Posted August 23, 2012 Now it started to work, thanx 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