Talk:Actor Script

From the CreationKit Wiki
Jump to navigation Jump to search

Player as Actor[edit source]

How are we to run Events on the player from the Actor Object? Is there a way to attach scripts to the player, or something equivalent? For example, how can I detect when the player is hit (using an OnHit block)? --Doulos 21:16, 16 February 2012 (EST)

Scripts extending ReferenceAlias or ActiveMagicEffect will be sent events from Actors that they are pointing at, and it is possible to use a Quest to point a ReferenceAlias script at the player, or a Spell to point an ActiveMagicEffect script at the player.
-- Cipscis 21:19, 16 February 2012 (EST)

Summon and Banish Events[edit source]

I found 4 instances of a script defining a "Summon" event, each of them also has a "Banish" event. In most of these they are just called like functions Summon() and Banish() but maybe they are real events? Anybody know?

  • defaultFakeRezSpell.psc
  • defaultFakeSummonSpell.psc
  • dunFrostmereCryptFakeSummon.psc
  • dunGeirmundDuplicateSpellManager.psc
--- Fowl 11:39, 17 February 2012 (EST)
Yeah, there are a few of those around. If I remember correctly, the Critter system uses a few custom events too, like OnStart.
Events are pretty much exactly the same as functions, although they can't have return values. Just like we're able to define custom functions, we're entirely able to define (and call - events can be called just like functions) custom events.
The special thing about the events documented here on the wiki is that they are native events. These events are called by the game engine when certain things happen, which is why they have to be used as our entry point.
Those events are custom events. Any custom events will essentially be exactly the same as custom functions without a return value. Just like custom functions, they will not run if not called manually.
-- Cipscis 23:47, 17 February 2012 (EST)