Jump to content
IGNORED

Can I add a race to faction in CK?


Recommended Posts

4 hours ago, Dryad said:

I wanted to add my custom race to wild animals faction but it seems like I can't do it by races. I wanna make it like animals are allies only when I choose to be this race. Is there any way to do that?

There is!  You'll need to either create a racial ability for them, or you can add on to one you already have.  Then, you'll need to add this script to a magic effect your racial ability is using (which should be an effect added by your mod, don't edit a vanilla Skyrim effect to add this):

Scriptname AddMeToFaction extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
	akTarget.AddToFaction(AddFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
	akTarget.RemoveFromFaction(AddFaction)
endEvent

Faction Property AddFaction  Auto

You can name the new script whatever you like, but the name you use will have to match the name in the script itself (which I have as AddMeToFaction).  Once you have the script added, you'll want to set the AddFaction property to whatever faction you want to use.

Link to comment
1 hour ago, Holzfrau said:

There is!  You'll need to either create a racial ability for them, or you can add on to one you already have.  Then, you'll need to add this script to a magic effect your racial ability is using (which should be an effect added by your mod, don't edit a vanilla Skyrim effect to add this):


Scriptname AddMeToFaction extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
	akTarget.AddToFaction(AddFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
	akTarget.RemoveFromFaction(AddFaction)
endEvent

Faction Property AddFaction  Auto

You can name the new script whatever you like, but the name you use will have to match the name in the script itself (which I have as AddMeToFaction).  Once you have the script added, you'll want to set the AddFaction property to whatever faction you want to use.

what if I use multiple magic effects in one ability? or if I have multiple racial abilities with multiple magic effects for each? do I have to add the script on all of them? or just one of them?

Link to comment
4 hours ago, Holzfrau said:

There is!  You'll need to either create a racial ability for them, or you can add on to one you already have.  Then, you'll need to add this script to a magic effect your racial ability is using (which should be an effect added by your mod, don't edit a vanilla Skyrim effect to add this):


Scriptname AddMeToFaction extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
	akTarget.AddToFaction(AddFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
	akTarget.RemoveFromFaction(AddFaction)
endEvent

Faction Property AddFaction  Auto

You can name the new script whatever you like, but the name you use will have to match the name in the script itself (which I have as AddMeToFaction).  Once you have the script added, you'll want to set the AddFaction property to whatever faction you want to use.

so I just put it like this

 

Scriptname WildProtection extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.AddToFaction(BearFaction, SprigganFaction, SprigganPredatorFaction, SprigganPreyFaction, SabreCatFaction, WolfFaction, SkeeverFaction, SlaughterfishFaction, MammothFaction, GiantFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
    akTarget.RemoveFromFaction(BearFaction, SprigganFaction, SprigganPredatorFaction, SprigganPreyFaction, SabreCatFaction, WolfFaction, SkeeverFaction, SlaughterfishFaction, MammothFaction, GiantFaction)
endEvent

Faction Property AddFaction  Auto

 

and then I clicked OK then it shows something like this 2nd photo and the script doesn't get added to the sheet.

Annotation 2019-10-03 202045.png

Annotation 2019-10-03 202100.png

Link to comment
7 hours ago, Dryad said:

what if I use multiple magic effects in one ability? or if I have multiple racial abilities with multiple magic effects for each? do I have to add the script on all of them? or just one of them?

Just one of your effects need it.  Looks like you already figured that out though.

4 hours ago, Dryad said:

so I just put it like this

 

Scriptname WildProtection extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.AddToFaction(BearFaction, SprigganFaction, SprigganPredatorFaction, SprigganPreyFaction, SabreCatFaction, WolfFaction, SkeeverFaction, SlaughterfishFaction, MammothFaction, GiantFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
    akTarget.RemoveFromFaction(BearFaction, SprigganFaction, SprigganPredatorFaction, SprigganPreyFaction, SabreCatFaction, WolfFaction, SkeeverFaction, SlaughterfishFaction, MammothFaction, GiantFaction)
endEvent

Faction Property AddFaction  Auto

You can't just jam a bunch of factions into AddToFaction and RemoveFromFaction, you have to do a call for each.  Also, each faction must be set as a property (and you have to fill them yourself!), these are how scripts access the game data.

Scriptname WildProtection extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.AddToFaction(BearFaction)
    akTarget.AddToFaction(SprigganFaction)
    akTarget.AddToFaction(SprigganPredatorFaction)
    akTarget.AddToFaction(SprigganPreyFaction)
    akTarget.AddToFaction(SabreCatFaction)
    akTarget.AddToFaction(WolfFaction)
    akTarget.AddToFaction(SkeeverFaction)
    akTarget.AddToFaction(SlaughterfishFaction)
    akTarget.AddToFaction(MammothFaction)
    akTarget.AddToFaction(GiantFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
    akTarget.RemoveFromFaction(BearFaction)
    akTarget.RemoveFromFaction(SprigganFaction)
    akTarget.RemoveFromFaction(SprigganPredatorFaction)
    akTarget.RemoveFromFaction(SprigganPreyFaction)
    akTarget.RemoveFromFaction(SabreCatFaction)
    akTarget.RemoveFromFaction(WolfFaction)
    akTarget.RemoveFromFaction(SkeeverFaction)
    akTarget.RemoveFromFaction(SlaughterfishFaction)
    akTarget.RemoveFromFaction(MammothFaction)
    akTarget.RemoveFromFaction(GiantFaction)
endEvent

Faction Property BearFaction  Auto
Faction Property SprigganFaction  Auto
Faction Property SprigganPredatorFaction  Auto
Faction Property SprigganPreyFaction  Auto
Faction Property SabreCatFaction  Auto
Faction Property WolfFaction  Auto
Faction Property SkeeverFaction  Auto
Faction Property SlaughterfishFaction  Auto
Faction Property MammothFaction  Auto
Faction Property GiantFaction  Auto

I'd also recommend taking a closer look at how these factions relate to each other, you probably don't need all of them.  I think SprigganFaction in particular gets a friendly reaction from most animal types.

 

Quote

and then I clicked OK then it shows something like this 2nd photo and the script doesn't get added to the sheet.

Annotation 2019-10-03 202045.png

Annotation 2019-10-03 202100.png

https://www.creationkit.com/index.php?title=Papyrus_Compiler_Errors#.22Unable_to_find_flags_file:_TESV_Papyrus_Flags.flg.22

Link to comment
10 hours ago, Holzfrau said:

Just one of your effects need it.  Looks like you already figured that out though.

You can't just jam a bunch of factions into AddToFaction and RemoveFromFaction, you have to do a call for each.  Also, each faction must be set as a property (and you have to fill them yourself!), these are how scripts access the game data.


Scriptname WildProtection extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.AddToFaction(BearFaction)
    akTarget.AddToFaction(SprigganFaction)
    akTarget.AddToFaction(SprigganPredatorFaction)
    akTarget.AddToFaction(SprigganPreyFaction)
    akTarget.AddToFaction(SabreCatFaction)
    akTarget.AddToFaction(WolfFaction)
    akTarget.AddToFaction(SkeeverFaction)
    akTarget.AddToFaction(SlaughterfishFaction)
    akTarget.AddToFaction(MammothFaction)
    akTarget.AddToFaction(GiantFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
    akTarget.RemoveFromFaction(BearFaction)
    akTarget.RemoveFromFaction(SprigganFaction)
    akTarget.RemoveFromFaction(SprigganPredatorFaction)
    akTarget.RemoveFromFaction(SprigganPreyFaction)
    akTarget.RemoveFromFaction(SabreCatFaction)
    akTarget.RemoveFromFaction(WolfFaction)
    akTarget.RemoveFromFaction(SkeeverFaction)
    akTarget.RemoveFromFaction(SlaughterfishFaction)
    akTarget.RemoveFromFaction(MammothFaction)
    akTarget.RemoveFromFaction(GiantFaction)
endEvent

Faction Property BearFaction  Auto
Faction Property SprigganFaction  Auto
Faction Property SprigganPredatorFaction  Auto
Faction Property SprigganPreyFaction  Auto
Faction Property SabreCatFaction  Auto
Faction Property WolfFaction  Auto
Faction Property SkeeverFaction  Auto
Faction Property SlaughterfishFaction  Auto
Faction Property MammothFaction  Auto
Faction Property GiantFaction  Auto

I'd also recommend taking a closer look at how these factions relate to each other, you probably don't need all of them.  I think SprigganFaction in particular gets a friendly reaction from most animal types.

 

https://www.creationkit.com/index.php?title=Papyrus_Compiler_Errors#.22Unable_to_find_flags_file:_TESV_Papyrus_Flags.flg.22

Thanks a lot for this! Also can I ask you how you put the space before the akTarget part? I thought it was TAB key but it doesn't do it

Link to comment
10 hours ago, Holzfrau said:

Just one of your effects need it.  Looks like you already figured that out though.

You can't just jam a bunch of factions into AddToFaction and RemoveFromFaction, you have to do a call for each.  Also, each faction must be set as a property (and you have to fill them yourself!), these are how scripts access the game data.


Scriptname WildProtection extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.AddToFaction(BearFaction)
    akTarget.AddToFaction(SprigganFaction)
    akTarget.AddToFaction(SprigganPredatorFaction)
    akTarget.AddToFaction(SprigganPreyFaction)
    akTarget.AddToFaction(SabreCatFaction)
    akTarget.AddToFaction(WolfFaction)
    akTarget.AddToFaction(SkeeverFaction)
    akTarget.AddToFaction(SlaughterfishFaction)
    akTarget.AddToFaction(MammothFaction)
    akTarget.AddToFaction(GiantFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
    akTarget.RemoveFromFaction(BearFaction)
    akTarget.RemoveFromFaction(SprigganFaction)
    akTarget.RemoveFromFaction(SprigganPredatorFaction)
    akTarget.RemoveFromFaction(SprigganPreyFaction)
    akTarget.RemoveFromFaction(SabreCatFaction)
    akTarget.RemoveFromFaction(WolfFaction)
    akTarget.RemoveFromFaction(SkeeverFaction)
    akTarget.RemoveFromFaction(SlaughterfishFaction)
    akTarget.RemoveFromFaction(MammothFaction)
    akTarget.RemoveFromFaction(GiantFaction)
endEvent

Faction Property BearFaction  Auto
Faction Property SprigganFaction  Auto
Faction Property SprigganPredatorFaction  Auto
Faction Property SprigganPreyFaction  Auto
Faction Property SabreCatFaction  Auto
Faction Property WolfFaction  Auto
Faction Property SkeeverFaction  Auto
Faction Property SlaughterfishFaction  Auto
Faction Property MammothFaction  Auto
Faction Property GiantFaction  Auto

I'd also recommend taking a closer look at how these factions relate to each other, you probably don't need all of them.  I think SprigganFaction in particular gets a friendly reaction from most animal types.

 

https://www.creationkit.com/index.php?title=Papyrus_Compiler_Errors#.22Unable_to_find_flags_file:_TESV_Papyrus_Flags.flg.22

Never mind lol I was trying to put the script in the document string thing lololol

Link to comment
11 hours ago, Holzfrau said:

Just one of your effects need it.  Looks like you already figured that out though.

You can't just jam a bunch of factions into AddToFaction and RemoveFromFaction, you have to do a call for each.  Also, each faction must be set as a property (and you have to fill them yourself!), these are how scripts access the game data.


Scriptname WildProtection extends activemagiceffect  

event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.AddToFaction(BearFaction)
    akTarget.AddToFaction(SprigganFaction)
    akTarget.AddToFaction(SprigganPredatorFaction)
    akTarget.AddToFaction(SprigganPreyFaction)
    akTarget.AddToFaction(SabreCatFaction)
    akTarget.AddToFaction(WolfFaction)
    akTarget.AddToFaction(SkeeverFaction)
    akTarget.AddToFaction(SlaughterfishFaction)
    akTarget.AddToFaction(MammothFaction)
    akTarget.AddToFaction(GiantFaction)
endEvent

event OnEffectFinish(Actor akTarget, Actor akCaster)
    akTarget.RemoveFromFaction(BearFaction)
    akTarget.RemoveFromFaction(SprigganFaction)
    akTarget.RemoveFromFaction(SprigganPredatorFaction)
    akTarget.RemoveFromFaction(SprigganPreyFaction)
    akTarget.RemoveFromFaction(SabreCatFaction)
    akTarget.RemoveFromFaction(WolfFaction)
    akTarget.RemoveFromFaction(SkeeverFaction)
    akTarget.RemoveFromFaction(SlaughterfishFaction)
    akTarget.RemoveFromFaction(MammothFaction)
    akTarget.RemoveFromFaction(GiantFaction)
endEvent

Faction Property BearFaction  Auto
Faction Property SprigganFaction  Auto
Faction Property SprigganPredatorFaction  Auto
Faction Property SprigganPreyFaction  Auto
Faction Property SabreCatFaction  Auto
Faction Property WolfFaction  Auto
Faction Property SkeeverFaction  Auto
Faction Property SlaughterfishFaction  Auto
Faction Property MammothFaction  Auto
Faction Property GiantFaction  Auto

I'd also recommend taking a closer look at how these factions relate to each other, you probably don't need all of them.  I think SprigganFaction in particular gets a friendly reaction from most animal types.

 

https://www.creationkit.com/index.php?title=Papyrus_Compiler_Errors#.22Unable_to_find_flags_file:_TESV_Papyrus_Flags.flg.22

Seems like it's not working. I put the debug.trace just in case but the debug doesn't appear. the compiling was successful tho.

 

Annotation 2019-10-04 131221.png

Link to comment
1 hour ago, Dryad said:

Seems like it's not working. I put the debug.trace just in case but the debug doesn't appear. the compiling was successful tho.

 

Annotation 2019-10-04 131221.png

Debug.Trace prints to the Papyrus log.  You can try Debug.Notification for the message to appear in the top left of the screen, or Debug.MessageBox to get it as a popup.  You can always try finding a Spriggan in the wild and seeing what it does.  Roadside Ruins just outside Falkreath is a handy location for that.

Link to comment
14 hours ago, Holzfrau said:

Debug.Trace prints to the Papyrus log.  You can try Debug.Notification for the message to appear in the top left of the screen, or Debug.MessageBox to get it as a popup.  You can always try finding a Spriggan in the wild and seeing what it does.  Roadside Ruins just outside Falkreath is a handy location for that.

It still attacks me. and notification doesn't come up although I've changed it to debug.notification  what should I do?

Link to comment
3 minutes ago, Dryad said:

It still attacks me. and notification doesn't come up although I've changed it to debug.notification  what should I do?

Just to back up a step and be sure:  The script only runs when the ability is added or removed from the player, you will need to change races to see it.  Loading into a save where you were already playing as your custom race won't get your scripted changes.

Link to comment
11 hours ago, Holzfrau said:

Just to back up a step and be sure:  The script only runs when the ability is added or removed from the player, you will need to change races to see it.  Loading into a save where you were already playing as your custom race won't get your scripted changes.

it turned out I didn't click on the autofill thing smh now I did it and I saw it worked I'm sorry and thank you so much like I'm so thankful for your help. and I know you have commented on my other posts too so I'm thankful for that as well!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...