Lavire Posted May 20, 2011 Share Posted May 20, 2011 (edited) Hey there, I'm working with colShapes for quite some time now, and they've worked so far. But now I'm working on a command where I need to know the objects in the player's range. The colShape is being created (I tested it already), but it says there is only 1 object in range (the player himself). local x, y, z = getElementPosition(thePlayer) local atmSphere = createColSphere(tonumber(x), tonumber(y), tonumber(z), tonumber(20.0)) local atms = getElementsWithinColShape(atmSphere) outputChatBox(tostring(table.getn(atms))) What am I doing wrong? Edited May 22, 2011 by Guest Link to comment
qaisjp Posted May 20, 2011 Share Posted May 20, 2011 Create a vehicle next to yourself and test it. Link to comment
Lavire Posted May 20, 2011 Author Share Posted May 20, 2011 Hm, with the vehicle it works. If it helps: the object is being created in a .map file, not in the script itself. What could it be? Link to comment
qaisjp Posted May 20, 2011 Share Posted May 20, 2011 try going nearer to the element. are you right next to it? Link to comment
Lavire Posted May 20, 2011 Author Share Posted May 20, 2011 Yes, I'm right next to it. I expanded the range too, no success... Link to comment
qaisjp Posted May 20, 2011 Share Posted May 20, 2011 Make an element of the same model next to yourself using createObject Link to comment
Lavire Posted May 20, 2011 Author Share Posted May 20, 2011 Yes, when I create it ingame it works... so what is the problem with loading it with .map files? Something with collisions maybe? Link to comment
Lavire Posted May 20, 2011 Author Share Posted May 20, 2011 (edited) Oh, here's an example of the .map file, in which the objects are defined: <object id="atm8" doublesided="false" model="2942" interior="0" dimension="0" posX="-1980.5885009766" posY="131.54470825195" posZ="27.33039855957" rotX="0" rotY="0" rotZ="270" type="atm" /> Edited May 22, 2011 by Guest Link to comment
qaisjp Posted May 20, 2011 Share Posted May 20, 2011 Now without creating the object with script, restart the resource that contains the map file. and see if it finds it then. Link to comment
Lavire Posted May 20, 2011 Author Share Posted May 20, 2011 I restarted the server a hundreds of times... still won't work =/ Btw: it recognizes other objects created by other .map files, just not the .map file with my ATMs... Link to comment
qaisjp Posted May 20, 2011 Share Posted May 20, 2011 remove the part type="atm" and then test it Link to comment
Lavire Posted May 20, 2011 Author Share Posted May 20, 2011 nope, still no luck, even when removing the type-tag... Link to comment
Lavire Posted May 22, 2011 Author Share Posted May 22, 2011 *push* Still no solution? It recognizes ALL other objects in other .map files, just my ATMs in my atm.map not... Link to comment
qaisjp Posted May 22, 2011 Share Posted May 22, 2011 Definitely weird, I have no idea what to do then. I will try and get more people to see this topic and if they can't fix it I recommend you report it to MTA Bug Tracker EDIT: Really sorry for the late reply, I know how it feels when someone doesn't help you. Link to comment
Lavire Posted May 24, 2011 Author Share Posted May 24, 2011 Just for the ones having the same problem: You have to add an collision="1" to each of your objects in the .map file, if you want them to be collided with colShapes. Thanks anyways for the help, qaisjp. Link to comment
qaisjp Posted May 24, 2011 Share Posted May 24, 2011 No problem, glad you solved your problem. 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