Jump to content

is there a way to make an item to telaport you'r party ?


Hawk King

Recommended Posts

what i need to know is there a way i can make an item that when you to use it it gives the option forward backward left right and when you select one it gives the option

 

spaces in this direction

 

1

2

3

4

5

6

7

8

9

10

 

it would then teleport your party that many spaces forward

and while I'm at it is there a way to make an item to take you to a different town ?

Link to comment
Share on other sites

1) It's not impossible, I suppose. You'd need to include checks to make sure the party didn't teleport outside the town boundaries. Also, keep in mind that they may not end up quite where you expect in every case; the party placement algorithms are a little weird sometimes.

 

2) Not very well. You can only call move_to_new_town() from a special encounter rectangle.

 

Also, please shorten your sig. It's obscene.

Link to comment
Share on other sites

Quote:
Originally written by Kelandon:
Taking out the line breaks would fix the sig problem.

You'll probably want to use a shortened form of Numeric Input for this.
thank you i will use this but i need to know how what type of code do i need the item editor doesn't have anything remotely like what i need and yes it will have infinite uses for that exact purpose and
Link to comment
Share on other sites

Remember that punctuation?

 

You want an item with a special ability that calls a state in the scenario script. First, you probably want to use is_town to make sure the party is in town mode. If not, use an end call to stop everything and pop up a message -- maybe using print_str or message_dialog. Then pop up a dialog that explains the four text responses: north, south, east, and west. Then ask for a text input, and check for each of those four responses. Then pop up a box that asks "How far?" and takes a numeric input of up to ten. Use current_town_size and char_loc_x and char_loc_y to make sure that the location is a permissible one. If not, end everything again, perhaps with an error message. And finally, use the relocate_character call to move the party.

 

Heck, I could make this for you if you really needed, but it'd probably be good scripting practice for you to make it yourself.

Link to comment
Share on other sites

Quote:
Originally written by Kelandon:
Remember that punctuation?

You want an item with a special ability that calls a state in the scenario script. First, you probably want to use is_town to make sure the party is in town mode. If not, use an end call to stop everything and pop up a message -- maybe using print_str or message_dialog. Then pop up a dialog that explains the four text responses: north, south, east, and west. Then ask for a text input, and check for each of those four responses. Then pop up a box that asks "How far?" and takes a numeric input of up to ten. Use current_town_size and char_loc_x and char_loc_y to make sure that the location is a permissible one. If not, end everything again, perhaps with an error message. And finally, use the relocate_character call to move the party.

Heck, I could make this for you if you really needed, but it'd probably be good scripting practice for you to make it yourself.
I'm working on the punctuation marks and stuff. and yes please could you build it for me ? I'm a little to early in the stages of scripting to be doing what you are saying i would need to do I'm still getting error messages with the draconian armor thing so yes i would really appreciate the help.
Link to comment
Share on other sites

Coordinate input would work pretty well, I think. Basically you'd need two consecutive Numeric Input domains in your script (one for x-loc, one for y-loc). Two problems would be party placement (which is a problem with any sort of teleportation) and the fact that the player would need a fair idea of their starting coordinates (it'd probably be a good idea to actually tell them the lead character's current location before the first Numeric Input.)

Link to comment
Share on other sites

Totally untested, but this is my interpretation of doing what you want to do. This would go in your scenario script (apologies if it has errors, but I haven't bothered to do more than the most basic of checks):

 

Code:
 	// Teleportation Item v1.0.0	// by Kelandon (tomwatts@berkeley.edu)	// This script takes several variables. If you are running short, at least	// three can be eliminated with some reworking of the code. As written, they	// should be declared as follows in the header of your scenario script:short direction,what_num,choice,dest_x,dest_y,i;	// This script also assumes that you are using states 10 and 11 in your 	// scenario script for the item. If you aren't, go down to the line that 	// says "********* LINE TO CHANGE" and replace "10" or "11" with the states	// that you are actually using.	beginstate 10;	// If the party is not in town, end everything and explain.	if (is_town() == 0) {		print_str("You must be in town mode for this item to work.");		end();		}		// Inform the player what is happening.	message_dialog("You must now enter what direction you would like to move. The choices are: north, south, east, and west. For example, if you would like to move north, enter _north_ in the following pop-up window.","");		// Zero the variable.	direction = 0;		// Get the direction.	get_text_response("What direction?");	check_text_response_match("north");	if (got_text_match())		direction = 1;	check_text_response_match("south");	if (got_text_match())		direction = 2;	check_text_response_match("east");	if (got_text_match())		direction = 3;	check_text_response_match("west");	if (got_text_match())		direction = 4;		// If the variable is still zero, getting the direction failed. Ask if they	// want to try again.	if (direction == 0) {		reset_dialog();		add_dialog_str(0,"That wasn't a cardinal direction in all lower-case letter. Remember, if you want to go north, enter _north_ without any upper-case. Would you like to try again?",0);		add_dialog_choice(0,"No, cancel this.");		add_dialog_choice(1,"Yes, try again.");		if (run_dialog(1) == 1) // If they want to cancel, end.			end();		// Otherwise, start over.		set_state_continue(10); // ********* LINE TO CHANGE		}		// Otherwise, everything worked out. Move to the next state, which finds out	// how many spaces.		set_state_continue(11); // ********* LINE TO CHANGEbreak;beginstate 11;	// Continuing the flow from state 10. We know what direction. Now we need to	// find out how far, and move the party that far.		message_dialog("Now you need to enter how many spaces. Enter a numeral from one to ten. For example, if you want to move five spaces, enter _5_.","");		// Zero the variable.	what_num = 0;		get_text_response("How many?");	check_text_response_match("1");	if (got_text_match())		what_num = 1;	check_text_response_match("2");	if (got_text_match())		what_num = 2;	check_text_response_match("3");	if (got_text_match())		what_num = 3;	check_text_response_match("4");	if (got_text_match())		what_num = 4;	check_text_response_match("5");	if (got_text_match())		what_num = 5;	check_text_response_match("6");	if (got_text_match())		what_num = 6;	check_text_response_match("7");	if (got_text_match())		what_num = 7;	check_text_response_match("8");	if (got_text_match())		what_num = 8;	check_text_response_match("9");	if (got_text_match())		what_num = 9;	check_text_response_match("10");	if (got_text_match())		what_num = 10;			// Check to make sure this is a valid place. First find the lead character's	// number, which may not be zero, since the player could have a blank space	// his lineup (first character died, perhaps).	i = 0;	while (char_ok(i) == 0)		{i = i + 1; }		// Now figure out the destination and save it. X-coordinate first, then y.	if ((direction == 1) || (direction == 2))		// Moving north or south, so x-coordinate doesn't change.		dest_x = char_loc_x(i);	if (direction == 3)		// Moving east, so x-coordinate will increase.		dest_x = char_loc_x(i) + what_num;	if (direction == 4)		// Moving west, so x-coordinate will decrease.		dest_x = char_loc_x(i) - what_num;	// Now y-coordinate.	if (direction == 1)		// Moving north, so y-coordinate will decrease.		dest_y = char_loc_y(i) - what_num;	if (direction == 2)		// Moving south, so y-coordinate will increase.		dest_y = char_loc_y(i) + what_num;	if ((direction == 3) || (direction == 4))		// Moving east or west, so y-coordinate doesn't change.		dest_y = char_loc_y(i);			// Now check to see if the destination is inside the town's limits. If not,	// set what_num to 500 to indicate the error.	if (current_town_size() == 0) // large town, so 64 x 64		if ((dest_x > 63) || (dest_y > 63))			what_num = 500;	if (current_town_size() == 1) // medium town, so 48 x 48		if ((dest_x > 47) || (dest_y > 47))			what_num = 500;	if (current_town_size() == 2) // small town, so 32 x 32		if ((dest_x > 31) || (dest_y > 31))			what_num = 500;			// Now, if what_num is still zero, then getting the number of spaces has	// failed. If what_num is 500, the space was outside the proper town area. 	// Ask if they want to try again.	if ((what_num == 0) || (what_num == 500)) {		reset_dialog();		if (what_num == 0)			add_dialog_str(0,"That wasn't a numeral between 1 and 10 inclusive. Remember, if you want to go three spaces, enter _3_. Would you like to try again?",0);		if (what_num == 500)			add_dialog_str(0,"That space is outside the town area, which is not allowed. Would you like to try again?",0);		add_dialog_choice(0,"No, cancel this.");		add_dialog_choice(1,"Yes, try again.");		add_dialog_choice(2,"Let me start over.");		choice = run_dialog(1);		if (choice == 1) // If they want to cancel, end.			end();		// If they want to try again, start this state over.		if (choice == 2)			set_state_continue(11); // ********* LINE TO CHANGE		// If they want to try again, start this state over.		if (choice == 3)			set_state_continue(10); // ********* LINE TO CHANGE		}			// If they've made it this far, they have a destination, and everything	// checks out, so actually move them there. This is a bit shaky; the best	// way that I could think of was just to march the party there, not	// refreshing the screen, so that it happens instantly and brings the other	// characters along, but this could lead to strange things, like trailing	// characters standing on the other side of a wall or something.	while (char_loc_x(i) != dest_x) {		if (char_loc_x(i) < dest_x)			march_party(char_loc_x(i) + 1,char_loc_y(i));		if (char_loc_x(i) > dest_x)			march_party(char_loc_x(i) - 1,char_loc_y(i));		}	while (char_loc_y(i) != dest_y) {		if (char_loc_y(i) < dest_y)			march_party(char_loc_x(i),char_loc_y(i) + 1);		if (char_loc_y(i) > dest_y)			march_party(char_loc_x(i),char_loc_y(i) - 1);		}	run_animation_sound(10); // Play teleport sound when they move therebreak; 
Link to comment
Share on other sites

First, read it over and make sure that you follow the logic of the script. The best way to learn to script is to read other people's scripts, and this thing is fully commented.

 

Second, change the internal state references to make sure that they are correct. That is, I have a few set_state_continue(10) calls that should be changed to set_state_continue(16), and some set_state_continue(11) calls that should be set_state_continue(17).

 

Third, make an item that uses this state. I recommend a wand or something similar. The two key lines are:

Code:
 it_ability_1 = 207; // calls state in scenario script when usedit_ability_str_1 = 16; // calls state 16 
If you have those, then it ought to work. The other properties are up to you.
Link to comment
Share on other sites

Code:
 begindefineitem 499;	clear;	it_name = "telaporting wand";	it_full_name = "telaporting wand";	it_charges = 0;	it_variety = 9;	it_floor_which_sheet = 1032;	it_floor_which_icon = 8;	it_inventory_icon = 9;        it_ability_1 = 207; // calls state in scenario script when used        it_ability_str_1 = 16; // calls state 16 	it_value = 0;	it_magic = 1; 
i don't get it what am i doing wrong ? whenever i try to use it it says

(USE: telaporting wand) but nothing happens i changed all the states and stuff i did everything you said to do what am i doing wrong ???
Link to comment
Share on other sites

It's hard to look for errors when we don't know what we're looking for. It'd help if you uploaded your scenario somewhere so we can see what you might be doing wrong.

 

Also, you shouldn't use item number 499; the docs warn against it. Use a different item number.

Link to comment
Share on other sites

Quote:
Originally written by Thuryl:
Coordinate input would work pretty well, I think. Basically you'd need two consecutive Numeric Input domains in your script (one for x-loc, one for y-loc). Two problems would be party placement (which is a problem with any sort of teleportation) and the fact that the player would need a fair idea of their starting coordinates (it'd probably be a good idea to actually tell them the lead character's current location before the first Numeric Input.)
Perhaps the coordinate input could be relative to the current characters position, and put them on the town border if it's out of range...

Also, Kel: Mind putting in a pagebreak in the longer lines of the code? My browser renders this awfully...
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...