How to mod player actor?

Post » Tue Dec 18, 2012 12:10 pm

I need some help, i want to write write a mod that will control player health regeneration based on armor and location, and i dont seem to get it on my own using wiki, so maybe someone can tell me how to do it in theory, with as much detail as possible please?

i need to attach a script to player that will hock up to location change and gear change, and attach new property to player that will hold regeneration multipler. Also i need to check somehow current armor properties and current location and weather, every time user changes armor or location or the weather is changing itself.

And im not sure about how to do any of this, all i know for now it that i probably going to need to attach that script to player object in actor, but how do i monitor weather change from there and create extra properties, or measure time to make modifications per second, i dont know. I dont have time to read all ot the sdk, so i need a speed curs on this issue.

thankls in advance.
User avatar
Yung Prince
 
Posts: 3373
Joined: Thu Oct 11, 2007 10:45 pm

Post » Tue Dec 18, 2012 2:44 pm

Don't use the player. Use the armor or location to put the script on.

Actor Property PlayerREF AutoSpell Property MySpell AutoLocation Property MyLocation AutoArmor Property MyArmor AutoakNewContainer PlayerREFEvent OnContainerChanged(akNewContainer, akOldContainer)	If akNewContainer == PlayerREF		PlayerREF.ModAV("HealRate", 0.1)	EndIfEndEvent

That's a basic script to be put on your armor that'll increase heal rate for 0.1. You could also just use a enhcnatment on the armor and tell the enchantment to only work when inside a certain area.
User avatar
Emilie Joseph
 
Posts: 3387
Joined: Thu Mar 15, 2007 6:28 am

Post » Tue Dec 18, 2012 9:06 am

If you do need to script the player, create a ReferenceAlias in your quest, filling it with a "Specific Reference" that is PlayerREF, [ACHR:00000014] found in "Any" cell from the resulting dropdown box. You can affix a script to the reference alias and it'll in turn be glued to the player so you can use OnItemAdded and whatnot.

If it's an NPC you've added to the game, you can just script the ActorBase, but it's better to script the player with a ReferenceAlias script than directly for compatibility reasons in that any number of mods can script the player in that manner, but only one would be able to edit the ActorBase, [NPC_:00000007].

*mofakin*: Line 6 has to go or it'll not compile as PlayerREF is already defined and akNewContainer is the event's argument and not a valid type.
User avatar
Soku Nyorah
 
Posts: 3413
Joined: Tue Oct 17, 2006 1:25 pm


Return to V - Skyrim