Jump to content

Papyrus. For the love of Talos..... ?!?


xrws31

Recommended Posts

I'm just trying to get this incredibly basic Papyrus script working, so I have a point of reference to start more advanced stuff.

 

I have literally lifted this word for word from the Creation Kit Wiki. I changed the extension from ObjectReference to Actor, because the script is being attached to an actor, and Actor is a sub-category of ObjectReference anyway. I also tried it without this change.

 

Eventually I want OnHit to be working with the player's character. But just to get started I'm trying to get it working on Aela. So. I find Aela in the Object window under Actior. RightClick -> Edit. I add the script to the list of scripts. Yes it has been compiled. No there aren't any compilation errors. Yes it's in the correct folder (Skyrim/Data/scripts/source).

 

And yet, ingame, nothing. Not even an error, but certainly not what I want to see either. What have I missed?

 

Scriptname MyHitScript extends Actor

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
Debug.Trace("We were hit by " + akAggressor)
EndEvent

 

 

 

And an auxilliary question; how the bejesus do you attach a script to the player's character? "Player" in the Actor section of the Object Window is not the same thing as player in game. They have different Form IDs.

Edited by xrws31
Link to comment
Share on other sites

Debug.Trace prints output to an external file, so you wouldn't notice anything happen in-game with that, even in the console. See here for more details on debugging.

 

You can attach a script directly to the player, but it's not recommended to do that as it would be incompatible with any other mod that does so, and there's a better method. Both ReferenceAliases and ActiveMagicEffects receive events from the actors to which they are pointing. I'm not particularly experienced with aliases, so I can't walk you through this step by step, but you should be able to point a ReferenceAlias (with a script attached to it) at the player via a Quest of your own creation.

 

Cipscis

Link to comment
Share on other sites

Debug.Trace prints output to an external file, so you wouldn't notice anything happen in-game with that, even in the console. See here for more details on debugging.

 

You can attach a script directly to the player, but it's not recommended to do that as it would be incompatible with any other mod that does so, and there's a better method. Both ReferenceAliases and ActiveMagicEffects receive events from the actors to which they are pointing. I'm not particularly experienced with aliases, so I can't walk you through this step by step, but you should be able to point a ReferenceAlias (with a script attached to it) at the player via a Quest of your own creation.

 

Cipscis

 

Really appreciate the heads up on those two. Can't believe I missed the debug trace thing :<

Link to comment
Share on other sites

Hmm, I'm a little confused as to how an OnHit event could be used in conjunction with an alias. OnHit doesn't have a pointer indicating what it should be checking for hits on, it's just assumed to be hits on the object the script is attached to. So surely an OnHit script would have to be attached to the player?
Link to comment
Share on other sites

Scripts extending ReferenceAlias or ActiveMagicEffect have Actor events called on them by the object to which they're pointed. Basically, if you have a ReferenceAlias pointed to the player, then when the game calls OnHit on the player, OnHit will also be called on your ReferenceAlias that is pointing to the player, so you can use that script to detect such events on the player without actually having to touch the player.

 

Cipscis

Link to comment
Share on other sites

  • Recently Browsing   0 members

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