|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Newbie
Join Date: Jul 2003
Posts: 55
|
Ok here's the scenario, I am trying to get a spawner to work only once per player with one time voice command. In other words I want a spawner that a person walks up to and says a "phrase", this "phrase" should spawn a stack of ignots in a bag. once this has happened it can not said or used again. So can this be done with one of the spawner programs or can a script be written to do it one time for a player? Of course with the spawn idea there is a chance of another player looting the item before some one else can. So I am guessing a script would work. This is a prior script I had for the Money Tree I made, with props to Krozz since he also made one before me that I did not see till later time . I just need help constructing it to work only one time per player. Any help would be appreciated.
Code:
#Designed by Pyrochaser July 2003#
#Credits to Krozz as well for same concept at an earlier time#
using System;
using Server.Items;
namespace Server.Items
{
public class MoneyTree : Item
{
[Constructable]
public MoneyTree() : base( 0x11C9 )
{
Movable = false;
Hue = 0x495;
Name = "Money Tree";
}
public override void OnDoubleClick( Mobile from )
{
BankCheck BankCheck = new BankCheck( 100000 );
if ( !from.AddToBackpack( BankCheck ) )
BankCheck.Delete();
}
public MoneyTree( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
|
|
|
|
|
|
#2 (permalink) | |||
|
Master of the Internet
Join Date: Aug 2003
Posts: 5,688
|
with xmlspawner, you could set it up like this
To make the spawner trigger on speech, 1) set the ProximityRange property to the max distance in tiles that the players can be to trigger it. 2) set the SpeechTrigger property to the string you want. 3) set the SpawnOnTrigger property to true so that it immediately spawns when triggered instead of waiting the min/maxdelay period for the spawner. 4) To only allow it to be spawned once per player, you will need to maintain some information on the player. The easiest way to do this is to tag them with an xmlspawner attachment and then test for the attachment when triggering the spawner. To add the attachment to the player when you trigger the spawn add an entry like SETONTRIGMOB/ATTACH/xmldata,HasIngots 5) To give them your ingots, you can spawn them directly into the players pack using a spawn entry with the GIVE keyword. That way you dont have to worry about someone else looting it. GIVE/valoriteingot,100 If you just wanted to spawn ingots in a bag on the ground, use an entry like bag/ADD/valoriteingot,100 If you wanted to give the player the bag with ingots, you can do it like GIVE/<bag/ADD/valoriteingot,100> 6) Assign the spawn entries from step 4 and 5 to the same subgroup (e.g. subgroup 1). To set subgroups, expand the basic spawner gump with the little arrow button in the lower right. Find the 'Sub' column and enter '1' into the field for each entry. By placing them into the same subgroup you make them all spawn together as a group. You would want them to spawn together so that when you give them the ingots, you also add the attachment. 7) To block spawning if they have the attachment (which means they already triggered the spawner and received the ingots), set the NoTriggerOnCarried property to the following string ATTACHMENT,HasIngots,xmldata 8) test it out as a player. By default, staff wont trigger any of this. I suggest using the StaffCloak that is included in the xmlspawner package for this purpose. 9) and some other helpful info for further reading more info on triggered spawns XMLSpawnerFan -> Trigger spawns based on player proximity from xmlspawner2.txt Quote:
Quote:
Quote:
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. " For questions, information, and support for XmlSpawner and its addons, visit the XmlSpawner Support Forum Last edited by ArteGordon; 07-16-2007 at 10:03 AM. |
|||
|
|
|
|
|
#3 (permalink) |
|
Newbie
Join Date: Jul 2003
Posts: 55
|
I appreciate the info Arte, I am just a little confused on point in the steps.
Code:
4) To only allow it to be spawned once per player, you will need to maintain some information on the player. The easiest way to do this is to tag them with an xmlspawner attachment and then test for the attachment when triggering the spawner. To add the attachment to the player when you trigger the spawn add an entry like SETONTRIGMOB/ATTACH/xmldata,HasIngots 5) To give them your ingots, you can spawn them directly into the players pack using a spawn entry with the GIVE keyword. That way you dont have to worry about someone else looting it. GIVE/valoriteingot,100 Ok so my problem is how do I go about getting an XML tag attachment on a player, how do I type the entry is it in the spawner device or do I have to add it through the player [props. If that is the case would it would be hard to get all new players coming in, unless I have to edit the creation character script. Also where do I add the entry GIVE? If you have time to list the work involved thanks in advance but if you have a tutorial I can use to learn about your xml spawner creations I would love to read it. Thanks again Pyrochaser |
|
|
|
|
|
#4 (permalink) | |
|
Master of the Internet
Join Date: Aug 2003
Posts: 5,688
|
Quote:
You would type those directly into the spawner gump as spawn entries. XMLSpawnerFan -> XMLSpawner Basic's: Part 1, The Main Spawner Gump You dont have to modify any scripts or any player properties to make all of this work.
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. " For questions, information, and support for XmlSpawner and its addons, visit the XmlSpawner Support Forum |
|
|
|
|
|
|
#6 (permalink) |
|
Master of the Internet
Join Date: Aug 2003
Posts: 5,688
|
just a note on those attachments. You can view and modify the attachments on a player (or any other object) using the [getatt command. So if you wanted to remove the attachment to allow the player to trigger the spawner again you could use the command to see the list of attachments and delete it.
You can think of them as tags but for individual players instead of accounts.
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. " For questions, information, and support for XmlSpawner and its addons, visit the XmlSpawner Support Forum |
|
|
|
|
|
#7 (permalink) |
|
Forum Novice
Join Date: Oct 2005
Posts: 142
|
Heads up:
Arte's spawn system is killer, but in this case it's not entirely necessary. You could [easily] construct a new item that checks for speech in a range, then add further checks to see if that player has used the item, what access level they are, etc. Arte's way might be easier, but I like to understand how to do things [myself]. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|