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!

Challenged scripting an Xmlspawner

I am trying to script a NPC Quest Giver who (after OnThink) will spawn an XmlSpawner that spawns six orcs and respawns them after death every 10 seconds.

Here is the script snip:
Code:
//**********************************************
 
// Spawn an XMLSpawner and Set Spawn Properties
es_Spawner = new XmlSpawner(6, 1, 1, 0, 12, "Orc");
es_Spawner.Name = "EventSpawner";
es_Spawner.Map = Map.Trammel;
es_Spawner.MoveToWorld(new Point3D( 5635, 1263, 0 ));
 
//**********************************************

The script compiles and the NPC creates the XmlSpawner but the spawner will not work the way I want.

First - The spawner only spawns 1 Orc (The spawner Count says 1 but the Max shows 6). If I do a manual Respawn on the spawner all 6 Orcs will then appear. I do not know how to get the spawner to make all 6 orcs appear at the outset. Conversely I do not know how to make the spawner do a Respawn from inside the script.

Second - The spawner shows the Min delay and the Max delay as one minute. If I try changing my script to XmlSpawner(6, .01, .01, 0, 12, "Orc"); it will not compile as the format accepts only Int not Double.

Does anyone know the proper syntax to make my script spawn the six Orcs at the outset and have the Min/Max delays less than one minute?

I really appreciate any help I can get on this.

Many Thanks
 

Dian

Sorceror
Dont have time this minute to help with code but,
You might try setting the properties, Group true, and SequentialSpawn = 1 or anything higher than 0.. That should force the orcs all spawan at once.
There has to be a ForceRespawn you can use as well to respawn the spawner, maybe search the xmlspawner.cs for respawn keyword for the methods.. hope that helps a bit.

*oh and have you tried using time entries on the orc min max? Like 00:30, 01:30 for example?
 
Thank you for considering this for me.

Yes I did try the Group property.

For the record . . . revising the script as follows:
Code:
//**********************************************
 
// Spawn an XMLSpawner and Set Spawn Properties
es_Spawner = new XmlSpawner(6, 1, 1, 0, 12, "Orc");
es_Spawner.Name = "EventSpawner";
 
es_Spawner.Group = true;
es_Spawner.SequentialSpawn = 1;
 
es_Spawner.Map = Map.Trammel;
es_Spawner.MoveToWorld(new Point3D( 5635, 1263, 0 ));
 
//**********************************************

Results in these errors:
Code:
Errors:
+ Customs/Events/SmedleyRoyalCrier.cs:
    CS1061: Line 575: 'Server.Item' does not contain a definition for 'Group' an
d no extension method 'Group' accepting a first argument of type 'Server.Item' c
ould be found (are you missing a using directive or an assembly reference?)
    CS1061: Line 576: 'Server.Item' does not contain a definition for 'Sequentia
lSpawn' and no extension method 'SequentialSpawn' accepting a first argument of
type 'Server.Item' could be found (are you missing a using directive or an assem
bly reference?)
Scripts: One or more scripts failed to compile or no script files were found.



Also revising the script as follows (for timing) like this:
Code:
//***************************************************************
// Spawn an XMLSpawner and Set Spawn Properties
es_Spawner = new XmlSpawner(6, 00:30, 01:30, 0, 12, "Orc");
es_Spawner.Name = "EventSpawner";
es_Spawner.Map = Map.Trammel;
es_Spawner.MoveToWorld(new Point3D( 5635, 1263, 0 ));
//***************************************************************

results in these errors:
Code:
Errors:
+ Customs/Events/SmedleyRoyalCrier.cs:
    CS1026: Line 571: ) expected
    CS1525: Line 571: Invalid expression term ':'
    CS1002: Line 571: ; expected
    CS1002: Line 571: ; expected
    CS1525: Line 571: Invalid expression term ','
    CS1002: Line 571: ; expected
    CS1002: Line 571: ; expected
    CS1525: Line 571: Invalid expression term ':'
    CS1002: Line 571: ; expected
    CS1002: Line 571: ; expected
    CS1525: Line 571: Invalid expression term ','
    CS1002: Line 571: ; expected
    CS1002: Line 571: ; expected
    CS1525: Line 571: Invalid expression term ','
    CS1002: Line 571: ; expected
    CS1002: Line 571: ; expected
    CS1525: Line 571: Invalid expression term ','
    CS1002: Line 571: ; expected
    CS1002: Line 571: ; expected
    CS1525: Line 571: Invalid expression term ')'

I will continue looking for a way to force the Respawn from inside the script and appreciate all suggestions.
 

Dian

Sorceror
Not sure why its throwing errors for Group and Sequential. It shows correct for me?

I now see the time Min Max entries are int, so what I suggested wouldnt work as you found,and should revert to how you had it.

And you should be able to do es_Spawner.DoRespawn = true; to force a respawn.

Although, I needed to change this entry you had..
yours
es_Spawner = new XmlSpawner(6, 1, 1, 0, 12, "Orc");

to
XmlSpawner es_Spawner = new XmlSpawner(6, 1, 1, 0, 12, "Orc");
 
Thank you Dian!

Your tip to use . . .
Code:
XmlSpawner es_Spawner = new XmlSpawner(6, 1, 1, 0, 12, "Orc");

. . . instead of this
Code:
es_Spawner = new XmlSpawner(6, 1, 1, 0, 12, "Orc");
made all the difference.


Here is what I ended up with (Note the solution to resetting the Min/Max Delays):
Code:
//***************************************************************
// Spawn an XMLSpawner and Set Spawn Properties
XmlSpawner es_Spawner = new XmlSpawner(6, 1, 1, 0, 12, "Orc");
es_Spawner.Name = "EventSpawner";
es_Spawner.Map = Map.Trammel;
es_Spawner.MoveToWorld(new Point3D( 5635, 1263, 0 ));
es_Spawner.SequentialSpawn = 1;
es_Spawner.Group = true;
es_Spawner.MaxDelay = TimeSpan.FromSeconds( 3 );
es_Spawner.MinDelay = TimeSpan.FromSeconds( 3 );
es_Spawner.DoRespawn = true;
//***************************************************************

I really appreciate your help.

*bows*
 

Dian

Sorceror
Cool, wasnt sure that was it, though it seemed like the issue, never know what you had above that snippet...

good deal
 
Top