Jump to content

Help with scripting a follower


Solora

Recommended Posts

Hi everyone, I'm currently working on an Imperial werewolf follower, Ayleth, and I'm trying to get it so that whenever she goes into combat, a script activates and monitors her health. Whenever her health goes below 10%, she'll apply a werewolf FX armor and spell FX like how the player transformation is set up, but instead of changing her race, she teleports to an x marker in another cell, and a werewolf npc will teleport into her spot instead. After combat ends, it'll play another transformation FX and armor, then the werewolf will teleport to its own xmarker and my follower will teleport back to the same spot so it looks like she transformed.

 

I've just started learning Papyrus, I've gone through many tutorials and the CK wiki and I understand a lot of the terms and such, but I have no experience and frankly I'm really not sure how I should go about writing the script. Spwnd has given me permission ( thank you spwnd!) to study his werewolf mods to get a feel for what I should do for my own follower. This is what I've outlined so far, it's not complete yet and some of the functions (equip and play :P) I don't know the proper code line for yet but I'll be researching all of the correct terms. I'm just not sure how to go about this, honestly. I don't want the script to affect performance or have save game bloat, so I've got it in states to try to keep it only running when she goes into combat, I THINK this will do it? Turning the state on when she goes into combat, and then deactivating when she exits combat.

 

Scriptname AylethWerewolf Script extends Actor
{Checks Ayleth during combat and handles werewolf transformation, if health drops below 10%, transform}}
Auto state Inactive
 event OnStartCombat ()
GoTostate ("Active")
 EndState
 
if (getActorValuePercentage("health") < 0.1)
equip WolfSkinFXArmor
play WerewolfChangeFX
MoveTo (AAAylethTeleport)

record Ayleth coordinates somehow

 

(not 100% sure how to put werewolf npc part into script, since the script is attached my follower, but this is pretty much what I want)

event werewolf moveto Ayleth coordinates

eventend

 

event OnCombatStateEnd

record werewolf coordinates

equip transform FX

play transform FX

moveto AAAylethWerewolfTeleport

move Ayleth back to werewolf coordinates

 

endevent

State Active
Event OnCombatEnd
GoToState("Inactive")

ObjectReference Property AAAylethTeleport Auto ; Ayleth Xmarker
ObjectReference Property AAAylethWerewolfTeleport Auto ; Werewolf Xmarker
Actor property AAAyleth Auto
Actor Property AAAAA Auto ; werewolf
Armor Property WolfSkinFXArmor  Auto  

SPELL Property WerewolfChangeFX  Auto

 

 

 

 

My big questions are, will something roughly like this work without messing up performance or causing save bloat or ctd's? Will it reactivate when Ayleth goes into combat again? Should I worry about having the State at all, or is there an easier/more efficient way to go about it? Any help or tips are greatly appreciated laugh.gif!

 

Thanks, Solora

Link to comment

Use OnEnterBleedout() event to understand if the health is too low.

And set that the actor (in the window to edit the actor) that he/she will enter bleedout at 10%.

 

You may have something like this:

 

 

Event OnEnterBleedOut()
  Actor me = Self as Actor
  me.EquipItem(WolfSkinFXArmor)
  WerewolfChangeFX.Cast(me, me)
  Utility.wait(1.0) ; "one second for transformation?"
  AAAAA.enable()
  AAAAA.moveTo(me)
  AAAAA.StartCombat(me.getCombatTarget())
  me.restoreHealthAndLimbs()
  me.disable()
EndEvent

 

And then on the AAAA actor add another script like:

 

 

Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
  if aeCombatState==1
    return
  endIf   
  Actor me = Self as Actor
  WerewolfChangeFX.Cast(me, me)
  Utility.wait(1.0) ; "one second for transformation?"
  AAAyleth.enable()
  AAAyleth.moveTo(me)
  AAAyleth.UnEquipItem(WolfSkinFXArmor)
  me.restoreHealthAndLimbs()
  me.disable()
EndEvent
Link to comment

Well, I edited the scripts and she'll do the animation and swap with the werewolf npc no problem, but now I can't get her to swap back with the human npc. Oh well, I'll keep poking around and see what I can coem up with. It's progress so far :P !

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use