Teleportation

AuthorTopic: Teleportation
Canned
Member # 8014
Profile #0
I looked through the docs and the appendix, yet I couldn't figure out how to do this. And I don't remember there being a scenario that did what I want.

Basically, I want the party to be able to right click on a teleporter. They will be given an option whether or not they want to use the teleporter. And if yes, then they will teleport to a certain location.

How can this be done? (And do I need to make a custom terrain script? And if there is one, where is it?)

Edit -Not again! I accidentally put this in the BoA forum, and I meant to put it in the BoA editor forum. Oh well. I did it again.

[ Sunday, January 06, 2008 14:40: Message edited by: Iffy ]

--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Shock Trooper
Member # 10488
Profile #1
You need to use a terrain script.

If there is only going to be one such portal, you can use the specobj.txt script, which can be found in the Sample Scripts folder (under Terrain Scripts). Just copy it into your scenario folder, assign it to the portal space, and set memory cell 0 to the town state that contains the code for handling the portal.

If you're going to have several of them, it's worth making a dedicated terrain script. You can copy the specobj.txt, rename it portal.txt, and replace the "run_town_script" line with the portal handling code.

I believe there is a teleport_party command to handle the actual teleportation.

Keep in mind that this will only work for teleportation within a town, because you can only move between towns in certain, restrictive situations. If you need to move between towns, you'll probably have to code each portal separately, and you won't be able to make it activate when searched – only when stepped into.
Posts: 334 | Registered: Friday, September 14 2007 07:00
Agent
Member # 8030
Profile Homepage #2
First of all, I'd like to mention my doubts about activating a terrain by merely clicking it. The old fashioned special encounter pop up functions perfectly. Actually, you have to do this as far as my knowledge is concerned. Just for reference, the following action is in the "town calls" section of the appendix.

Anyways, to teleport to another town, the action required is move_to_new_town(Town number, X-coordinate in town, Y- coordinate in town). Basically, if the party selects "yes" in the encounter you only need to include that action. I'm answering on the assumption you already know how to script special encounters.

This example demonstrates how to move the party to coordinates (3,42) in town town 5.

beginstate14;
//Omitted material
move_to_new_town(5,3,42)

[ Sunday, January 06, 2008 15:30: Message edited by: Excalibur ]

--------------------
I dub thee...
Posts: 1384 | Registered: Tuesday, February 6 2007 08:00
Councilor
Member # 6600
Profile Homepage #3
There is in fact an example of an in-town teleporter in the Za-Khazi Run. There are probably several of them, actually, but I know for sure there is one in the Cunning Crypts (t1Cunning, or something like that). It works as a special encounter instead of as a specobj, but the script will look the same.

Specobj will work whenever you search the portal. Kelandon's searchblock is a step up, since it will work if the party steps into the portal as well.

Dikiyoba doesn't know why the standard special encounter setup won't work for this portal, since it's what players expect and it's easier to find a working example of. However, if you have a very good reason (like having the portal be in a location where it would be easily triggered by the party passing back and forth) then do it.

--------------------
Episode 4: Spiderweb Reloaded
Posts: 4346 | Registered: Friday, December 23 2005 08:00
Shock Trooper
Member # 7662
Profile #4
The call "move to new town" is very finicky, you must walk into a placed special encounter rectangle.

I have written posts in the Codex about the use of Teleport spells in BoA. You may find inspiration there if you get ambitious.

If your teleport moves the party to a town in a different outdoor section, you will need to use change outdoor location in the town's Exit State. Otherwise the party will exit the town and still be in the original out zone.
Posts: 292 | Registered: Monday, November 13 2006 08:00
Canned
Member # 8014
Profile #5
Okay, my teleportation script is not working.
I get an "Error- State not found -2" And I do not know what that means.
Here is the script, in case it helps answer my question.
begintownscript;

variables;


short

body;

beginstate INIT_STATE; message_dialog("You enter the cave that Iffy was talking about. But it appears to be a nondescript room. Odd.","");
break;


beginstate 20;
teleport_party(16,14,0);
break;
Edit -Yes, I put down the special encounter square and typed in "20" (minus the quotes).

[ Tuesday, January 08, 2008 15:36: Message edited by: Iffy ]

--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Councilor
Member # 6600
Profile Homepage #6
You need the EXIT_STATE and START_STATE in every town script, regardless of whether you have anything in them or not. The start state is state number 2, so that's the error.

The short without any defined variables might cause problems too.

Dikiyoba.

--------------------
Episode 4: Spiderweb Reloaded
Posts: 4346 | Registered: Friday, December 23 2005 08:00
Canned
Member # 8014
Profile #7
Thankyou, that helped.
And now I tried to put in a message choice thingy.
Only the game says "Error: Unknown command choice in line 26". I tried to figure this one out on my own, yet I can't get it to work.

beginstate 20;
message_dialog("There

is a teleporter here. This is the one

Iffy was talking about. If you go

through, you might not be able to come

back that way. Continue?","");

add_dialog_choice(0,"Stay.");

add_dialog_choice(1,"Step through the

portal.");
choice =
run_dialog(0);
if (choice == 1)


set_state_continue(21);
break;

beginstate 21;

teleport_party(16,14,0);
break;


--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Off With Their Heads
Member # 4045
Profile Homepage #8
You need to define the variable "choice." That is, you'll want a line near the top of the script that says...

short choice; And Exodus has a in-town teleporter in town 51, for comparison. I don't think Bahs had one, but I may be forgetting something.

[ Tuesday, January 08, 2008 16:25: Message edited by: Kelandon ]

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
Canned
Member # 8014
Profile #9
It worked, thank you.
Do you know of an example of a switch town portal with changing outdoor sections too?

--------------------
Don't judge a sentence until you know all the words.
Muffins n' Hell|Muffins n' Hell: The Muffins Are Back Again
Muffins n' Hell: The End is Near
Not in your shed -We are sort of done. Helpful criticism is welcome.
Everyone, just call me Iffy. Please.

Be grateful you have your unsellabe trowels -Goldenking

Just so you know, I am working on Muffins n' Hell the scenario.
Posts: 1799 | Registered: Sunday, February 4 2007 08:00
Off With Their Heads
Member # 4045
Profile Homepage #10
quote:
Originally written by Iffy:

Do you know of an example of a switch town portal with changing outdoor sections too?
Towns 32 and 33 of Exodus do this. (There's also a cut scene in the middle, but just ignore that code.)

The Land of the Dead has a bunch of town-to-town portals, too, in towns 48, 49, etc.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00