Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topicStart Poll

> Teleport disable/trap and banishment script ideas
Outline · [ Standard ] · Linear+
DinkumThinkum
post Nov 6 2004, 12:24 AM
Post #1


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



This is from a thread in the old Bethesda Construction Set forum (before the change to the new forum software). Thought this might be a good new home for it.

I've finished recreating the original thread; I don't have any more to add (for the time being).
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 12:41 AM
Post #2


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



DinkumThinkum posted:

There've been some recent threads asking how to disable teleporting in a mod, and most of the responses have pointed out that the 'DisableTeleporting' function won't block teleporting using amulets, etc.

Not sure if I've just reinvented the wheel , but it might be possible to simulate a total block on all teleports from an area by using a global script.

----------------------------------------------------------------------------

Use GetPCCell to check the player's current location.

As long as they're in one of the mod cells, nothing happens.

If they're not where they're supposed to be, then the script teleports them back into the correct area: back to the initial entry point for the mod, for example.

This wouldn't be exactly the same as blocking the teleports, but it should (unless I've overlooked something) make the area totally inescapeable until you've fulfilled the modder's conditions for getting out legitimately.

----------------------------------------------------------------------------

Something like this:

1. When the player is teleported (or whatever) to the 'No teleporting out' area, use StartScript to start the global 'Teleport blocker' script.

2. The script continuously (once a minute?) uses GetPCCell to see if the PC is still where he's supposed to be.

a. If the PC is in the right place, the script returns without doing anything.
b. If the PC isn't in one of the designated cells, then the global script uses Position or PositionCell to teleport them back to the starting location for the mod.

3. Once the player successfully completes the mod quest (or whatever is necessary to get free of the area), then use StopScript to stop the 'Teleport blocker' script and teleports start working normally.

----------------------------------------------------------------------------

Not exactly the same as disabling teleports, but it would have the same end result: the player can't leave the mod's area until he meets the conditions set by the modder.

If I'm not overlooking something, this should completely block use of teleport rings, Emma's travel agency mod, 'coc' from the console, and any other possible means of escape. The only way to get out of the area early would be to use the console to StopScript the teleport blocker script (or reload a saved game before you started the mod).

----------------------------------------------------------------------------

Thinking more:

If it's a big mod, with several different areas, you could use Journal entries to keep track of which parts of the mod the player has completed. Then the global script could use the Journal entries to teleport the player back to the right area if he tries to leave.

For example: If you don't have the journal entry for completing Lost Island 1, then you get teleported back to Lost Island 1. If you've completed Lost Island 1 and 2, but not 3, then you'd get teleported back to Lost Island 3.

----------------------------------------------------------------------------

If I just reinvented the wheel, somebody please let me know! I don't remember seeing this suggested in the recent threads on disabling teleports, but my creaky brain and memory may have missed something!

Anyway, I just tried a quick and dirty test script:

----------------------------------------------------------------------------

CODE


Begin DT_Test_BalmoraTrap



If ( GetPCCell, "Balmora" == 1 )

   Return

Endif



MessageBox "Off to Balmora with you!"



Player->PositionCell, -21278, -17613, 534, 0, "Balmora (-3, -3)"



End DT_Test_BalmoraTrap



----------------------------------------------------------------------------

Worked perfectly!

Ran the script (with the console) in Seyda Neen, and my character was immediately teleported to Balmora.

Once there, my character could not leave Balmora. Tried walking out, guild guide, silt strider, and 'coc' from the console. As soon as I entered a non-Balmora cell I was teleported immediately back to Balmora.

This was a new character, straight off the ship, so I didn't have spells or items for Recall, Intervention, etc. But the above script should work as well against those as it did for the travel methods I tested.


--------------------
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 12:44 AM
Post #3


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



Mode_Locrian posted:

Hey, that's pretty cool. I've never heard of anyone coming up with a solution to the 'teleportation via scripts isn't blocked by disable teleportation" problem before. You didn't reinvent the wheel, as far as I know... if someone invented the wheel before you, I didn't hear about it.

----------------------------------------------------------------------------

Nigedo posted:

I reckon that's pretty sharp Thinkum. Now you point it out, it's sort of obvious, but I've never heard anyone suggest it before and it wouldn't have occurred to me to look for a workaround to that issue.

Thanks.
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 12:49 AM
Post #4


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



DinkumThinkum posted:

One^H^H^H two minor weaknesses I just thought of:

1. If the player has a companion, the companion would be left behind if the player tried to travel out of the area: the teleport blocker script would bring the player back but not the companion.

Wouldn't be a problem if the companion was part of the mod using the script, since they could just be added into the script. But companions from other mods would get separated from the player's character.

But I don't see that as a major issue; can't expect all mods to be 100% companion friendly.

2. The teleport blocker script will only block attempts to teleport out of the designated area. The player would still be able to use Mark and Recall within that area; he just wouldn't be able to Recall out of the area.

I don't see that as likely to be a major problem, as long as modders are aware of it; I think that keeping somebody in an area is probably the main reason modders want to block teleports.

And if anybody else spots glitches in this, post away!

----------------------------------------------------------------------------

Some thought for any modders who might use this:

1. 'GetPCCell' accepts partial matches, so 'Balmora', 'Balmora, Guild of Mages', and 'Balmora, Lucky Lockup' are all considered part of Balmora and don't trigger the teleport blocking.

So if the mod involves several cells, just name them so they're identified as part of the same region and the PC should be able to move around the area without being unexpectedly teleported.

2. I didn't do a lot of testing on this, but it's so simple I can't really think of any way to stress test it. My guess is that it might be completely bulletproof: either the player does what's needed to stop the script from running, or he's trapped in Balmora for the rest of eternity. :twisted:

So, I strongly recommend being very very sure to thoroughly debug any mod that uses the teleport blocker script. And including a failsafe way to stop the script and exit the mod's area even if the player totally fouls up any quests, etc. would probably be a good idea.
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 12:53 AM
Post #5


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



ManaUser posted:

I've got a glitch. What if two mods do this at once? Not too likely, but suppose in one of the mods, the "trap" area is entered by a teleport amulet.

DinkumThinkum posted:

Good point! I hadn't even thought about the possibilities of two mods with this being installed at the same time.

Hmmm.... With a little care, conflicts like this should be avoidable. (I think...)

1. Don't trigger the teleport blocker script by simply entering the trap area; the PC has to actually interact with something: NPC, a door, whatever. That prevents the PC from triggering a second trap area by trying to travel out of one he's already in.

2. The activator that triggers the script can't be portable. That way the player can't use it to trigger a second trap script while he's already under the influence of another one.

That should prevent triggering more traps once one trap script is already running, unless a modder screws up and has a trigger for one trap area inside an area trapped by another trap script in his own mod...

3. To reduce the chance of conflicts even more: only set a teleport blocker script to trap areas that are added by your mod: a dungeon, island, new continent, etc. Don't put traps around areas that are already part of the game.

That way, you don't have to worry about another modder putting his trap activator inside the area you've put a trap around.

I think those restrictions would stop most possibilities of conflicts between mods using this technique, and shouldn't be very limiting for modders.

From what I've seen, I think most modders want to block teleports for things like trapping somebody in a dungeon or a deserted island, and making them stay there until they've solved a quest, fought their way clear, or something along those lines.

I could think of neat quests where you'd be trapped in an existing city until you completed a quest, but those would have too much chance of conflicting with other mods using the same type of teleport blocking script.

----------------------------------------------------------------------------

Finally:

Keep in mind that people have been beating their heads over this as far back as I can remember; I just had this brainstorm a little over 12 hours ago!

Also: I am not at all one of the scripting gurus here!

This is very much an idea in the earliest stages; I'm sure there are other glitches to be discovered, but I think this is at least a decent start to solving the problem of blocking item, console, and script teleports.

That wasn't meant to be defensive, but just to remind everybody this idea is still an extremely new idea, and I don't have all the answers! Which is why I asked for any glitches that people think of: so maybe we can work together and see if this can be shaped up into a solid technique for general modding use.
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 01:09 AM
Post #6


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



Neko posted:

not bad, not bad at all... of course many players will hate you but hey, it'd be nice to make an escape-proof jail for once.

coupla things i'd like to say,

1. you'll have to to the warping to a fixed location (as in your demo script). variable teleporting in morrowind just has so many issues trust me you don't wanna open that hornet's nest.

2. yes it is kinda sucky for companions. how about a little warning before they get teleported? like a "if you don't return to crassius curio's quarters, you will be returned there by force!" sorta message. that at least gives the player the chance to turn around and head back.

3. i'd advise adding a

CODE


if ( MenuMode == 1 )

 Return

endif



condition at the top there... perhaps i'm being needlessly superstitious when it comes to morrowind scripting, but then again, perhaps there is good reason to be superstitious around morrowind scripting *cough*Random, 256*cough*

-Neko

DinkumThinkum posted:

Neko,

Excellent suggestions! I particularly like your idea about a message, so the player has a chance to go back on their own first.

As I've said before, I'm not one of the scripting gurus here: sometimes I get a bright idea, but I don't do much in the way of actual scripting.

The scripts I'm posting here are just meant as quick and dirty proof of concept demo scripts: they'd need more work before being used in an actual mod.
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 01:17 AM
Post #7


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



Limorkil posted:

Just extending this idea a little ....

I am working on a script that detects whether the player is 'as good as dead' and teleports him/her to the nearest safe location. (I actually wanted to detect when the player dies, but this does not work.)

Seems to me that the weakness of your teleport trap idea, if any, is that you always come back to the same location. That is not a problem if the trap area is small, but it could be an issue if the area is large, like a huge dungeon. One way around this could be to use the same method that I am employing in my death teleport mod:

Create a global variable, e.g. SafeLoc
Attach scripts to objects (e.g. light fixtures) in various locations. Each script checks for the player being nearby. When the player is in range the global gets set to a unique number for that area.
When the player teleports out, the script that teleports him back checks the value of the global in order to teleport the player back to an area near where he/she was last.

This way you have more than one location that the player can be sent back to.
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 01:26 AM
Post #8


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



Curmudgeon posted:

Have been doing some experimenting with Dinkum Thinkum's "Disabling teleport amulets in specific areas" script idea for a mod I'm making and have some information that might be useful. If nothing at all is of use, please forgive this neophyte scripter. This is just one example of a script which has a lot of potential. THANK YOU, Dinkum Thinkum, who also helped me in a couple of detailed PMs.

1. The cells created for the mod should have a "parent cell", like DinkumThinkum's Balmora example. The other cells in the mod need only have that cell's name followed by a comma and the rest of the name. Without this "parent" cell (which doesn't even need anything in it) you have to string the cell names together in an if ... elseif ... elseif construction, though that works, too. I used "Mephala's Web" for this and have another five cells or so with the same prefix. Works just fine.

2. If you want to grab players and send them somewhere if they try to escape using Almsivi Intervention or Divine Intervention, the new cells in your mod have to be connected to the original MW world by doors, rather than activators with scripts teleporting the player into them. And for some inscrutable reason these doors must be functioning ones that you actually use to travel in the mod -- doors placed in the void invisible to the player don't seem to do the trick, even if you assign a teleport location to them. If this door condition is not met, the two Interventions just fizzle out where the player is standing and no teleporting takes place -- the NoEscape script doesn't kick in either. If this condition is met, no problem -- you have the player right where you want him.

3. This script prevents mod-made teleporting items from allowing players to escape the restricted area. I did a lot of experimenting with this and the script was always successful in grabbing the player by the collar and putting him back where he belonged. Here Neko's suggestion is a sound one as you are in MenuMode when you equip such an item. Once a player leaves MenuMode, your MessageBox pops up and he is sent back to the place that the NoEscape script specifies.

4. Tested Mark and Recall. As Dinkum Thinkum observes these can be used effectively within the restricted area, but if an escape attempt is made, the player is teleported right back where you want him.

5. I have the NoEscape script starting when the player passes through the first door into the new cells created for my quest mod and stopping when he passes through the last door and back into the original MW world. Works just fine in repeated in-game testing and didn't muck up anything, though I wasn't playing with any other mods activated. You would probably have to be very careful using this script on cells in the original MW world.

6. Haven't tested this at all with companions.

Hope this proved to be useful. Here's the code. Not much to it, but it really does the job.

CODE


Begin WMephalaNoEscape



if ( MenuMode == 1 )

   return

endif



if ( GetPCCell, "Mephala's Web" == 1 )

return

else

MessageBox, "Fool! ... (a nasty message from Mephala)", "OK"

player -> (Some really awful stuff that results in the player's death and which works just fine.)

player -> PositionCell, -64, -64, -128, 45 "Mephala's Web, Decay"

endif



End

Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 02:05 AM
Post #9


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



DinkumThinkum posted:

Curmudgeon,

Thanks for the detailed report on this! It should be helpful for anybody else tackling a project that involves trapping the player character in specific area.

When I came up with the idea, I did some testing (in Balmora) to see if it worked, but never went any further with it. I've thought of one or two mod ideas that I could use it for, but I haven't had time to do anything.


One thing in your script:
...
player -> (Some really awful stuff that results in the player's death and which works just fine.)
player -> PositionCell, -64, -64, -128, 45 "Mephala's Web, Decay"
...

If the first line above really does kill off the player, the second line won't do anything because the player is now dead.

The second line is useful if you want to keep the player alive but trapped. If you just want to kill them horribly if they try to leave the dungeon without permission, you don't need the PositionCell line.


Thanks again for the feedback. I'm glad somebody's found a use for the script and that it's working OK for you.

Curmudgeon posted:

Thanks, as always. DinkumThinkum.

I need the PositionCell line in the script because that's where the player actually dies, eaten by piranha. The line above just weakens him a whole lot.

DinkumThinkum posted:

Ok; that makes sense now.

Boy, you are one mean, nasty modder!

Curmudgeon posted:

Thanks.

I'm posting because the information I provided in Condition #2 above needs to be corrected. The group of new cells in a mod which uses this script must each contain a doormarker from another cell and a functioning door which connects it to another cell. The door may be in the void which the player can not see, but it must have its teleport set to another cell. The parent cell, however, doesn't need this unless the player will actually go to it. If you satisfy this condition the two Interventions will be dealt with by the script. If not they will just fizzle out. Put another way, depending on teleporting through the use of activators rather than doors will disable the Interventions whether you use this script or not.

----------------------------------------------------------------------------

Something I didn't post in the original thread:

Adding to Curmudgeon's last comments:

The two Intervention spells both transport a character to the nearest temple or cult altar. In an exterior cell, that's just a matter of calculating distance based on the character's current position on the exterior map.

But interior cells are not on the exterior map: each interior cell is in its own private universe. So, to come up with a current location on the exterior map, the game needs to be able to follow a chain of teleport (travel, door, etc.) markers from the current interior cell until it finds a marker on the exterior map.

I haven't used it, but, according to the Help file, one of the 'World Testing' options in the Construction Set checks for interior cells that aren't linked to the rest of the game world by teleport markers.

(I have no idea how the game chooses an Intervention destination when an interior cell has travel markers leading to more than one part of the extior map, but I would guess that it just uses whichever one it finds first.)
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 02:22 AM
Post #10


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



DinkumThinkum posted:

Just had another brainstorm, triggered by something I saw in another thread.

Not only do we sometimes get requests from people who want to disable teleports so they can trap the player character in an area, but we also get occasional requests from people who want to keep the player character out of a certain area until they meet some condition.

I just realized that my 'Teleport Trap' script can do this too. All it takes is a minor modification to the original script, and we now have a 'Banishment' demo script:

CODE


Begin DT_BanishedFromVivec


;start this script from the console to keep player character out of Vivec.



If ( GetPCCell, "Vivec" == 1 )

   MessageBox "You have been banished!  Begone, foul one!"

   Player -> PositionCell, -21278, -17613, 534, 0, "Balmora (-3, -3)"



EndIf



End DT_BanishedFromVivec



Just tested this in the game, and it worked fine: tried entering Vivec by Silt Strider, Gondola, Teleport, and flying in on my own. I was immediately banished to Balmora as soon as a Vivec cell loaded.

If this script is used to banish a player from an area added by the mod it's used in, there should be very little chance of conflicts with any other mods using the same type of banishment script.

I would not recommend using this to banish the player character from any areas already in the game: too many chances of breaking something in the game, interfering with other mods, etc. (I used Vivec for my demo because it was convenient, but I wouldn't banish the player from Vivec in a real mod.)

But if you just want to keep the player from landing on your 'Secret Island' or from entering your 'Dungeon of Hideous Monstrosities' until he's met your conditions, this technique shouldn't interfere with anything else in the game. Start the script to keep the PC out of the area, and stop it (from dialogue, for example) when you're ready to let him in.

Added today:

The 'Banishment' script is also just a proof of concept demo script. The comments in previous posts about menu mode checks, companion issues, etc. also apply to this script.


--------------------
Top
User is offlinePM
Quote Post
DinkumThinkum
post Nov 6 2004, 03:04 AM
Post #11


Hireling


Group: Members
Posts: 17
Joined: 5-November 04
From: Luna Penal Colony
Member No.: 692



A couple of recent thoughts on these scripts and their possibilities:

The 'teleport disable/trap' script almost has to be a global script, since the script needs to be able to grab the player and drag them back no matter where they go on the map. You probably could also attach the script to a cursed item that the player can't get rid of until they fulfill some condition.

However, the banishment script does not need to be a global script: it could be attached to an activator in the off-limits area, and it would only run when the activator's cell was loaded.

Keep in mind that the local script will stop running as soon as the character is teleported away from the cell with the activator.

For example:

To prevent the player from reaching your 'Secret Island' until they completed a quest, you could just put an activator with a banishment script on the island. As long as the player hadn't finished the quest, the script would teleport the player away anytime they tried to enter the island's cell or one of the adjacent cells (nine cells total).

You could just dump the player into the ocean near the island, and have a message box pop up with "Strong winds drive you from the island and hurl you into the sea!".

----------------------------------------------------------------------------

You could use the two scripts in conjuction with one another:

First, a banishment script keeps you out of the 'Awful Dungeon of Horrible Torment" until you complete one quest.

Once you complete the quest and reach the 'Awful Dungeon...', a trap script keeps you there until you complete a second quest.

----------------------------------------------------------------------------

And that's all I have to say on the subject for the moment! :!:
Top
User is offlinePM
Quote Post
Regan
post Dec 5 2004, 12:53 AM
Post #12


Hireling


Group: Members
Posts: 1
Joined: 5-December 04
From: France
Member No.: 721



Can anybody help?

I'm trying to remove all intervention scrolls from the PC's inventory using a script.
How should I do this, using GetItemCount, or is there another way?

Any suggestions would be appreciated.
Top
User is offlinePM
Quote Post

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Reply to this topicTopic OptionsStart new topic

 


Lo-Fi Version
Time is now: 29th August 2005 - 07:45 AM