Full Version : Hello, a super noob here
xmlspawner >>Q&A >>Hello, a super noob here
<< Prev | Next >>
slida- 04-03-2006
Hello, I am brand new here new here. I've read quite a lot but this question is so specific I feel I'm looking for a needle in a haystack.
I want to know if it is possible, using your program and its /syntax: item/properties/etc. to have an item spawn such that if you double-click it, it will disappear and a moongate will spawn to a specific location. I am working on a dungeon piece by piece, to teach myself how to use this program, and to start, you must defeat this guardian who will be carrying a moonstone or something like it, which would be on his corpse. I thought I could modify the moonstone.cs, but the moongate takes 4 args when created and I don't know how to write it in proper syntax. Anyway I ask because it seems like maybe your program will offer a shortcut. I understand what the C# scripts are doing but I can't code too much yet, and I just started looking at XML today, it seems like all the action is taking place at the bottom and I don't quite get it yet,so comprehension may take a while.
This seems to be an excellent program for what I want, good job! It's quite a luxury to be able to ask the creator questions and I'm glad you are actively supporting it. As I become more proficient I could probably help you out with answering questions in the future. TIA!
Oh as a postscript, I couldn't get into this site all of yesterday and earlier today, I don't know if this was a problem that you were aware of or not, so I just thought I would mention it.
ArteGordon- 04-04-2006
the downtime was a problem with the forumer host. It happens every now and then.
As for your moongate, what I would do would be to use the TimedSwitchableItem.
This lets you create a switch that when double clicked will change its itemid and set a property on a target item. You could use that to activate a spawner that would spawn your moongate with the desired destination for a limited time.
Here is an example of that.
There are two spawners. MoongateSwitch#1 just creates the switch and sets up the properties. You could forget about the spawner and just place it and configure it by hand. I just added it to have it automatically set up the whole thing.
Take a look at the properties of the switch to see how it is configured.
What the switch does is to set the ItemID0 property to the itemid of a gravestone. That is what it will look like in the default 0 state.
When you double click it, the switch changes state to 1, and the item id changes to the value of ItemID1 which I assigned a value of 1 (which is basically nothing). That makes it disappear when you double click it.
Then I assigned the Target1Item to point to the spawner name MoongateSwitch#2, and assigned the Target1Property to the value of "/proximityactivated/true". This will cause that property assignment on the MoongateSwitch#2 spawner to be made when the switch goes to state 1 (i.e. when it is double clicked).
I also set the min/maxdelay of the switch to a value of 20 seconds. After that time, the switch will automatically go back to state 0 and the itemid will be changed back to the gravestone (ItemID0).
The actual moongate spawner just creates a moongate and assigns its Target and TargetMap properties to your desired destination. You can edit this in the MoongateSwitch#2 spawner entry.
I also set it up to be exclusively externally triggered by setting the ProximityRange to a value of -2. This means that the only way to activate the spawner is by manually setting ProximityActivated to true (which is what the switch does).
I set the Duration of the spawner to 19 seconds which means the moongate will be despawned 19 seconds after being spawned.
I set the SpawnOnTrigger property to true so that it spawns as soon as it is triggered.
I know it sounds complicated, but if you study it I'm sure it will slowly begin to make sense.
To try it out just copy the spawner definitions that I included into a text file, place that file either in the main RunUO directory, or in the Spawns folder in your main RunUO directory, and then load in that definition with
[xmlloadhere yourfilename

QUOTE
<Spawns> <Points> <Name>MoongateSwitch#1</Name> <UniqueId>6d281581-afb8-4687-a7e2-fc50d39108e4</UniqueId> <Map>Felucca</Map>
<X>5436</X>
<Y>1157</Y>
<Width>0</Width>
<Height>0</Height>
<CentreX>5436</CentreX>
<CentreY>1157</CentreY>
<CentreZ>0</CentreZ>
<Range>5</Range>
<MaxCount>1</MaxCount>
<MinDelay>5</MinDelay>
<MaxDelay>10</MaxDelay>
<DelayInSec>False</DelayInSec>
<Duration>0</Duration>
<DespawnTime>0</DespawnTime>
<ProximityRange>-1</ProximityRange>
<ProximityTriggerSound>500</ProximityTriggerSound>
<TriggerProbability>1</TriggerProbability>
<InContainer>False</InContainer>
<MinRefractory>0</MinRefractory>
<MaxRefractory>0</MaxRefractory>
<TODStart>0</TODStart>
<TODEnd>0</TODEnd>
<TODMode>0</TODMode>
<KillReset>1</KillReset>
<ExternalTriggering>False</ExternalTriggering>
<SequentialSpawning>-1</SequentialSpawning>
<AllowGhostTriggering>False</AllowGhostTriggering>
<SpawnOnTrigger>False</SpawnOnTrigger>
<SmartSpawning>False</SmartSpawning>
<Team>0</Team>
<Amount>1</Amount>
<IsGroup>False</IsGroup>
<IsRunning>True</IsRunning>
<IsHomeRangeRelative>True</IsHomeRangeRelative>
<Objects2>timedswitchableitem/name/Moongate Switch/mindelay/00:00:20/maxdelay/00:00:20/itemid0/3796/itemid1/1/target1item/GET,MoongateSwitch#2,xmlspawner,serial/target1property/@/proximityactivated/true:MX=1:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1</Objects2>
</Points>
<Points>
<Name>MoongateSwitch#2</Name>
<UniqueId>7a72a1a5-2445-426f-b858-73d2b719bbdd</UniqueId>
<Map>Felucca</Map>
<X>5436</X>
<Y>1156</Y>
<Width>0</Width>
<Height>0</Height>
<CentreX>5436</CentreX>
<CentreY>1156</CentreY>
<CentreZ>0</CentreZ>
<Range>5</Range>
<MaxCount>1</MaxCount>
<MinDelay>5</MinDelay>
<MaxDelay>10</MaxDelay>
<DelayInSec>False</DelayInSec>
<Duration>0.316666666666667</Duration>
<DespawnTime>0</DespawnTime>
<ProximityRange>-2</ProximityRange>
<ProximityTriggerSound>500</ProximityTriggerSound>
<TriggerProbability>1</TriggerProbability>
<InContainer>False</InContainer>
<MinRefractory>0</MinRefractory>
<MaxRefractory>0</MaxRefractory>
<TODStart>0</TODStart>
<TODEnd>0</TODEnd>
<TODMode>0</TODMode>
<KillReset>1</KillReset>
<ExternalTriggering>False</ExternalTriggering>
<SequentialSpawning>-1</SequentialSpawning>
<AllowGhostTriggering>False</AllowGhostTriggering>
<SpawnOnTrigger>True</SpawnOnTrigger>
<SmartSpawning>False</SmartSpawning>
<Team>0</Team>
<Amount>1</Amount>
<IsGroup>False</IsGroup>
<IsRunning>True</IsRunning>
<IsHomeRangeRelative>True</IsHomeRangeRelative>
<Objects2>moongate/target/(5439,1150,0)/targetmap/felucca:MX=1:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1</Objects2>
</Points>
</Spawns>

slida- 04-05-2006
Thanks for your help Arte. I'm getting the gist of it. I've got a bit of a follow up here.
I'm thinking for this particular problem maybe I don't want a switch, or maybe different configuration to make it do something a little different. What I had done before I posted here, was make a sequential spawn, first spawning the monster when you got close to the spawner, and then when the monster dies a moongate opens. What I want to do is have an item spawn on the monsters corpse(don't know quite how to do that yet but it doesn't seem too hard, I can look that up) and then have it where a player could pick it up if he/she wants(edit: I figured out how to make the switch movable since this post). and when the double click a moongate opens. I don't want the item to stay around when that happens. Can you configure the switch such that it despawns itself, thus activating the next spawn in the sequence, which would be the moongate? That switch capability is pretty neat I think. I'll resist the urge to ask more questions, and just say thanks again. I love this program already!
ArteGordon- 04-06-2006
you could delete the switch by adding an entrylike this to your moongate spawner
SET,Moongate Switch,timedswitchableitem/DELETE
that uses the SET type keyword to set properties on the moongate switch that you spawned, and the DELETE property keyword to delete it.
So they use the switch to activate the spawner, and then the spawner deletes the switch.
from xmlspawner2.txt

QUOTE
- added the new "DELETE" keyword that can be used to modify a standalone keyword and delete the object that it refers to (it will not allow you to delete players) For example, this spawn entry SET,Mystic Sword,longsword/DELETE will delete the longsword named "Mystic Sword"
SETONMOB,SeeYouLater,Balron/DELETE
will delete the balron named "SeeYouLater"
SETONCARRIED,,Gold/DELETE
will delete gold that it finds being carried by the triggering mob
SETONSPAWN,TargetSpawner,2/DELETE
will delete all of the spawns of subgroup 2 on the spawner named TargetSpawner. This is basically the same as using the DESPAWN keyword but will delete all spawns regardless of their CLR flag setting.

The only problem that you will run into is if you end up spawning more than one switch since this doesnt guarantee that it will delete the one that was actually used.
Another way of doing it would be to set the target0item property of the switch to point to the switch itself, and then have the target0property of "/DELETE" and then set the min/maxdelay of the switch to 0 so that when you switch it to the 1 state by double clicking it, it activates the spawner, and then when it immediately switches back to the 0 state it will delete itself.

QUOTE
timedswitchableitem/name/Moongate Switch/mindelay/0/maxdelay/0/itemid0/3796/itemid1/1/target1item/GET,MoongateSwitch#2,xmlspawner,serial/target1property/@/proximityactivated/true SETONSPAWN,1/target0item/GETONSPAWN,1,serial/target0property/@/DELETE

put both of those into subgroup 1 so that they will spawn together.
Note that because the target0property has special chars in it (the '/'), that it must be assigned using the literal-to-end-of-string operator '@', and since that is already being used to set the target1property in the first line, I had to add another entry to do it.
slida- 04-09-2006
Hey Arte, thanks for you help again. Not sure how to word this follow up but I'll give it a whirl. So somehow, with the information about the delete command, I was able to configure the switch to delete itself, I say somehow, because although it didn't take me very long to figure out how to do it on Friday, today, Sunday, I can't figure out how I did it, it was so obvious and simple 2 days ago. I should have just been happy with that, as it almost did what I wanted, you clicked on the stone, it deleted itself, then the moongate spawns. However if you picked it up and put it in your pack, the moongate would spawn anyway, so my triumph was short-lived. So I started trying to use the code you gave me and ran into a problem. When everything is in the sequential spawner, there is just one spawner name, so the GET command doesn't seem to work, that is you could name the moogate "moongate switch#2" but GET is looking for another spawner named "moongate switch#2" and it doesn't exist, this interpretation may very well be incorrect, but it is my guess, because I couldn't get this to work at all this way(all in the same sequential spawner).
So I created seperate spawner for the moongate, like you had originally showed me, and used the switch to activate that which worked fine, however I couldn't for the life of me get the moongate spawner to delete the switch, it keeps saying property not found, among other things(this is even if it is on the ground, I've realized that the backpack complicates matters significantly). I've been doing all sorts of variations with some interesting results. One time I succeeded in deleting the moongate spawner with the switch somehow. I've gotten an infinite loop where everything spawns and deletes itself. Great fun! On the plus side, I am understanding how stuff works better.
In conclusion, to have things the way I am imagining, I think what I need to do is abandon the sequence and make three spawners. One for the creature, one to spawn the switch on the creatures corpse, and the moongate spawner. The main problem besides the deletion is that deleting the switch in the sequential spawner would start the sequence over, and the creature would respawn.
So my revised questions are, 1.)How do I get the creature spawn to activate the switch spawn, and the get the switch to spawn on the creatures corpse when it dies? I couldn't find any examples of that, I tried using the add command but it didn't do anything. Is this perhaps a complicated thing to do, maybe I have to modify the script, and put the switch in there somehow? This is why I was using the sequential spawner, to make this easier 2.) This isn't really a question, but the code you showed me

QUOTE
timedswitchableitem/name/Moongate Switch/mindelay/0/maxdelay/0/itemid0/3796/itemid1/1/target1item/GET,MoongateSwitch#2,xmlspawner,serial/target1property/@/proximityactivated/true SETONSPAWN,1/target0item/GETONSPAWN,1,serial/target0property/@/DELETE

kept getting hung up on the last @, saying @ property not found. So the switch wouldn't delete. I need some insight on what I'm getting wrong here. I'm actively working on this 2nd part right now so maybe I'll get it fixed soon. Thanks again!
ArteGordon- 04-09-2006
that is actually a bit tricky to set up using that kind of switch.
Here is a simple script for an item called a SingleUseSwitch that will make doing this easier. It is basically a simple switch that deletes itself after a single use.

CODE
using System; using Server; namespace Server.Items { public class SingleUseSwitch : SimpleSwitch
{
[Constructable]
public SingleUseSwitch()
{
}
public SingleUseSwitch(Serial serial)
: base(serial)
{
}
public override void OnDoubleClick(Mobile from)
{
if (from == null || Disabled) return;
if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this))
{
from.SendLocalizedMessage(500446); // That is too far away.
return;
}
base.OnDoubleClick(from);
// delete after use
Delete();
}
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();
}
}
}

Then you can spawn this on a creature using the ADD keyword and an entry like this

QUOTE
orc/ADD/<singleuseswitch/name/Moongate Switch/itemid/3796/movable/true/target1item/GET,MoongateSwitch#2,xmlspawner,serial/target1property/@/proximityactivated/true

slida- 04-10-2006
OK, I am almost there, I looked at a quest you made and saw how to add specific items to a mobile using <>, I didn't see this explicitly laid out anywhere else. If you make the switch movable, it will spawn on the monster, and you can pick it up if you want and doubleclicking will activate the second spawner, the moongate. However I still cannot figure out how to delete the switch, nothing is working. The reason this is important to me is because once you have this item, it will always open the moongate regardless of whether or not you kill the guardian. In the fairly unlikley future where I would have players on the shard, I don't want this shortcut to exist, so I want the item eliminated upon use, or say eliminated over time, that would be a better idea, would that be possible? To have it despawn in ten minutes? Could you include such properties when you do the add<>command? I'm thinking you might have to script to do such things, put some sort of decay timer on the switchable item, maybe modify and rename the timedswitch script with this timer put in.
Anyways, thanks for your help so far, I've learned a lot. I like to learn for myself but there is just not a lot of information out there for the things I'm doing. For instance, I can barely use pandora's box, and there is not much advice on how to use it, I don't know how people know what to do with it. It's exasperating at times, and I appreciate your willingness to support your program.
slida- 04-10-2006
HeHe, We must have been writing our posts at the same time, as soon as I got done with mine, your answer came up. I unfortunately have to go to sleep right now but it looks like you've come up with the solution. Thanks again, I'll try it outtttttttttttttttttttttttttttttttttttttttttttttttt...zzzzzzzzzzz
ArteGordon- 04-10-2006
if you also want the switch to autodelete after some period of time, you can add the TemporaryQuestObject attachment to it which allows you to specify an expiration time. After that time expires, the object it is attached to will be deleted.
The timer will start as soon as it is spawned.

QUOTE
orc/ADD/<singleuseswitch/name/Moongate Switch/itemid/3796/movable/true/ATTACH/temporaryquestobject,,30/target1item/GET,MoongateSwitch#2,xmlspawner,serial/target1property/@/proximityactivated/true

That will give the switch a 30 minute expiration time. The ',,' just gives the attachment an empty name. You could also name it if you like, it doesnt matter. The name is only used if it is part of a named quest.
The angle brackets '<object/property/value/...>' allow you to specify properties on the object that is defined in the brackets instead of on main object being spawned (in this case the orc).
slida- 04-10-2006
Allright! Everythings a go! It would have been a lot quicker if I had noticed that your How Do I forum had more than page(the search option here doesn't do much, you have to just look around, for instance, I typed in switch and all I got was this post and some other post that just had the word switch in it, maybe it doesn't search all the forums like it says it is). Thanks for the script, it works great, and it's so simple, I'm slowly remembering how OOP works. It's the perfect language for doing a game like this, and it is a great way to learn it actually. Someone should develop a language tutorial using UO.
I have a couple of observations about the program.
Although it certainly adds graphical elegance to the GUI, I don't like using the books, they do some odd things with the text and make weird line breaks, it can be difficult to notice mistakes, is there a simple way for me to modify that to just a text box? The second thing is probably unfixable, but It took me a while to figure out what I was doing wrong because, unless I flat out misspelled a command, when an error popped up, it would just show the last error, I kept thinking everything was fine but the last part of the code, when really I had screwed up much earlier. I figure that is probably just an inherent limitation though.
Thanks a lot for your help, I get a bit obsessive/compulsive when it comes to problem solving and I was unable to continue with my quest until I got this figured out. I'll try to keep my questions to a minimum, but it's almost guaranteed I'll want to do something crazy in the future. Can't wait to start screwing around with xmlattachments especially. This is quite a system you have here, I think if more people realized what it could do it would be even more popular. Keep up the good work! I'll make some contributions to the cause when I know enough to be helpful.
ArteGordon- 04-11-2006

QUOTE (slida @ April 10, 2006 08:49 pm)
Allright! Everythings a go! It would have been a lot quicker if I had noticed that your How Do I forum had more than page(the search option here doesn't do much, you have to just look around, for instance, I typed in switch and all I got was this post and some other post that just had the word switch in it, maybe it doesn't search all the forums like it says it is). Thanks for the script, it works great, and it's so simple, I'm slowly remembering how OOP works. It's the perfect language for doing a game like this, and it is a great way to learn it actually. Someone should develop a language tutorial using UO.
I have a couple of observations about the program.
Although it certainly adds graphical elegance to the GUI, I don't like using the books, they do some odd things with the text and make weird line breaks, it can be difficult to notice mistakes, is there a simple way for me to modify that to just a text box? The second thing is probably unfixable, but It took me a while to figure out what I was doing wrong because, unless I flat out misspelled a command, when an error popped up, it would just show the last error, I kept thinking everything was fine but the last part of the code, when really I had screwed up much earlier. I figure that is probably just an inherent limitation though.
Thanks a lot for your help, I get a bit obsessive/compulsive when it comes to problem solving and I was unable to continue with my quest until I got this figured out. I'll try to keep my questions to a minimum, but it's almost guaranteed I'll want to do something crazy in the future. Can't wait to start screwing around with xmlattachments especially. This is quite a system you have here, I think if more people realized what it could do it would be even more popular. Keep up the good work! I'll make some contributions to the cause when I know enough to be helpful.

Unfortunately, I have also found the search to be quite limited, and the forum display will default to only displaying posts updated in the last 30 days, so you can miss a lot of things. I just switched my settings to display everything.
The book is not ideal, but it is one of the few ways to allow extended text entry due to client limitations, and it also provides text editing capabilities in the 2D client. A regular text box only allows about 230 chars with no real editing ability.
If you really want the text box, there is a compile time switch in the code that lets you go back to text box entry. In xmlspawnergumps.cs just comment out this line
//#define BOOKTEXTENTRY
I havent tried this in quite a while but it should work. The two lines at the bottom are for editing. They give you search and replace capability in the main text.
Note, this will limit all of your entries to 230 chars or so and if you try editing entries that are longer than that, the additional text will be lost.
slida- 04-11-2006
Well bummer, I thought the books were just for appearances. I know very little about how this stuff works. Anyway it's just a minor issue, and if the text box is worse then I'll just get used to the book. I knew I must be doing something wrong with the search. Thanks again!