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!

XmlMobFactions

ArteGordon

Wanderer
XmlMobFactions v1.04

XmlMobFactions
v1.04
updated 1/14/05
ArteGordon

SUMMARY
A system that keeps track of a players faction with user-definable mob groups. Faction can be gained and lost by killing mobs that are allied or opposed to each faction group. Additional scripts that are included provide additional features such as giving out faction for completing quests, making equipment that requires faction to equip, or weapons that have damage bonuses based upon faction levels with certain groups. By following the recommended installation steps, additional faction-dependent features can be added such as making mob taming, control, and how long it takes for mobs to acquire a player as a target dependent on faction standing with a given mobs group.
Also supports mob faction rewards that can be purchased using mob kill Credits.


INSTALLATION:
This thread is no longer updated. GO HERE for the latest version
http://www.runuo.com/forum/showthread.php?t=49936

DESCRIPTION:

This system makes use of the XmlSpawner2 attachment system and the XmlSpawner2 package must be installed to support it. You dont need to use the xmlspawners themselves, and it doesnt matter whether you use the standard distribution spawners or any other spawning system but you do need the XmlSpawner2 package installed.


Because the attachment system neither requires nor makes any changes to serialization/deserializations on any item or mobile, it can be safely added and removed at any time, now or in the future, without interfering with any other systems that you might have installed.

Note, this has nothing to do with the upcoming release of the official player faction system and will not interfere with that system in any way.

Commands supported:

[addallmobfactions - this command will add the mob factions attachment to all current players and can only be run by an administrator.

[removeallmobfactions - this command will remove the mob factions attachment from all current players and can only be run by an administrator.

[checkmobfactions - this command can be run by players to report their current standing with all existing mob factions (this is the same as using the item identification skill on themselves if the optional installation step 8 of the XmlSpawner2 package has been followed).

[verbosemobfactions true/false - this command can be run by players to toggle the verbose reporting of faction gained and lost for the mobs they kill.


The system comes configured with a set of default factions based around the slayer opponent groups with some modifications. These include

Player,
Humanoid,
Undead,
Reptilian,
Arachnid,
Elemental,
Abyss,
DragonLords,
NecroMasters,
Fairie,
Plant,
Underworld


Killing a mob that belongs to one of these factions will cause a loss in faction with that group and its allies (the amount can be scaled for each ally), and a gain in faction with the groups opponents (the amount can be scaled for each opponent).
Additionally, factions such as the DragonLords or NecroMasters which dont have any default members can be set up as quest factions, or can have members dynamically assigned by using the XmlDynamicFaction attachment to assign/spawn a mob into that faction.

For example, here are some of the ally/opponent relationships for a few of the default groups

Player: Allies=Player, Fairies: Opponents=Arachnid, Humanoid, Undead, Reptilian, Elemental, Abyss
Humanoid: Allies=Humanoid: Opponents=Undead, Player, Plant
Undead: Allies=Undead, Abyss: Opponents=Humanoid, Player, Fairie

The groups, their members, allies, and opponents can be configured in the XmlMobFactions.cs file and new factions, such as the Fairie, and Plant factions can be easily added into the faction group definitions in that script. The groups also do not have to remain static. They can be changed and new factions can be added transparently at any time after the system is installed and they will be automatically reflected in each players faction list.
 

ArteGordon

Wanderer
just a quick little update. I modified the XmlFactionMastery attachment to support random faction selection. Just specify "?" as the faction type.

For example,

[addatt xmlfactionmastery ?

and target a weapon.
 

ArteGordon

Wanderer
updated to version 1.01
11/09/04

- added kill Credits that are added for each kill and can be use to purchase items from the MobFactionsRewardStone. The m_CreditScale factor determines how many credits are gained per kill based on the fame of the mob (default 0.1%).

- added the MobFactionsRewardStone that can be used to purchase rewards using kill Credits. Just "[add MobFactionsRewardStone to place it. Rewards can have specific faction requirements as well as Credit requirements. (see the examples of rewards in XmlMobFactionsRewards.cs)

- added the XmlMobFactionsRewards class that lets you specify the rewards their costs and optionally, minimum faction requirements. Items, Mobiles, and Attachments can be specified as rewards.

- added the static methods int XmlMobFactions.GetCredits(Mobile m), bool XmlMobFactions.TakeCredits(Mobile m, int credits), and bool XmlMobFactions.HasCredits(Mobile m, int credits) which external scripts can use to interface with the Credits system. Note, if a negative credits argument is passed to TakeCredits, it will add to the players Credit total. HasCredits and TakeCredits return a bool depending on whether player has sufficient credits.

- modified the mob factions gump to report available kill Credits.
 

Thraxus

Sorceror
Since nobody has bothered to say it yet, I'll do the honors...

This system sounds absolutely amazing! I have no doubts that I will be making good use of it in the future. I had been wanting something just like it for some time now and was dreading the idea of trying to create it myself, and now you've saved me the trouble. :D
 

Alari

Wanderer
This is exactly the kind of thing I was hoping would be written. Incredible. =) Thank you!


Now to dream up some really convoluted faction alliances. Mwhahah. :>
 

ArteGordon

Wanderer
Thanks,
I now get regular reports from players about mobs that are not faction aligned. Any thoughts about where to put gazers? :)
 

ArteGordon

Wanderer
I'm thinking perhaps of a separate Underworld faction that could include some of the Malas mobs for example. With Abyss and Undead alliances possibly.
 

Thraxus

Sorceror
How many different factions could this system conceivably support? Could adding too many factions slow down a shard much?

The concept is wonderful, but I'd be the type to get incredibly in-depth with this type of thing. I'd probably want different factions for the NPCs of each town for example.. allied but separate, so that you can have different reputations with the NPCs in different towns.. maybe be a wanted man in one town and a respected individual in another.

Or friendly with one orc tribe and hostile with another.. etc..
 

ArteGordon

Wanderer
there is no limit. In the extreme I suppose there might be some impact, but it would have to be pretty extreme (tens of thousands perhaps). I can extend benchmarks on it to get a better idea of the limits but tests with current configurations indicate virtually no detectable loading.
 

Thraxus

Sorceror
Well I don't have enough time on my hands to define tens of thousands of factions, so I guess I should be safe. :p

This is going to be great. :D
 

AHappyAdmin

Wanderer
Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
- Error: Scripts\Custom Scripts\XmlMobFactionsRewards.cs: CS0246: (line 60, col
umn 93) The type or namespace name 'XmlEnemyMastery' could not be found (are you
missing a using directive or an assembly reference?)
- Error: Scripts\Custom Scripts\XmlMobFactionsRewards.cs: CS0246: (line 61, col
umn 83) The type or namespace name 'XmlStr' could not be found (are you missing
a using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.


Got 2 problems here :) can u help?
 

ArteGordon

Wanderer
hehe, yeah sorry. I kind of thought some folks might have a problem with that after I posted it. That is because I added some attachment rewards as examples into the XmlMobFactionsRewards. You can either comment out those entries, or you can install the attachments from the Xmlspawner2 package. They are in the support-1of2.zip file in the XmlSpawner2 package.

(edit)
XmlStr and XmlEnemyMastery are attachments from the XmlSpawner2 package.

from XmlMobFactionsRewards.cs

around line 59

Code:
            // this is an example of adding an attachment as a reward
            MobFactionsRewardList.Add( new XmlMobFactionsRewards( "Elemental", 1000, typeof(XmlEnemyMastery), "+200% Balron Mastery for 1 day", 5000, 0, new object[] { "Balron", 50, 200, 1440.0 }));
            MobFactionsRewardList.Add( new XmlMobFactionsRewards( null, 0, typeof(XmlStr), "+20 Strength for 1 day", 10000, 0, new object[] { 20, 86400.0 }));

you can just remove or comment out those lines.
 

ArteGordon

Wanderer
updated to Version 1.02

- modified [addallmobfactions command to ignore players that already have XmlMobFactions attachments instead of resetting them.

- added several significant performance optimizations.

- modified some of the default factions.
 
Top