Possible to add new variable to object through Papryus?

Post » Tue Oct 06, 2015 10:56 pm

Long story short: I'm making a mod that will temporarily increase an NPC's disposition toward the player. Since this is a temporary increase, I need to store the starting disposition somewhere. I can see two possibilities: (1) a global array, but this doesn't seem as elegant as (2) storing it on the actor itself. Is it possible to add a new variable to an object through Papyrus? e.g. int actorRef.oldDisposition = actorRef.GetRelationshipRank(player)? Thanks for any help!

EDIT: I just noticed the quick question, quick answer thread. Sorry for not posting this there.

User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Wed Oct 07, 2015 3:23 am

Cleanest way to do this is with a custom faction. You can add and remove any actor anytime to the faction and change their rank (0 to 100) dynamically with scripting. The best part of doing it this way is that you can use this in the conditions through out the game system as well.

The only two disadvantage I have found so far is that the number must not be very large for the rank and it must be integer (not a float).

I once tried using a faction to record the elevation of the actor (so numbers in the thousands) and that resulted in the faction rank going crazy and returning lots of "random" numbers.

User avatar
Adam Baumgartner
 
Posts: 3344
Joined: Wed May 30, 2007 12:12 pm


Return to V - Skyrim