Jump to content
  • 0

Is it possible to get item when a specific cell is stepped on?


Question

Posted

Hi. I am trying to re-create a maze quest that is when they set foot on this specific cell, they'll get the reward of the maze teleport them back to the maintown. Is it possible? And the item is account bounded. I'm a total newbie on scripting, I hope anyone can help me with my query.

Attached on the message is the coordinate and the map i wanted the players to step on to finish or clear the maze and get the reward item.

image.png

8 answers to this question

Recommended Posts

  • 0
Posted

You can achieve that by creating an invisible NPC with a trigger zone. Here is a small example:

// The view id is INVISIBLE to make the NPC not clickable and as the name suggests inivisible.
// 0,0 is the x and y span centered around the NPC coordinates.
prontera,152,178,5	script	FINISH_TELEPORT	INVISIBLE,0,0,{
	OnTouch: // < This label gets executed when someone enters the trigger zone at the NPC coordinates.
		getitembound(501, 1, Bound_Account); // Creates a account bound item.
		warp("prontera", 150, 150); // Warps the player to the configured coordinates.
}

 

  • 0
Posted
17 hours ago, Winterfox said:

You can achieve that by creating an invisible NPC with a trigger zone. Here is a small example:

// The view id is INVISIBLE to make the NPC not clickable and as the name suggests inivisible.
// 0,0 is the x and y span centered around the NPC coordinates.
prontera,152,178,5	script	FINISH_TELEPORT	INVISIBLE,0,0,{
	OnTouch: // < This label gets executed when someone enters the trigger zone at the NPC coordinates.
		getitembound(501, 1, Bound_Account); // Creates a account bound item.
		warp("prontera", 150, 150); // Warps the player to the configured coordinates.
}

 

Hi. Thank you so much. I have able to understand the process now. But, if I wanted it like one per character or account. Where should I add the checker?

 

  • 0
Posted
12 minutes ago, sakura125 said:

Hi. Thank you so much. I have able to understand the process now. But, if I wanted it like one per character or account. Where should I add the checker?

 

Sorry, I don't understand your question. Could you please explain, in a bit more detail, what you want to achieve?

  • 0
Posted
20 minutes ago, Winterfox said:

Sorry, I don't understand your question. Could you please explain, in a bit more detail, what you want to achieve?

Ohh sorry. Im bad at explaining in english. But, what I meant was, i'm trying to make the player finish the maze only ONCE per account. If that is possible, So they won't get the item as much as they want.

  • 0
Posted

I see. Well there are different kinds of variables you can use which are bound to different things, for example to a NPC, a character or an account.
In your case, you can simply use an account bound variable, that you can set to 1, when an account got a prize that you can later use to check if a prize was already obtained.

For example, you could extend the script above like this:

prontera,152,178,5	script	FINISH_TELEPORT	INVISIBLE,0,0,{
	OnTouch:
		// Check if the prize was already received.
		if(!#maze_prize_received) {
			// If the price wasn't received. Handout the item and set the account variable to 1 to signal that the prize was received.
			getitembound(501, 1, Bound_Account);
			#maze_prize_received = 1;
		} else {
			// Otherwise show a message to the player.
			dispbottom("You already got the prize!");
		}

		// Warp the player.
		warp("prontera", 150, 150);
}

 

  • 0
Posted
16 hours ago, Winterfox said:

I see. Well there are different kinds of variables you can use which are bound to different things, for example to a NPC, a character or an account.
In your case, you can simply use an account bound variable, that you can set to 1, when an account got a prize that you can later use to check if a prize was already obtained.

For example, you could extend the script above like this:

prontera,152,178,5	script	FINISH_TELEPORT	INVISIBLE,0,0,{
	OnTouch:
		// Check if the prize was already received.
		if(!#maze_prize_received) {
			// If the price wasn't received. Handout the item and set the account variable to 1 to signal that the prize was received.
			getitembound(501, 1, Bound_Account);
			#maze_prize_received = 1;
		} else {
			// Otherwise show a message to the player.
			dispbottom("You already got the prize!");
		}

		// Warp the player.
		warp("prontera", 150, 150);
}

 

Ohh. Thank you so much. Is it possible to call this as a function? So I can use it on another cell as well.

  • 0
Posted
7 hours ago, sakura125 said:

Ohh. Thank you so much. Is it possible to call this as a function? So I can use it on another cell as well.

You can use a function like this:

prontera,152,178,0	script	FINISH_TELEPORT_1	-1,0,0,{
	OnTouch:
		callfunc("prize_teleport");
}

prontera,149,178,0	script	FINISH_TELEPORT_2	-1,0,0,{
	OnTouch:
		callfunc("prize_teleport");
}

function	script	prize_teleport	{
		if(!#maze_prize_received) {
			getitembound(501, 1, Bound_Account);
			#maze_prize_received = 1;
		} else {
			dispbottom("You already got the prize!");
		}

		warp("prontera", 150, 150);

		return;
}

Or you can simply duplicate the NPC and move the copy to where you need it.

prontera,152,178,0	script	FINISH_TELEPORT	-1,0,0,{
	OnTouch:
		// Check if the prize was already received.
		if(!#maze_prize_received) {
			// If the price wasn't received. Handout the item and set the account variable to 1 to signal that the prize was received.
			getitembound(501, 1, Bound_Account);
			#maze_prize_received = 1;
		} else {
			// Otherwise show a message to the player.
			dispbottom("You already got the prize!");
		}

		// Warp the player.
		warp("prontera", 150, 150);
}

prontera,149,178,0	duplicate(FINISH_TELEPORT)	FINISH_TELEPORT#01	-1,0,0

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...