Pickanothername Posted February 19, 2022 Share Posted February 19, 2022 How do I attach a player to a map element? So if I would, for example, stand on a lamp that was created with a map editor and after entering the command / glue, I would attach to it Link to comment
βurak Posted February 19, 2022 Share Posted February 19, 2022 use these functions attachElements -- to add an object to the player processLineOfSight -- to detect the object the player is standing on addCommandHandler --for the glue command Link to comment
Pickanothername Posted February 19, 2022 Author Share Posted February 19, 2022 @Burak5312 Can you write a sample script so I know what to base on? Link to comment
Hydra Posted February 19, 2022 Share Posted February 19, 2022 local w, h = guiGetScreenSize () function glue(thePlayer, cmd) local tx, ty, tz = getWorldFromScreenPosition ( w/2, h/2, 50 ) local px, py, pz = getCameraMatrix() local hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz ) if hit then attachElements(theElement, theElementToAttach, posX, posY, posZ, rotX, rotY, rotZ) end end addCommandHandler("glue", glue) Something like that. Didn't tested it so it may not work but with something like this you can make want you want Link to comment
Pickanothername Posted February 20, 2022 Author Share Posted February 20, 2022 @Hydra Thanks bro! Link to comment
Pickanothername Posted February 20, 2022 Author Share Posted February 20, 2022 @Hydra It's Work't local w, h = guiGetScreenSize () function glue(thePlayer, cmd) local tx, ty, tz = getWorldFromScreenPosition ( w/2, h/2, 50 ) local px, py, pz = getCameraMatrix() local hit, x, y, z, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz ) if hit then attachElements(theElement, theElementToAttach, posX, posY, posZ, rotX, rotY, rotZ) end end addCommandHandler("glue", glue) Link to comment
Hydra Posted February 20, 2022 Share Posted February 20, 2022 I just gave you a structure on how you can make it. I didn't said it will work 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