Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 07-16-2007, 08:57 AM   #1 (permalink)
Newbie
 
Pyrochaser's Avatar
 
Join Date: Jul 2003
Posts: 55
Exclamation Voice Activated Spawn [Megaspawner 2.0] or [XML Spawner]

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(); 
      } 
   } 
}
My scripting skills are crap so a visual walk through of what to add and how would be helpful.
Pyrochaser is offline   Reply With Quote
Old 07-16-2007, 09:23 AM   #2 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

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:
- spawner triggering can be made dependent upon attachments on the triggering mob by using the "ATTACHMENT,name,type" string in the TriggerOnCarried or NoTriggerOnCarried properties. This will make triggering dependent on attachments on the mob, or an attachment on an item equipped by the mob, or an attachment on an item in the top level of the mobs backpack (see attachtest1.xml for an example).
Quote:
- added the GIVE keyword which is used as a spawn spec, and is "spawned" just like a regular mob/item. The syntax is the same as the ADD keyword, but the item is placed directly into the pack of the player that triggered the spawner, "GIVE/itemtype", or "GIVE,probability/itemtype", or "GIVE,probability/<itemtype/prop1/value/prop2/value...>"
- added the TAKE keyword which is used as a spawn spec, and is "spawned" just like a regular mob/item. The syntax is "TAKE/itemname" or "TAKE,probability/itemname". It will search the trigger players pack, and all containers in the pack for the first item that matches the name, and then delete it. It will not remove containers.
By combining the GIVE and TAKE keywords, you can have a spawner that takes one item and replaces it with another, for example a quest item can be replaced with a quest reward.
Quote:
- description of the new attachments included in this version:
XmlDex, XmlInt, XmlStr - these attachments simply apply temporary dex/int/str mods to the recipient. The value and duration can be specified.

XmlHue - allow the hue of the target to be temporarily modified. The value and duration can be specified.

XmlSkill - When applied to a mob, allows the specified skill to be temporarily modified. A word can also be specified which is required to activate the modification. If applied to a weapon or armor, the item must be equipped when the word is spoken to activate the skill mod. The skill, value, triggering word, and duration can be specified.

XmlDate, XmlData, XmlValue - these attachments allow bits of information to be added to the target. XmlDate supports DateTime information, XmlValue supports ints, XmlData supports strings. These can be added and read by spawners (see attachtest1.xml for an example).

XmlSound - allows a sound to be played whenever a player comes in range of the object it is attached to or says a triggering word. The sound value, minimum interval between activations, number of uses, and triggering word can be specified.

XmlMessage - allows an overhead message to be displayed whenever a player comes in range of the object it is attached to or says a triggering word. The message value, minimum interval between activations, number of uses, and triggering word can be specified.
__________________
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.
ArteGordon is offline   Reply With Quote
Old 07-16-2007, 10:13 AM   #3 (permalink)
Newbie
 
Pyrochaser's Avatar
 
Join Date: Jul 2003
Posts: 55
Default

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
Pyrochaser is offline   Reply With Quote
Old 07-16-2007, 10:17 AM   #4 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

Quote:
Originally Posted by Pyrochaser View Post
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

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
ArteGordon is offline   Reply With Quote
Old 07-16-2007, 10:47 AM   #5 (permalink)
Newbie
 
Pyrochaser's Avatar
 
Join Date: Jul 2003
Posts: 55
Default

Alright Arte I believe I got it. Thanks a million for the help. Damn mighty fine spawning program you wrote. One of the most impressive ones I think I have ever worked with. You got my rep points for this one

Pyrochaser
Pyrochaser is offline   Reply With Quote
Old 07-16-2007, 10:54 AM   #6 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

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
ArteGordon is offline   Reply With Quote
Old 07-17-2007, 10:02 AM   #7 (permalink)
Forum Novice
 
Join Date: Oct 2005
Posts: 142
Default

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].
Shadow-Sigma is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5