Hello,
Can anyone guide me in the right direction to make spawning and using props on XMLSpawners administrators only?
Thanks in advance.
 
Somewhat solved this, went into XmlSpawner2.cs, and set access level higher. just wondering if there's a way to make it so only a certain access level can [add xmlspawner

Begins around Line 996
Ends around Line 1975
 

Attachments

  • XmlSpawner2.cs
    368.3 KB · Views: 6
I could be wrong, since I've never played around with Access Levels, but on line 7815 is the start of the "Constructable" part of xmlspawner. Ever tried setting an Access Level on it?
 
I could be wrong, since I've never played around with Access Levels, but on line 7815 is the start of the "Constructable" part of xmlspawner. Ever tried setting an Access Level on it?
Thank you @DragnMaw. You think there's a way to rid this message? or change it to something else?

XmlSpawner2.cs:
        #region Constructors

        [Constructable(AccessLevel.Administrator)]
        public XmlSpawner()
            : base(BaseItemId)
        {
            m_PlayerCreated = true;
            m_UniqueId = Guid.NewGuid().ToString();
            SpawnRange = defSpawnRange;

            InitSpawn(0, 0, m_Width, m_Height, string.Empty, 0, defMinDelay, defMaxDelay, defDuration,
                defProximityRange, defProximityTriggerSound, defAmount, defTeam, defHomeRange, defRelativeHome, new SpawnObject[0], defMinRefractory, defMaxRefractory,
                defTODStart, defTODEnd, null, null, null, null, null, null, null, null, null, defTriggerProbability, null, defIsGroup, defTODMode,
                defKillReset, false, -1, null, false, false, false, null, defDespawnTime, null, false, null);
        }

        [Constructable(AccessLevel.Administrator)]
        public XmlSpawner(int amount, int minDelay, int maxDelay, int team, int homeRange, string creatureName)
            : base(BaseItemId)
        {
            m_PlayerCreated = true;
            m_UniqueId = Guid.NewGuid().ToString();
            SpawnRange = homeRange;
            SpawnObject[] so = new SpawnObject[1];
            so[0] = new SpawnObject(creatureName, amount);

            InitSpawn(0, 0, m_Width, m_Height, string.Empty, amount, TimeSpan.FromMinutes(minDelay), TimeSpan.FromMinutes(maxDelay), defDuration,
                defProximityRange, defProximityTriggerSound, defAmount, team, homeRange, defRelativeHome, so, defMinRefractory, defMaxRefractory,
                defTODStart, defTODEnd, null, null, null, null, null, null, null, null, null, defTriggerProbability, null, defIsGroup, defTODMode,
                defKillReset, false, -1, null, false, false, false, null, defDespawnTime, null, false, null);
        }

        [Constructable(AccessLevel.Administrator)]
        public XmlSpawner(int amount, int minDelay, int maxDelay, int team, int homeRange, int spawnRange, string creatureName)
            : base(BaseItemId)
        {
            m_PlayerCreated = true;
            m_UniqueId = Guid.NewGuid().ToString();
            SpawnRange = spawnRange;
            SpawnObject[] so = new SpawnObject[1];
            so[0] = new SpawnObject(creatureName, amount);

            InitSpawn(0, 0, m_Width, m_Height, string.Empty, amount, TimeSpan.FromMinutes(minDelay), TimeSpan.FromMinutes(maxDelay), defDuration,
                defProximityRange, defProximityTriggerSound, defAmount, team, homeRange, defRelativeHome, so, defMinRefractory, defMaxRefractory,
                defTODStart, defTODEnd, null, null, null, null, null, null, null, null, null, defTriggerProbability, null, defIsGroup, defTODMode,
                defKillReset, false, -1, null, false, false, false, null, defDespawnTime, null, false, null);
        }

        [Constructable(AccessLevel.Administrator)]
        public XmlSpawner(string creatureName)
            : base(BaseItemId)
        {
            m_PlayerCreated = true;
            m_UniqueId = Guid.NewGuid().ToString();
            SpawnObject[] so = new SpawnObject[1];
            so[0] = new SpawnObject(creatureName, 1);
            SpawnRange = defSpawnRange;

            InitSpawn(0, 0, m_Width, m_Height, string.Empty, 1, defMinDelay, defMaxDelay, defDuration,
                defProximityRange, defProximityTriggerSound, defAmount, defTeam, defHomeRange, defRelativeHome, so, defMinRefractory, defMaxRefractory,
                defTODStart, defTODEnd, null, null, null, null, null, null, null, null, null, defTriggerProbability, null, defIsGroup, defTODMode,
                defKillReset, false, -1, null, false, false, false, null, defDespawnTime, null, false, null);
        }

        public XmlSpawner(Guid uniqueId, int x, int y, int width, int height, string name, int maxCount, TimeSpan minDelay, TimeSpan maxDelay, TimeSpan duration,
            int proximityRange, int proximityTriggerSound, int amount, int team, int homeRange, bool isRelativeHomeRange, SpawnObject[] spawnObjects,
            TimeSpan minRefractory, TimeSpan maxRefractory, TimeSpan todstart, TimeSpan todend, Item objectPropertyItem, string objectPropertyName, string proximityMessage,
            string itemTriggerName, string noitemTriggerName, string speechTrigger, string mobTriggerName, string mobPropertyName, string playerPropertyName, double triggerProbability,
            Item setPropertyItem, bool isGroup, TODModeType todMode, int killReset, bool externalTriggering, int sequentialSpawning, string regionName,
            bool allowghost, bool allownpc, bool spawnontrigger, string configfile, TimeSpan despawnTime, string skillTrigger, bool smartSpawning, WayPoint wayPoint)
            : base(BaseItemId)
        {
            m_UniqueId = uniqueId.ToString();
            InitSpawn(x, y, width, height, name, maxCount, minDelay, maxDelay, duration,
                proximityRange, proximityTriggerSound, amount, team, homeRange, isRelativeHomeRange, spawnObjects, minRefractory, maxRefractory, todstart, todend,
                objectPropertyItem, objectPropertyName, proximityMessage, itemTriggerName, noitemTriggerName, speechTrigger, mobTriggerName, mobPropertyName, playerPropertyName,
                triggerProbability, setPropertyItem, isGroup, todMode, killReset, externalTriggering, sequentialSpawning, regionName, allowghost, allownpc, spawnontrigger, configfile,
                despawnTime, skillTrigger, smartSpawning, wayPoint);
        }


        public void InitSpawn(int x, int y, int width, int height, string name, int maxCount, TimeSpan minDelay, TimeSpan maxDelay, TimeSpan duration,
            int proximityRange, int proximityTriggerSound, int amount, int team, int homeRange, bool isRelativeHomeRange, SpawnObject[] objectsToSpawn,
            TimeSpan minRefractory, TimeSpan maxRefractory, TimeSpan todstart, TimeSpan todend, Item objectPropertyItem, string objectPropertyName, string proximityMessage,
            string itemTriggerName, string noitemTriggerName, string speechTrigger, string mobTriggerName, string mobPropertyName, string playerPropertyName, double triggerProbability,
            Item setPropertyItem, bool isGroup, TODModeType todMode, int killReset, bool externalTriggering, int sequentialSpawning, string regionName, bool allowghost, bool allownpc, bool spawnontrigger,
            string configfile, TimeSpan despawnTime, string skillTrigger, bool smartSpawning, WayPoint wayPoint)
        {

            Visible = false;
            Movable = false;
            m_X = x;
            m_Y = y;
            m_Width = width;
            m_Height = height;

            // init spawn range if compatible
            if (width == height)
                m_SpawnRange = width / 2;
            else
                m_SpawnRange = -1;
            m_Running = true;
            m_Group = isGroup;

            if ((name != null) && (name.Length > 0))
                Name = name;
            else
                Name = "Spawner";

            m_MinDelay = minDelay;
            m_MaxDelay = maxDelay;

            // duration and proximity range parameter
            m_MinRefractory = minRefractory;
            m_MaxRefractory = maxRefractory;
            m_TODStart = todstart;
            m_TODEnd = todend;
            m_TODMode = todMode;
            m_KillReset = killReset;
            m_Duration = duration;
            m_DespawnTime = despawnTime;
            m_ProximityRange = proximityRange;
            m_ProximityTriggerSound = proximityTriggerSound;
            m_proximityActivated = false;
            m_durActivated = false;
            m_refractActivated = false;
            m_Count = maxCount;
            m_Team = team;
            m_StackAmount = amount;
            m_HomeRange = homeRange;
            m_HomeRangeIsRelative = isRelativeHomeRange;
            m_ObjectPropertyItem = objectPropertyItem;
            m_ObjectPropertyName = objectPropertyName;
            m_ProximityTriggerMessage = proximityMessage;
            m_ItemTriggerName = itemTriggerName;
            m_NoItemTriggerName = noitemTriggerName;
            m_SpeechTrigger = speechTrigger;
            SkillTrigger = skillTrigger;        // note this will register the skill as well
            m_MobTriggerName = mobTriggerName;
            m_MobPropertyName = mobPropertyName;
            m_PlayerPropertyName = playerPropertyName;
            m_TriggerProbability = triggerProbability;
            m_SetPropertyItem = setPropertyItem;
            m_ExternalTriggering = externalTriggering;
            m_ExternalTrigger = false;
            m_SequentialSpawning = sequentialSpawning;
            RegionName = regionName;
            m_AllowGhostTriggering = allowghost;
            m_AllowNPCTriggering = allownpc;
            m_SpawnOnTrigger = spawnontrigger;
            m_SmartSpawning = smartSpawning;
            ConfigFile = configfile;
            m_WayPoint = wayPoint;

            // set the totalitem property to -1 so that it doesnt show up in the item count of containers
            //TotalItems = -1;
            //UpdateTotal(this, TotalType.Items, -1);

            // Create the array of spawned objects
            m_SpawnObjects = new List<XmlSpawner.SpawnObject>();

            // Assign the list of objects to spawn
            SpawnObjects = objectsToSpawn;

            // Kick off the process
            DoTimer(TimeSpan.FromSeconds(1));
        }

        public XmlSpawner(Serial serial)
            : base(serial)
        {
        }

        #endregion
XmlSpawnerAccessLevel.png
 
The way you implemented that, likely prevents ANYONE from placing an XmlSpawner, but if not and Administrators can still place, unlikely. Anything that has a class, but is not marked constructable, if you try to add it to the game, it will give that message. Its an error message built in.
 
The way you implemented that, likely prevents ANYONE from placing an XmlSpawner, but if not and Administrators can still place, unlikely. Anything that has a class, but is not marked constructable, if you try to add it to the game, it will give that message. Its an error message built in.
Administrators can place them. How would you have written it up? I know little to nothing about this coding stuff.
 
Strange... Guess it did work. I would have expected it to look like the [AccessLevel.Administrator] on the line above just like earlier in the file... If it works it works I guess lol
 
Ah, so you re-installed the system then?
I guess so, all I know is I downloaded pub 57 a while to mess around and learn the basics of c#, been throwing stuff together for local play since. My apologies, I didn't quite understand what you were asking lol. Still a bit confused. I'm a rookie with this stuff still.
 
I guess so, all I know is I downloaded pub 57 a while to mess around and learn the basics of c#, been throwing stuff together for local play since. My apologies, I didn't quite understand what you were asking lol. Still a bit confused. I'm a rookie with this stuff still.
No problem. We all were at one point! :)
As I understand it, Pub 57 had a lot of third-party content removed and the entire Xmlspawner package was one of those things.
So my guess is that you installed the whole Xmlspawner package to fix your problem. Did you make the edits to the Distro files? (Distro files are the default files that come with the server software when you download Pub whatever).
To install the full Xmlspawner package you have to make Distro edits to BaseCreature, PlayerMobile, and several other files. :)

Feel free to PM me if you did *not* do all that and I can offer some assistance. :)
 
They didn't completely remove XmlSpawner they just gutted it removing most of it's special features, and it was done in a few different phases.
 
Last edited:
They didn't completely remove XmlSpawner they just gutted it removing most of it's special features, and it was done in a few different phases.
Yeah, but it is pretty much a complete removal though. It was taken down to just being a spawner. None of the things that expanded it beyond, like XmlEdit, or XmlQuestNPCs, XmlFactions, or XmlAttach. Considering that what remains does not require distro edits to install, it lacks the power the system actually has. Count the missing *keywords*.

It is no different than using the default Spawning system, or Mega Spawners.
 
Last edited:
True, I'd never use a version that didn't have it in it's full glory anymore it's too useful to not have. Stock UO is boring from the development side of things.
 
Back