Teleporting Player Check "Non-Stuck"
If I have coordinates already, is there a way to check BEFORE sending a player via 'TeleportEntity':
- If they will be stuck in a wall/floor/ceiling - If they WOULD BE stuck, then TRY to adjust the coordinates - If coordinates are UNABLE be adjusted (due to player X,Y,Z being out of bounds compared to the coordinates), then cancel - If VALID, teleport using adjusted/existing coordinates. Keep in mind, a player entity is: - 32.0 pixels X & Y - 72.0 pixels Z So a global float used to check against coordinates could look something like: PHP Code:
My reason for this: On a flat surface, it isn't an issue to teleport a player...but curved surfaces, tight spaces are. The players feet can be put in the ground or they can be put in a wall...see where I'm going with this? I just don't want them to be stuck after teleporting. Thanks a million for any help/insight here! Maybe there is a much easier way to do this than what I'm thinking. Currently working on a really cool plugin I would be happy to share, and this part the only thing keeping me from finishing it. :grrr::bacon!::bacon!: |
Re: Teleporting Player Check "Non-Stuck"
Quick answer for this. Use Hull Trace for this. Unfortunately, there is no wiki page for this. But you can easly to search it. https://sm.alliedmods.net/new-api/sdktools_trace
Players mins {-16.0, -16.0, 0.0} maxs {16.0, 16.0, 72.0}. Tip: if your coordinate is a floor - add +1.0 for Z axis (for sure, that player does not stuck at ground) |
Re: Teleporting Player Check "Non-Stuck"
You can take a look in this
|
Re: Teleporting Player Check "Non-Stuck"
Simple solution...just gotta check if the player is moving or not...by checking there velocity i believe. and check the keys there pressing at the time. if they are pressing the key to move but not then they are stuck :) if u need help just pm me. but thats what i do to figure out who's stuck. Unless u absolutely need to specifically check if there stuck in specific things...like walls ceilings or floors...this is the way to go.
|
Re: Teleporting Player Check "Non-Stuck"
Quote:
Let's say we have an X,Y,Z coordinate of 100,200,300 and if I were to move the player there with "TeleportEntity", they would be stuck in the ceiling (left pic below). Essentially what I am aiming to do is check, and if need be, fix up those coordinates so the player would not be stuck when I moved them (right pic below). The FIXED coordinates would be something like 100,200,228 (notice the Z axis was changed to compensate for the players height of 72 units). Again this checkpoint should work regardless if it is a wall/floor/ceiling/object unless it is impossible which at that point the check would return a -1 or something. Here is a good visual (notice the bounding box of the player not being clipped in the right side pic after fix): http://share.scorpex.org/player-stuck-fix.jpg The plugin link Franc1sco shared seemed to be close, except it didn't work 100% of the time. I would still be left stuck sometimes, especially in ceilings for some reason. It was pretty close to what I'm after because it seemed to check in a radius around the player and act accordingly. Again, I am sure this can somehow be done with TR_TraceRayFilter to check X,Y,Z with the player bounding box dimensions in mind (32,32,72), just how to go about it is what I am stuck on. Thanks again all!! |
Re: Teleporting Player Check "Non-Stuck"
Quote:
PS: I might support you with some code tomorrow. have a good night for now. EDIT: Here it is, PHP Code:
But, playing Dust2 on CSGO, CT spawn here have a little inaccessible room, if a player gets stuck near it there's a possibility he'll go inside, since it's not really solid, as you can see here: https://i.imgur.com/Mrxp75T.jpg https://i.imgur.com/iWcweZg.jpg https://i.imgur.com/V2GKf3t.jpg https://i.imgur.com/a9Oru0Y.jpg Otherwise, if the position you're questioning is outside the playable map then you'll how to use the function multiple times and I tried detecting if a certain point is inside/outside the playable map but it didn't work... hopefully someone will let us know. https://i.imgur.com/0rLfqIl.jpg https://i.imgur.com/oU38UTv.jpg https://i.imgur.com/OsJOD9Vg.jpg I did only a few tests with this, you should try more and see if it works for "your" own special cases. also, as you can see you can't go on looping forever.. especially doing this kind of dirty work, this function is kinda heavy so I limited the number of trials, but in my most cases I got no more than 5 trials each so it's a good sign, and bare in mind, you can't go on using this everytime the player spawns, if it somehow worked for you, you should really be considering saving the corrected origins into some files once you generate them and then use them next time the map loads. |
Re: Teleporting Player Check "Non-Stuck"
Quote:
|
Re: Teleporting Player Check "Non-Stuck"
Quote:
Code:
(42) : warning 213: tag mismatch Any ideas? Would really like to test this out. Thanks! |
Re: Teleporting Player Check "Non-Stuck"
Warning may fixed by:
PHP Code:
|
Re: Teleporting Player Check "Non-Stuck"
EDIT: Error fixed. TheDS1337's script needs compiled against latest #include files from the SourceMod git repo. As of this post, stable version (1.9) does not yet include 'TR_GetStartPosition'
Quote:
Unfortunately, in my previous post I had tried that already: Quote:
PHP Code:
|
All times are GMT -4. The time now is 18:49. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.