Adding Player to Multiple Factions when equipping an item.

Post » Tue Mar 25, 2014 10:55 am

So, with help a few months ago, I managed to make my mod that has amulets that add a player to a faction.

However, I wanted to make an Amulet called "Amulet of World Peace", that has the combined effect of all Amulets.

My original script looks like this:

Scriptname acpEquipfaction extends ObjectReference  Faction Property acpFaction  AutoEvent OnEquipped(Actor akActor)   akActor.AddToFaction(acpFaction)EndEventEvent OnUnequipped(Actor akActor)   akActor.RemoveFromFaction(acpFaction)EndEvent

So, if I wanted to add more do it, would I have lines like follows?

Scriptname acpEquipfaction extends ObjectReference  Faction Property acpFaction1  AutoFaction Property acpFaction2 AutoFaction Property acpFaction3 AutoFaction Property acpFaction4 AutoFaction Property acpFaction5 AutoEvent OnEquipped(Actor akActor)   akActor.AddToFaction(acpFaction1)   akActor.AddToFaction(acpFaction2)   ...   akActor.AddToFaction(acpFaction5)EndEventEvent OnUnequipped(Actor akActor)   akActor.RemoveFromFaction(acpFaction)EndEvent

Am I on the right path, or am I off base? I didn't bother to duplicate the "RemoteFromFaction" lines in the code example, but I would naturally add those. I have the mod working as is, so I don't want to just blindly throw the script in there.

User avatar
keri seymour
 
Posts: 3361
Joined: Thu Oct 19, 2006 4:09 am

Post » Tue Mar 25, 2014 5:09 am

That's exactly how it should look :) using a property filled array and add the player to those factions in a while loop would be quicker, however unless you need super speed this will be fine.
User avatar
Jennifer Munroe
 
Posts: 3411
Joined: Sun Aug 26, 2007 12:57 am

Post » Tue Mar 25, 2014 3:25 am

Thanks! I'll get working on that, and let you all know how it goes!

User avatar
Marguerite Dabrin
 
Posts: 3546
Joined: Tue Mar 20, 2007 11:33 am

Post » Mon Mar 24, 2014 10:59 pm

One other question. How do I add Crime Gold when equipping an item, and then remove it when I remove the item? That is something I wanted to add to a couple of the Amulets.

User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am


Return to V - Skyrim