YaserM Posted January 5, 2021 Share Posted January 5, 2021 I'm not able to get the name of an object reference. How do I do that? Here is my failed attempt: Link to comment Share on other sites More sharing options...
YaserM Posted January 5, 2021 Author Share Posted January 5, 2021 This is so frustrating. I managed to get my health with this: Scriptname YM_TestScriptOnHit extends Actor{A script that should activate each time the player gets hit}Float Property Health AutoActor Property pActor AutoActorValue Property HealthAV Auto ConstEvent OnInit() RegisterForHitEvent(Game.GetPlayer())EndEventEvent OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial) pActor == akTarget Debug.messagebox("YM_TestScriptOnHit: " + pActor + " was hit") Health = Game.GetPlayer().GetValue(HealthAV) ;Health = pActor.GetValue(HealthAV) Debug.messagebox("YM_TestScriptOnHit: "+ Health ) RegisterForHitEvent(Game.GetPlayer())EndEvent But how do I get my health from the values provided by the function? Link to comment Share on other sites More sharing options...
dylbill Posted January 5, 2021 Share Posted January 5, 2021 To get name instead do: Debug.messagebox("YM_TestScriptOnHit: " + pActor.GetdisplayName() + " was hit") . Note this does require F4SE. There's a way to do it without F4SE by using a Message Form, a reference alias in a quest and using the tag <Alias=MyAlias>. So in your message form you would put "YM_TestScriptOnHit: <Alias=MyAlias> was hit" . Then in your script you would put : ReferenceAlias Property MyAlias Auto Message Property MyMessage Auto Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial) myAlias.ForceRefTo(akTarget) MyMessage.Show()Make sure your reference alias has the Optional, Stores Text and Uses Stored Text flags checked. Link to comment Share on other sites More sharing options...
YaserM Posted January 5, 2021 Author Share Posted January 5, 2021 Thanks for the response, much appreciated! I'll check it out and reply with results :) Link to comment Share on other sites More sharing options...
Recommended Posts