Problem with Script Extensions

Post » Sun Nov 18, 2012 2:49 pm

Hello! I have a simple problem.

Let's say that when an ObjectReference is hit (Event OnHit), an Actor should die (Kill(ak Killer)). My idea is to kill a goat by one hit.
Becouse there are 2 diffrent script extensions needed, when i use one at first line of the script, the function/Event of latter wont work?
Can i use both in 1 Script?
User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm

Post » Sun Nov 18, 2012 5:57 pm

I'm still a bit of a noob to scripting, but the Actor script extends ObjectReference, so if you use the Actor script you should be fine and get both.
User avatar
Kerri Lee
 
Posts: 3404
Joined: Sun Feb 25, 2007 9:37 pm

Post » Sun Nov 18, 2012 5:42 pm

Working! Thank you very much!
P.S. Are there any ways to make multi-extensional Scripts? Like TryingToKill an Alias when OnHitting ObjectReference and GettingStage of Quest in one script?
User avatar
Matt Gammond
 
Posts: 3410
Joined: Mon Jul 02, 2007 2:38 pm

Post » Sun Nov 18, 2012 5:54 pm

Papyrus scripts work via inheritance. If script A extends script B, then script A inherits all of the properties, functions, and events of script B. Although each script can only extend a single other script, this inheritance works through multiple levels.

For example, the http://www.creationkit.com/ObjectReference_Script extends the http://www.creationkit.com/Form_Script, so it has access to all of the properties, functions etc. of that script. On top of that, the http://www.creationkit.com/Actor_Script extends the ObjectReference script, so it has access to all of its properties, functions, and events - including those already inherited from the Form script.

If you were to write a script extending Actor, it would have access to all of this on top of whatever you define in that script. You could then write another script extending your custom script that could be attached to objects with your first script attached and it would have access to all of the things from that script as well as whatever you define in this new script.

I hope that helps you understand how it works. I also describe Papyrus' inheritance in one of my tutorials, http://cipscis.com/skyrim/tutorials/externalaccess.aspx

Cipscis
User avatar
^_^
 
Posts: 3394
Joined: Thu May 31, 2007 12:01 am

Post » Sun Nov 18, 2012 1:16 pm

Thanks. I think I finally got it!
User avatar
Christie Mitchell
 
Posts: 3389
Joined: Mon Nov 27, 2006 10:44 pm

Post » Sun Nov 18, 2012 12:47 pm

Are there any ways to make multi-extensional Scripts? Like TryingToKill an Alias when OnHitting ObjectReference and GettingStage of Quest in one script?

Just to be sure you get this:

Whenever you're going to call a (native) function on an object, the functions of that object type's script are available, not the functions of the script in which it is done. So you can for example call TryToKill on a ReferenceAlias object inside a script that extends Actor, even though the Actor script doesn't know the TryToKill function. At the same time, calling TryToKill on an Actor inside a script that extends ReferenceAlias does not work (because it will look for a TryToKill function in the Actor script).
User avatar
Alexis Acevedo
 
Posts: 3330
Joined: Sat Oct 27, 2007 8:58 pm


Return to V - Skyrim