Talk:Events Reference

From the CreationKit Wiki
Revision as of 20:00, 7 September 2013 by imported>Scrivener07 (Created page with "===A note about events=== Events are not like the old block types. When you make an event in your script that extends ObjectReference or ReferenceAlias you are essentially cre...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A note about events

Events are not like the old block types. When you make an event in your script that extends ObjectReference or ReferenceAlias you are essentially creating a new version of that event, and you need to declare it with the same number of parameters. Those parameters are then used inside the script.

You should pretty much just copy and paste the events straight from the wiki, unless you desire to change the name of the parameters for some reason (but I can't think of a reason).

For example:

 Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile)
 
 EndEvent

You might be tempted to try something like this:

Event OnHit(Game.GetPlayer())
 
EndEvent

But that DOES NOT work.

Instead what you need to do is something like this:

 Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile)
 	if akAggressor == game.getPlayer()
 		;do something
 	endif
 EndEvent

Moved this from the events category. I get a bad gateway error when I try to edit the main page Scrivener07 (talk) 2013-09-07T21:00:49 (EDT)