So i was wondering how i would teleport a player infront of themself 2 metres or so. I thought that I could do this by doing something like
Code Snippet
Plaintext
newplayerangles = player.angles + direction + angles(angles needed)
Yes i know that's not how it is supposed to be layed out but thats the sort of thing I want. Not sure how to check direction so if anyone could help that would be great :3
Direction isn't the only issue. The player would be able to go through walls and out of the map, and who knows what else. But anyway, here are some functions with some googling and math you should be able to get what you want:
Direction isn't the only issue. The player would be able to go through walls and out of the map, and who knows what else. But anyway, here are some functions with some googling and math you should be able to get what you want:
Alright, thx, will players be able to teleport inside of walls?
When you teleport the player, i.e. setorigin, yes. Anywhere you say to teleport them they will go. I'm not sure if your trying to make nightcrawler or a boost or what. There are other ways to simulate a teleport that could be less dangerous, like using setvelocity That in combination with enable and disable invulnerability may also work for what you want.
Last Edit: September 18, 2015, 12:30:21 pm by MakeCents
When you teleport the player, i.e. setorigin, yes. Anywhere you say to teleport them they will go. I'm not sure if your trying to make nightcrawler or a boost or what. There are other ways to simulate a teleport that could be less dangerous, like using setvelocity
Im trying to make blink from destiny so I can't use setvelocity. Blink basically teleports you a certain distance and it would be nice if you could teleport through walls but not into them, maybe there could be some way by using a trigger_multiple on the walls to break the script if you are about to teleport to them?
Im trying to make blink from destiny so I can't use setvelocity. Blink basically teleports you a certain distance and it would be nice if you could teleport through walls but not into them, maybe there could be some way by using a trigger_multiple on the walls to break the script if you are about to teleport to them?
Anything is possible, but there are probably better ways than using a trigger, but I don't know them. The problem with going through walls is getting into zombie spawn areas, out of map, and through doors without buying them. Of course, if your map works that way then cool. I'm sure it can be done.
Blunt may be the one to contact about tapping into the pathnodes maybe to keep the player in playable areas, if that is possible. I've seen his dog use them I think. Perhaps there is a way to get the pathnodes in front of a player and make them teleport to one...?
Last Edit: September 18, 2015, 12:36:36 pm by MakeCents
Anything is possible, but there are probably better ways than using a trigger, but I don't know them. The problem with going through walls is getting into zombie spawn areas, out of map, and through doors without buying them. Of course, if your map works that way then cool. I'm sure it can be done.
Blunt may be the one to contact about tapping into the pathnodes maybe to keep the player in playable areas, if that is possible. I've seen his dog use them I think. Perhaps there is a way to get the pathnodes in front of a player and make them teleport to one...?
You can get all the pathnodes in a level by using getNodeArray("node_pathnode","classname");(I'm not positive if that is the right value for the classname and I'm on my phone so I can't check it) but if you used pathnodes it could still send you outside through a barrier if you don't check it. You should test if the pathnode that your going to send the player to is inside of the playable_area trigger that's used for spawning power ups
You can get all the pathnodes in a level by using getNodeArray("node_pathnode","classname");(I'm not positive if that is the right value for the classname and I'm on my phone so I can't check it) but if you used pathnodes it could still send you outside through a barrier if you don't check it. You should test if the pathnode that your going to send the player to is inside of the playable_area trigger that's used for spawning power ups
This is a great way to do it. Now... the script...
Well what I meant is you can get a point that's in front of you using bulletTrace and set that origin.
I didn't say it was the only way or the best way to do it, but the OP mentioned he wasn't sure about direction stuff so it was more of a short example, since there's prob some other stuff you want to check on the player as well i wouldn't just go and use this 'script' in a map. For doing a bullet trace he still needs a direction, or at least a start and end point. And your answer wasn't really that complete in terms of that
That's really good stuff. I don't think he will be able to go through walls with bullet tracing though. If he uses the pathnodes and uses the playable area trigger, I think he will get what he wants, the safest.
Of course, you'll have to keep your pathnodes out of the doors, or players could get stuck, similar to the bullet trace method too.
Last Edit: September 18, 2015, 10:15:52 pm by MakeCents
// self is the player teleport_player_forward() { angles = self GetPlayerAngles(); ang_fw = anglestoforward( angles );
// get the new destination 200 untis forward destination = self.origin + vectorscale( ang_fw, 200 ); ground_org = groundpos( destination+(0,0,35) );
// do a bullettrace to check for walls etc if( bullettracepassed( self.origin+(0,0,30), ground_org+(0,0,30), false, self ) ) { self dontinterpolate(); self setorigin( ground_org ); } }
Thanks for this stuffy, so with the bullettracer thing, does that mean that you simply wont teleport if you are going to collide with a wall or can you teleport throught it?