RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Xmlspawner2 v2.22

Status
Not open for further replies.

ArteGordon

Wanderer
Xmlspawner2 v2.22

Click here to download
Please see the attachment link below if this doesnt work.

Summary:
Modification of bob smarts xmlspawner with additional features.
New in
Version 2.22
updated 2/15/04
- Added the CAST keyword to allow the spawner to cast spells on triggering players.
- Added an argument to the SET keyword allowing property values to be set on named items.
- Added line editing to the spawn text gump.
- Added multiple pages to the spawn gump.
- Added an addspawn property interface that will allow spawns to be added to a spawner without opening the gump, e.g. via other objects.

- Added an external trigger hook that allows other objects to actively control the spawner.
- Allow arguments to be passed to spawn constructors so that objects, such as doors, that require arguments can also be spawned
- Added new questnote item, and XmlQuestToken class for multipart spawner quest construction.
- Added a second xmlquest (blather2.xml) that demonstrates the new quest items and triggering features.
- Added the SETONCARRIED keyword that allows you to set properties on a named item carried by the triggering player.
- added the NoTriggerOnCarried property, that blocks spawner triggering when the player is carrying the named item.
- added a sample xmlfile quest using the spawner triggering and gump features.
- added the GUMP keyword that will send a gump containing the designated text to the triggering player.
- Added keywords allowing random magic items to be dropped, added to spawned mob, or given to players.
- Added non-proximity based triggering of spawns with the object property, and mob property triggering features.
- Added an [xmldefaults command to display and alter default parameters used when creating spawners.
- changed the way that X1Y1 X2Y2 behave when setting spawning regions.
- Added the ability to set properties on items and players when spawners are triggered.
- Added the ability to display messages over items and mobs when they are triggered.
- Added the [xmlimportspawners command allowing xml descriptions of regular spawners from Sno's xml package to be read in as xmlspawers.
- Added several new items for added content including a note, and several levers/switches
- Added a trigger probability that will control the chance that a spawn will occur even if all other conditions are met.
- Added player/mob-property triggered spawning.
- Added an [xmlspawnerunload command (also the shorthand version [xmlunload) that is the reverse of the load command.
- Added the ability to add items to a spawn mobs pack.
- Added the ability to use random number generation in specifying property values of mobs or items
- Added a new note item that can be defined in the spawner for passing messages to players.
- Added speech triggering of spawns.
- Added a killcount parameter that provides information on the number of kills on a spawner.
- Added an [xmlhome command that gets spawner location, can teleport you to the spawner, remotely open the spawner gump, or individually send mobs home.
- Added player proximity triggered spawning with sounds and messages
- Added time-of-day dependent spawning.
- Added player-item triggered spawning (player carrying a named item needed to spawn)
- Added item-property triggered spawning to allow chaining of spawns, and other item-based activation schemes.
- Added the ability to set properties for spawned items/mobs in the spawn description string
- Added probabilistic spawning that can be used to implement rare mob spawns, such as a single spawn that you have to kill on average some number of times to get a rare named spawn to appear.
- Added single and stacked item spawning in containers.
- Added a duration parameter that allows for time-limited spawns, such as rares that only appear for a certain amount of time.
- Added a spawnrange parameter (how far they spawn) that complements the homerange parameter (how far they wander).
- Added two respawn commands.
- Added a fix for deletion of spawned items such as rares, that are not left in containers (e.g. locked down on the ground).
- Added fixes for a few invalid spawn issues as well as some optimizations to reduce system load.

Description:

New in
Version 2.22
updated 2/15/04

- added the CAST keyword to allow the spawner to cast spells on triggering players. The syntax is "CAST,spellname[,arg]" or "CAST,spellnumber[,arg]" where spellname and spellnumber are the registered spell names and numbers found in Scripts/Spells/Initializer.cs. This is used with triggering to allow the triggering mob/player to cause the spell to be cast with the triggering mob/player as the target. Both harmful and beneficial spells can be cast. Casting normal circle spells does not use mana or reagents, Necro/Paladin spells use mana/tithing points of the caster, and both paladin and necro spells check for skill requirements on casting. Karma effects will also be applied. There are no casting delays, so multiple spells may be cast simultaneously. Some spells are are location targeted and can take an additional argument [,arg] which is a range value used to determine a random target location (+-range) relative to the caster. The default and mininum range value is 1. The Polymorph spell uses the 2nd argument as the bodyvalue.
For example, to set up a spawner to autoheal the triggering mob use the spawn spec "CAST,greaterhealspell". To polymorph the triggering player into a bear use "CAST,polymorphspell,212". To cast lightning on the triggering player "CAST,lightningspell", or to summon a creature "CAST,summoncreaturespell", or bladespirits "CAST,bladespiritsspell", and to cast it with a random target within +-5 squares of the player use "CAST,bladespiritspell,5". Note, not all spells will work automatically. Item targeted spells such as mark, recall, and sacredjourney will cast and bring up a targeting cursor.

- added a new optional argument to the SET keyword. The "SET,itemname/prop/value/prop/value/..." form allows you to set property values on uniquely named items without having to set them as predefined targets using the SetItem property. This can be used to set properties on things that cannot be targeted because they are not necessarily available as existing objects at the time, such as spawned items.

- added an addspawn property interface that will allow you to add spawns to a spawner without opening the gump. This allows other objects to add spawns to the spawn list. Also provides the ability to actually spawn spawners with specified content with spec lines like "xmlspawner/addspawn/helmofinsight/addspawn/orc/proximityrange/5/mindelay/1/maxdelay/1"

- added line editing to the spawn text gump. This allows modification of substrings in a spawn specification string without having to retype the entire string. To use this feature, open the text entry gump for a spawn spec by clicking the parchment icon to the right of a spawn entry line on the main gump. The text entry gump now has two text entry lines at the bottom. The old text is entered in the top line, the new text in the bottom. The first occurrence of the old text will be replaced by the new text when the Apply button is pressed.

- added multiple pages to the spawn gump to allow more than 15 spawn specs per gump (maximum is now 60). The additional pages are accessed throught the numbered buttons at the bottom of the spawn spec entry list on the main gump.

Installation:

for beta-36.
With bob smarts b36 world, or Knightshades xlmspawner-only version already installed, replace the xmlspawner.cs file from either of those with xmlspawner2.cs. It is fully compatible with all existing xml spawn file descriptions. Then, just add the remaining scripts in the package in your custom scripts area.
With a fresh beta-36 install, or without either of those packages installed, just drop xmlspawner2.cs and the other scripts in the package into your custom scripts directory.
Note, if you have installed any of the optional supplemental scripts that are included, like simpleswitches.cs or simplenote.cs, be sure to update those as well as new versions of the package are released.
Note, this does not replace regular spawners and you can use both regular and xmlspawners at the same time if you like.
 

Attachments

  • XmlSpawner2-v222.zip
    96.8 KB · Views: 332

ArteGordon

Wanderer
Im afraid they dont get stacked. Items are added as singles. The way to handle this would be to add an 'amount' parameter to the spawner for items. Easy to do, but would require an additional serialization, hence a new version. Good idea though
I can think of a little hack that might work without a new serialization. That is to use the team variable (which is meaningless for items anyway) as a quantity indicator. I'm pretty sure it would work but I'll check it out and get back to you.
 

ArteGordon

Wanderer
ok, seems to work fine. Here is the mod at line 1227 in Xmlspawner.cs in public bool Spawn( int index )


[code:1] else if( o is Item )
{
Item item = (Item)o;

TheSpawn.SpawnedObjects.Add( item );
InvalidateProperties();
//ARTEGORDONMOD
// set the item amount using the otherwise unused team variable (think of it as an item team :)
if(m_Team > 1 && item.Stackable)
item.Amount = m_Team;
//ARTEGORDONMOD
// if this is in any container such as a pack then add to the container.
if(this.Parent is Container)
{
Container c = (Container) this.Parent;
item.Location = this.Location;
c.AddItem( item );
} else {
item.MoveToWorld( this.GetSpawnPosition(), map );
}[/code:1]

The newly added code is the two lines
[code:1]
//ARTEGORDONMOD
// set the item amount using the otherwise unused team variable (think of it as an item team :)
if(m_Team > 1 && item.Stackable)
item.Amount = m_Team;
[/code:1]

Then, in the spawner, just set the team variable to the amount you want, and you get spawned stacks of items.
Great idea! thanks!
 

Fury

Wanderer
suggestions-

-for items use dropitem.. as you have it you get one mass of items directly over the spawner in a container.

-dont allow command properties to be changed depending on location of the spawner... if a gm changes the xy properties you set up for containers on one thats not in a container it will start dropping items mobiles in the internal map.. though we all know this shouldnt happen we also know there is no accounting for what staff is capable of =/

-in spawnershowall check if its in a container and if it is the easiest way would prolly be change the container to a mast and back again.

very good additions though.. im still in progress of testing them before i send them to live server..
 

ArteGordon

Wanderer
Fury,
thanks for the suggestions.
I thought about how to show the spawners that are in containers without coming up with a really good solution. Changing the containers would be visible to regular players which I want to avoid. Another option would be to create temporary invisible mast static over the location of the container that would get deleted on an xmlspawnerhide.

For item placement the advantages of dropitem are that it gives good visibility for multiple spawns on a spawner by spreading them around. Additem gives precise placement control for single spawns (basically behaves the same as movetoworld which is used for placing items when the spawner is not in a container). I think what I'll do is combine the best of both. Do a dropitem when there are multiple spawns, and additem when there is only one. That way if you really want to control the placement of spawns precisely, you can still do it.

Regarding the internal map issues. I played around a LOT with invalid coords, map changes inside of packs, map changes of mobiles and containers with active spawners, invalid coords within containers, outside of containers etc. with no internal map drops.
Note, I dont have separate xy properties for container or world bound spawners so there are no container-specific manipulations that could be inadvertently performed on a world-bound spawner.
If you can produce a scenario that would lead to internal map drops let me know and I'll fix it.

I'm also working on the [get home issue that people complain about. I like the relativehome feature that basically lets you create a bunch of virtual spawners distributed in an area, under the control of one spawner. But the cost is that the home variable on mobs points to the virtual spawner location (which isnt too helpful for getting to the real spawner that controls it). I'm adding some commands that should handle this.
 

ArteGordon

Wanderer
The one thing that I know is b36 specific is the flag test for spawned items to protect them from being removed from players if they are locked or placed on the ground before they are removed from the spawn list. It can be removed without really affecting the spawner. Its in the defrag method around line 994.

change
[code:1]
if( item.Deleted || ((item.Parent != null) && (item.Parent != this.Parent))|| item.GetSavedFlag(0x00100000))
[/code:1]
to
[code:1]
if( item.Deleted || ((item.Parent != null) && (item.Parent != this.Parent)))
[/code:1]
 

Philantrop

Sorceror
Two things:

- I'd love to see a SpawnRange setting.

- If the amount to spawn is set to 0 (zero) and you do a "Total Respawn" the server crashes (division by zero):
 

ArteGordon

Wanderer
Philantrip,
yeah, thanks. I just fixed that div by zero error.
Spawnrange is implicitly in there with the obscure x1y1 x2y2 settings. I'll just add spawnrange as an easier way of specifying it.

oh, I will upload the version with the fix, the spawnrange change, and Fury's dropitem suggestion for multiple item spawns as v2.02
 

ArteGordon

Wanderer
Just uploaded v2.02
- added SpawnRange parameter to the spawner property list. SpawnRange specifies the square region (spawner location +- spawnrange) within which objects will be randomly placed at spawning.
- added the dropitem method for spreading out drops of multiple item spawns on container spawners.
- fixed the div by zero error for zero count spawners (whacks head repeatedly)

A note on the spawnrange, I wanted to keep compatibility with existing xmlspawner specifications, so this does not replace the existing x1y1 x2y2 format for specifying spawning area but is rather a simpler way of specifying it (1 parameter instead of 4).
The saved xml files will specify spawn area using x1y1 x2y2. This maintains compatibility with the xmlspawneditor as well (which I like).
You wont see spawnrange in the saved xml files, but dont worry if you set it that way then it is saved, it is just in the x1y1 x2y2 format.
 

ArteGordon

Wanderer
ok, added the other things I mentioned earlier. Here they are:

- added xml file save/load support for container held spawners. Note, while it is possible to place spawners in nested containers, the xml file support only handles the top level container. So xmlloading a nested spawner will place it in the topmost container.

- added xmlspawnershowall support for container held spawners. Places an invisible mast static over containers that hold the spawner.
- also added shorthand command aliases for xmlspawnershowall/hideall operations, [xmlshow and [xmlhide (I dont like to type)

- added the new command [xmlhome that returns the coordinates of the xmlspawner for the targeted object. Also takes arguments 'go' that teleports you to its spawner,'gump' that opens its spawner gump, and 'send' that sends it back to the spawner location".
This deals with the issue regarding the original xmlspawner and the use of the homerangeisrelative flag. The home relative feature basically created virtual spawn points for multiple mobs on a single spawner, which is kind of nifty, but left no way of finding the actual spawner location using, for instance, [get home, which is kind of annoying. So with [xmlhome you can easily track and manipulate mobs and their spawners.

On a technical note, in order to do this, the system does a search across spawners that are within the spawning and wandering range of the target mob. This means that if you drag a mob well away from its spawner, [xmlhome may not be able to find it until it wanders back. Its just a performance trade-off. We can see if it turns out to be problem and adjust the search range.

also note that in order to do the showall for container held spawners, I had to add another serialization. Really no way around it. That means it is at version 3. Not really an issue unless you decide to go back to earlier versions.
 
Status
Not open for further replies.
Top