how can i setup a item to be consumed and the player moved to a location

When you create an item, you basically inherit the Item class. The item class itself has some premade methods.
one of those is OnDoubleClick.

Your class should look like this...

public class ThisCustomItem : Item //This is the inherited class or your base class (parent)

If your using Visual Studio. In a separate method, start typing override OnDoubleClick, and it should auto-generate the method you need to override, so it'll look something like this...
Code:
public override void OnDoubleClick(Mobile from)
{
	base.OnDoubleClick(from)
}
You can then do all you want inside that method to handle what you want.

Your final product should look like this...

Code:
public override void OnDoubleClick(Mobile from)
{
	base.OnDoubleClick(from) // The base classes OnDoubleClick method code gets called here before yours.

	if (from != null) //Get into a habbit of using this, as you may encounter null reference errors if you dont. Your basically making sure when the player clicks this item, they aren't null, otherwise itll cause a null reference exception.
	{
		from.MoveToWorld((100, 100, 0), Map.Felucca) // X, Y, and Z location as well as the map you want to teleport to.
		this.Delete(); // After you've been moved to the world, delete the item. The this. just means the current item the script is on. It is redundant to say this.Delete(), since your already in the scripted item you want to delete, but its good practice to do it while your learning. You can very well just say Delete();
	}
}

That's basically it.

Check out any other basic item in the game to get the exact template on how to create an item, then just override the OnDoubleClick method and do everything you want in there.

Hope this helps!
 
I quickly realized the title of this post was about XML. =P. SIlly me. I'll leave the reply incase anyone else wanted to know anyways.
 
I've done this with two Xmlspawners, 1 to spawn the object to be consumed or picked up and to trigger the second spawner and the second spawner to perform the teleport. Otherwise, if you left them on the same Xmlspawner, as soon as the item is picked up (removed from the Xmlspawner), it triggers the next subgroup, which would be the teleport. I'll overview both processes though.

First Xmlspawner:
1. ItemToBeConsumed (subgroup 1)
2. SET,XmlSpawnerName/Serial/DoReset/True/Running/True (subgroup 2)
3. SETONTHIS/DoReset/True (subgroup 3)

Lets say a player drinks poison that we spawned. You would set the TrigProperty to be Playermobile.Poison=WhateverLevelOfPoison and then you could have this...

Second Xmlspawner:
1. SETONTRIGMOB/SENDMSG/You don't feel so hot! (subgroup 1)
2. SETONTRIGMOB/X/?/Y/?/Z/? (subgroup 1) (the ? are where the XYZ values go)

So that's that, but here's also how you can do this with one Xmlspawner:
1. ItemToBeConsumed (subgroup 1)
2. SETONTRIGMOB/SENDMSG/You don't feel so hot! (subgroup 2)
3. SETONTRIGMOB/X/?/Y/?/Z/? (subgroup 2)
4. SETONTHIS/DoReset/True/Running/True (subgroup 3)

As soon as the item in the first line entry is picked up or consumed, subgroup 2 triggers.
 
Tried ur example Tass its not working i basically want it setup where player kills set of mobs the mobs have a chance to drop the item and they go to the next set of stairs it drops them down another floor. basically to a whole another area
 
Does it have to be a consumable? Because you can setup a TemporaryQuestObject as whatever item and have another Xmlspawner trigger when that object is being carried and delete the object from the player's backpack and teleporting them.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back