MasterPhilosopher Posted November 5 Share Posted November 5 Hello, I am very new to all of this and wanted to just make a simple mod that sent all enemies flying away when hit. I have made the little script in the screenshot, but I am not sure what the reference number I should be adding to the PushActorAway command. I figured it was just the target reference but when I go to compile it just says "type mismatch on parameter 1 - cannot pass a objectreference to a actor". I am assuming I need to change the value where the reference number should be, but I am not sure how to reference the character being hit in this case. I am sure it is something simple I missed, but I'd appreciate any help. Thanks! Link to comment Share on other sites More sharing options...
LarannKiar Posted November 5 Share Posted November 5 You'll need to register the script for the OnHit event because the native code only sends this event to registered Papyrus scripts. Scriptname YOURSCRIPTNAME extends Actor Event OnInit() ; event is sent when this script is initialized (e.g. installed the mod the Actor is part of, started a new game if vanilla, etc.) RegisterForHitEvent(akTarget = Self) EndEvent Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \ bool abBashAttack, bool abHitBlocked, string asMaterialName) If akTarget as Actor ; akTarget is an Actor (akTarget as Actor).PushActorAway(akAggressor, 100.0) ; akTarget (the Actor this script is attached to) will be pushed back EndIf RegisterForHitEvent(akTarget = Self) ; native code unregisters the script for OnHit after it is sent so you need to reregister EndEvent Link to comment Share on other sites More sharing options...
MasterPhilosopher Posted November 7 Author Share Posted November 7 Thanks, but when compiling the file, I get an error "Knockback.psc(11,36): type mismatch on parameter 1 - cannot pass a objectreference to a actor". Do I need to cast the Target as something else? Thanks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts