I'm working with races and I would like to add an XML Mob Faction as a default to each race and give them X amount of points on their attachment. I know of the code in charactercreation

Code:
XmlAttach.AttachTo(newChar, new XmlMobFactions());

However that only puts on the generic attachments with 0 points, I'm not sure what arguement to add to get it to spawn the new character with points already to a specific Mob Faction.

Anyone have any suggestions on this? and yes I know it's not OSI based ;)
 
Some Xmlspawner attachments get applied properly at Character Creation, Mob Factions isn't one of them. While creating the attachment is done correctly, you cannot specify a faction until after the attachment has been created. I would just use an Xmlspawner to add the specific faction. For example, new characters have to go see the leader of the Thieves guild to join it. You could change the leader of the Thieves guild to attach the thieves faction and so on.
 
I use a post character creation script to apply races/racial bonus's etc. If I add the Mob Attachment using charactercreation.cs like it's meant to be used, then in my post character creation script that happens after the toon is generated as in the world, could I then attach the specific mob faction and point value?
 
I'm working with races and I would like to add an XML Mob Faction as a default to each race and give them X amount of points on their attachment. I know of the code in charactercreation

Code:
XmlAttach.AttachTo(newChar, new XmlMobFactions());

However that only puts on the generic attachments with 0 points, I'm not sure what arguement to add to get it to spawn the new character with points already to a specific Mob Faction.

Anyone have any suggestions on this? and yes I know it's not OSI based ;)


Maybe something like this:

Code:
    XmlMobFactions xmob = new XmlMobFactions();

    // Here define the various properties***
    xmob.Name = "Dragon Lords";
    xmob.SetFactionLevel(GroupTypes.DragonLords, 10);

    // *************************************

    XmlAttach.AttachTo(newChar, xmob);
 
Thank you for the input, so that is for sure putting me int he right direction however I get this error during compile.

Code:
Errors:
+ Custom Systems/Race System/RaceGump.cs:
    CS0103: Line 254: The name 'GroupTypes' does not exist in the current context
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

I checked and ensured that I have
Code:
using Server.Engines.XmlSpawner2;
at the top.
 
I figured out what was missing. Thank you again Lokai! Once again you saved the day.

Code:
                XmlMobFactions xmob = new XmlMobFactions();
                // Here define the various properties***
                xmob.Name = "Dragon Lords";
                xmob.SetFactionLevel(XmlMobFactions.GroupTypes.DragonLords, 9000);

                // *************************************
                XmlAttach.AttachTo(from, xmob);
 
I figured out what was missing. Thank you again Lokai! Once again you saved the day.

Code:
                XmlMobFactions xmob = new XmlMobFactions();
                // Here define the various properties***
                xmob.Name = "Dragon Lords";
                xmob.SetFactionLevel(XmlMobFactions.GroupTypes.DragonLords, 9000);

                // *************************************
                XmlAttach.AttachTo(from, xmob);
Just FYI, the above will attach to ALL new characters, staff members included and they will show up in the Faction boards, which was why I suggested using an Xmlspawner to do it after character creation. Also, if you ever change the name or remove that faction, don't forget to go back and change your CharacterCreation.cs. Otherwise you'll have a faction added with points that doesn't exist, which will cause corruption in your Saves.
 
I did take that into consideration :) I ended up placing the information on my post charactercration script that applies races to each newly created playermobile before teleporting them to their home town. In between those two actions it will add in the XML MOB options based on their race. Essentially the only role charactercreation.cs plays on my shard is making the toon --> applying young status --> and dropping the toon in a set starting room which is only temporary anyways.
 
Back