Difference between revisions of "Events Reference"

Jump to navigation Jump to search
1,043 bytes added ,  20:02, 7 September 2013
no edit summary
imported>Scrivener07
imported>Scrivener07
Line 29: Line 29:
== Calling Events ==
== Calling Events ==
Calling events is identical to calling a [[Function Reference#Calling Functions|function]].
Calling events is identical to calling a [[Function Reference#Calling Functions|function]].
==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:
<source lang="papyrus">
Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile)
EndEvent
</source>
You might be tempted to try something like this:
<source lang="papyrus">
Event OnHit(Game.GetPlayer())
EndEvent
</source>
'''But that DOES NOT work.'''
Instead what you need to do is something like this:
<source lang="papyrus">
Event OnHit(ObjectReference akAggressor, Form akWeapon, Projectile akProjectile)
if akAggressor == game.getPlayer()
;do something
endif
EndEvent
</source>


== See Also ==
== See Also ==
Anonymous user

Navigation menu