Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Subatomic

Teleporter only usable with key?

Recommended Posts

Would it be possible, perhaps through scripting, to make a teleporter only usable if the player has a keycard? So if they don't have it, nothing happens when they walk over the teleporter's linedefs. If they do have the key, the teleporter works as normal.

If it is possible, I'd also like to make sure the "you need a key to use that" message appears as well, so the player understands why the teleporter isn't working.

Share this post


Link to post

Hey there!

It most definitely should be under Zdoom's expanded ACS functionality: http://zdoom.org/wiki/ACS

Though I'm not sure what the exact commands would look like (I haven't had time to study it), I imagine your script would look like this:

script 100 (void)
{
if (has redkey) == 1
{
Teleport (TID);
Prints("You're teleported to a new location!");
}
elseif (has redkey) <= 0
{
Prints("This teleporter requires a redkey!");
}
}

So then you'd attach this script to the lines that're meant to be the teleport, add "ACS_EXECUTE: 100, 0,0,0" to the linedef(s) in question. This will trigger when the player walks over the line (make sure it's front is facing outward from the center of the area there like you would a regular teleport)

You can add other checks, such as if the player has already triggered this and so on.

Hope this helps in some way, feel free to post questions if you have them!

-T

Share this post


Link to post

Wow, that's much more simple to achieve than I expected. Thanks for the responses and the example script. Much appreciated!

Share this post


Link to post

You can also use ACS_LockedExecute, which will make the script execute only if the player has a given key when the linedef action is activated, and automatically display a message "You need the X key to activate this object" when the player doesn't have it. If you use this method, the script should contain only the teleportation action itself, nothing else. The advantage of this method is that the line with this action will appear colored on the automap according to the key's color, just like locked doors do.

Share this post


Link to post
scifista42 said:

The advantage of this method is that the line with this action will appear colored on the automap according to the key's color, just like locked doors do.


Interesting, I'll look into this a bit more. I like the idea of having the automap lines properly color-coded. It'd be a helpful visual clue for players.

Share this post


Link to post
TimeOfDeath said:

Here's a vanilla method: vkeytele.zip

Why isn't the teleporter working initially? Is the barrel blocking the exit, so the engine doesn't do the teleport?

Another question, are those linedefs around the barrel to show the radius?

Anyway, this screws up all teleport exits as-is. Check out the start of MAP02.

Share this post


Link to post

*Taking notes*

I'm not at my comp to look at this right now, but if that vanilla method from ToD uses a series of barrels, one of which is crushed via trigger lines around the key as I think I'm inferring right now that's very innovative and impressive! I love the mechanics of Doom and to me that's pretty damn cool right there. Scripting is cool, but making stuff work without it is so much more-so to me. Great stuff!

Share this post


Link to post

What is it about your map that makes things like blocking your teleport with a locked door that requires a key out of the question? A teleport that is inactive until you're holding a key card doesn't make sense to me. A key card unlocking access to a teleport sounds more logical to me from a players perspective.

Share this post


Link to post

@40oz: The "key" I'm using is a custom item I've added. Think of it as a magical artifact. When the player carries it, this is what grants them the ability to use teleportation. It's not just a vanilla key card, which I agree wouldn't make much sense. I said key card in my original post for the sake of simplicity.

Share this post


Link to post

Beware of this gameplay feature: without the key, the player is free to pass the teleportation line. With the key, the player will be forced to take the teleporter (unless employing dirty speedrunning tricks).

Share this post


Link to post
printz said:

without the key, the player is free to pass the teleportation line.

Not if the line is flagged as "Impassable" or "Block Players", and is using "Player Bumps" trigger to activate the (locked) teleportation action or script.

Share this post


Link to post
VGA said:

Why isn't the teleporter working initially?

The teleporter destination isn't in the target sector initially. There's dehacked that makes the teleporter destination shootable, so when the barrel gets crushed the explosion pushes it into the target sector.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×