hi, i need to know how i would make a teleport tile so when the player walks/flys into the tile they will automatically be teleported to another loction on the map,
thanks.
ID:165414
![]() Dec 29 2006, 5:20 am
|
|
You really need to stop giving people advice that will screw they're game up.
turf |
Miran94 wrote:
> turf - Miran94 No, please don't post code help when you don't completly understand what you're doing. The code is wrong, and you will just get many potential errors. In order to teleport, you must use the Entered() proc, and get the object that entered the teleporter by looking at the first argument of Entered. You cannot just rely on 'usr', because it isn't always the enterer of the teleporter. turf/teleporter If you would like only players to enter, you will have to do special checks. First, you must check if the enterer 'A' is a mob, and check if the mob has a client controlling it. turf/teleporter |
Miran94 wrote:
My code works fine I tested it out myself so stop nagging its so irritating. Sure it works fine for mobs with a client, wait till a projectile hits it. |
If projectiles and npcs can enter it just add an
turf |
What the hell is 'A'? That'll give you errors.. and how the hell you got the idea of using M? If you defined 'A' properly, you wouldn't need M...
- GhostAnime |
GhostAnime wrote:
What the hell is 'A'? That'll give you errors.. and how the hell you got the idea of using M? If you defined 'A' properly, you wouldn't need M... He just edited UP's code. |
Miran94 wrote:
My code works fine I tested it out myself so stop nagging its so irritating. No, the code is not fine. It works fine when you test it in your suitable and perfect situations when you move your player onto the warp tile. But when it's in a real game situation, these "perfect situations" do not happen all the time. The problem with the code you supplied is your bad and blatantly wrong usage of 'usr'. It's a misconception for new programmers to think 'usr' is "the user," which is wrong and not always the case. usr simply is the object that called the proc. If you had a verb that controlled another player's movement, and wanted to move the player inside of the warp, 'usr' would be the player who is controlling the one who actually entered the warp. To fix this, you need to rely on the proc's first argument, which is always the object that entered it. There are many other situations where this would happen, which is the reason why you should never use usr in procs. You should only be using Enter() if you want to disallow entrance into the object. In this case, Entered() would be more suitable. You would want to use Entered() because it is called if the object successfully entered the tile. I'm sorry for nagging at you, but it's much more beneficial when a new programmer doesn't learn wrong things from another new programmer. |
Unknown Person wrote:
You should only be using Enter() if you want to disallow entrance into the object. In this case, Entered() would be more suitable. You would want to use Entered() because it is called if the object successfully entered the tile. So true. Both using Enter() instead of Entered() and using 'usr' wrong are common DM mistakes. A little note; on your posted code, you typecasted the argument as atom/movable, then when checking if it's a mob with a client, you created another var and typecasted it as /mob... that is not necessarily, you can just typecast the argument as /mob in the first place - it does no problems, and in this case, it's the most beneficial. |
Kaioken wrote:
A little note; on your posted code, you typecasted the argument as atom/movable, then when checking if it's a mob with a client, you created another var and typecasted it as /mob... that is not necessarily, you can just typecast the argument as /mob in the first place - it does no problems, and in this case, it's the most beneficial. I left that out intentionally to show him how to type cast from an argument. If the programmer only wanted to do something if a player entered the warp, then that would indeed be the way to go, though it doesn't matter that much. |
- Miran94