Jump to content

Attempting to apply faction aggression script to armor in the Creation Kit


dalescooper

Recommended Posts

Hello,

 

I'm trying to learn programming and Papyrus, and I was thinking about creating a plugin that applied (what I thought was) a simple script to a helmet. The idea I want to achieve is that the player must wear a specific helmet in order to interact with NPCs, otherwise will be attacked on sight. To achieve this, I've changed the players starting faction from PlayerFaction to a duplicate called "PredatorRevealedFaction", which is otherwise identical if not for automatically being an enemy to all crime factions in the game. The script is supposed to switch from the hated faction to the original player faction upon equipping this helmet, yet when I try the script in game I can walk around unmasked freely in Riverwood.

 

I'm conscious that this may be the script, but I don't know for sure. Can anyone help me with this?

 

 

Scriptname PredatorRevealHide extends ObjectReference
faction property PlayerFaction auto
faction property PredatorRevealedFaction auto
EVENT OnEquipped(Actor akActor)
akActor.removeFromFaction(PredatorRevealedFaction)
akActor.addToFaction(PlayerFaction)
endEVENT
EVENT OnUnequipped(Actor akActor)
akActor.removeFromFaction(PlayerFaction)
akActor.addToFaction(PredatorRevealedFaction)
endEVENT
Link to comment
Share on other sites

Use some debug.trace() or debug.notification() in your events along with IsInfaction() to query if the actor is successfully added to or removed from the factions.

 

You can also set faction reaction between factions or SetEnemy() or SetAlly between factions in combination with adding the actor to a faction.

 

Basic info about these functions can be found here: http://www.creationkit.com/Category:Papyrus

Sorry I'm not more specific, but faction stuff is not my forte, even though I can usually get the desired results by doing as I said above and experimenting.

Link to comment
Share on other sites

Thank you, I'll try that.

 

I'll definitely be trying to modify reactions too. I was hesitant earlier, as it would mean I would have to alter the reactions of every single crime faction at once. There's an example script on the wiki for FormLists, I'll work with that.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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