Difference between revisions of "Bethesda Tutorial Papyrus Events and Properties"
Jump to navigation
Jump to search
m
Bethesda Tutorial Papyrus Events and Properties (edit)
Revision as of 03:20, 20 February 2012
, 03:20, 20 February 2012More svelte template usage: no "Template:" needed.
imported>Catwheezle m (Applying the three new templates: InDepth, ProTip and WarningBox. No idea how to template the last one, though. Ideas?) |
imported>Catwheezle m (More svelte template usage: no "Template:" needed.) |
||
Line 29: | Line 29: | ||
Placed actors like these Druagr start alive (''well, relatively speaking''), and we need them to be dead. Double-click on each of them and check the box marked '''"Starts Dead"'''. | Placed actors like these Druagr start alive (''well, relatively speaking''), and we need them to be dead. Double-click on each of them and check the box marked '''"Starts Dead"'''. | ||
{{ | {{WarningBox|Modders familiar with earlier BGS titles take note - simply setting the health of a base actor to zero will no longer cause the actor to begin dead. You must use the "Starts Dead" checkbox as specified here.}} | ||
[[:Category:Getting_Started#Loading_Your_Plugin_in_the_Game|Save your plugin and run it in-game to check things out so far.]] You'll notice that two dead Draugr now lie in ragdoll on the floor of the room. That's what we want for now - but let's head back to the Creation Kit and get them back on their feet. | [[:Category:Getting_Started#Loading_Your_Plugin_in_the_Game|Save your plugin and run it in-game to check things out so far.]] You'll notice that two dead Draugr now lie in ragdoll on the floor of the room. That's what we want for now - but let's head back to the Creation Kit and get them back on their feet. | ||
Line 50: | Line 50: | ||
You may not realize it, but our example already uses an event sent to Papyrus. This is how the boss knows when to get out of his sarcophagus. If you've done the [[Bethesda_Tutorial_Traps_and_Prefabs|Ambushes Tutorial]], you may recall that the boss has uses a trigger volume as its Activate Parent. When the player steps into the trigger volume, the trigger activates the boss, causing him to get up. | You may not realize it, but our example already uses an event sent to Papyrus. This is how the boss knows when to get out of his sarcophagus. If you've done the [[Bethesda_Tutorial_Traps_and_Prefabs|Ambushes Tutorial]], you may recall that the boss has uses a trigger volume as its Activate Parent. When the player steps into the trigger volume, the trigger activates the boss, causing him to get up. | ||
{{ | {{InDepth| There are pre-existing scripts at play here, but here's what's basically happening: | ||
* The player collides with the trigger, causing an [[OnTriggerEnter_-_ObjectReference|onTriggerEnter]] event | * The player collides with the trigger, causing an [[OnTriggerEnter_-_ObjectReference|onTriggerEnter]] event | ||
* A script on trigger sends an Activate event in response to this. | * A script on trigger sends an Activate event in response to this. | ||
Line 65: | Line 65: | ||
# When the Crosshair cursor appears, double-click on the trigger volume. | # When the Crosshair cursor appears, double-click on the trigger volume. | ||
{{ | {{WarningBox|If you don't see the trigger, remember to use "'''M'''" to toggle visibility for markers.}} | ||
Both Draugr will now receive an Activate Event when the player enters the trigger. We aren't actually using that event to do anything yet, however. Next you'll write a script that responds to that event. | Both Draugr will now receive an Activate Event when the player enters the trigger. We aren't actually using that event to do anything yet, however. Next you'll write a script that responds to that event. | ||
Line 80: | Line 80: | ||
</source> | </source> | ||
<br> | <br> | ||
{{ | {{InDepth| | ||
* '''scriptName LokirsDraugrResurrection''' - This is the name of the script. The name of the script must match the name of the file ''exactly''. | * '''scriptName LokirsDraugrResurrection''' - This is the name of the script. The name of the script must match the name of the file ''exactly''. | ||
* '''extends Actor''' - This script will be placed on an Actor (the Draugr), so it can do any of the things an Actor can do. | * '''extends Actor''' - This script will be placed on an Actor (the Draugr), so it can do any of the things an Actor can do. | ||
Line 100: | Line 100: | ||
Next, we need to cast the Reanimate spell on the Draugr when the Activation event is received. To do this, we'll need to create a '''"[[Variables_and_Properties_(Papyrus)|Property]]"'''. In this case, it's a property of the [[Spell_Script|Spell]] type we'll be using. This will allow us to tell the Creation Kit which specific spell to use. | Next, we need to cast the Reanimate spell on the Draugr when the Activation event is received. To do this, we'll need to create a '''"[[Variables_and_Properties_(Papyrus)|Property]]"'''. In this case, it's a property of the [[Spell_Script|Spell]] type we'll be using. This will allow us to tell the Creation Kit which specific spell to use. | ||
{{ | {{NewFeature|For those who used the "[[Papyrus_Glossary#L|legacy]]" scripting language in editors for earlier Bethesda tools, this is a significant change. In Papyrus, you can't simply write in the Editor ID of the object you want to manipulate-- you have to use a property. This allows much more flexible and reusable scripts, since each instance of the script can have a different values for its properties. [[Variables_and_Properties_(Papyrus)|This page provides an overview of properties and variables in Papyrus]]}} | ||
Line 115: | Line 115: | ||
</source> | </source> | ||
<br> | <br> | ||
{{ | {{InDepth| | ||
* '''Spell''' - Is the property '''[[Category:Script_Objects|type]]'''. It tells Papyrus that we'll provide it with a [[Spell Script|Spell]] to use. | * '''Spell''' - Is the property '''[[Category:Script_Objects|type]]'''. It tells Papyrus that we'll provide it with a [[Spell Script|Spell]] to use. | ||
* '''property''' - Is a '''[http://en.wikipedia.org/wiki/Reserved_word reserved word]''' this is how we tell Papyrus to expect a new property. | * '''property''' - Is a '''[http://en.wikipedia.org/wiki/Reserved_word reserved word]''' this is how we tell Papyrus to expect a new property. |