Difference between revisions of "Talk:OnActivate - ObjectReference"

Jump to navigation Jump to search
Added another example script.
imported>David Brasher
(Sample script added.)
 
imported>David Brasher
(Added another example script.)
Line 1: Line 1:
== Script for Quest-Coding ==
== Script for Advancing Quest When Item is Found ==


Here is a sample script using an Event OnActivate block.  
Here is a sample script using an Event OnActivate block.  
Line 17: Line 17:


--[[User:David Brasher|David Brasher]] 18:49, 27 April 2012 (EDT)
--[[User:David Brasher|David Brasher]] 18:49, 27 April 2012 (EDT)
== Script on Activator, Only Fires When Player, but not Other Actors, Activates it ==
; When the player, and only the player, activates the activator, he or she gets the magic crystal.  (Some random NPC can't go touch the activator and suddenly make this crystal show up in the player's inventory for no reason.)
<source lang="papyrus">
Scriptname AAAcivatorWithCrystalSCRIPT extends ObjectReference
Event OnActivate(ObjectReference akActionRef)
        if akActionRef == PlayerRef
          Game.GetPlayer().AddItem(AAMagicCrystal, 1)
        endif
EndEvent
Actor Property PlayerRef Auto
MiscObject Property AAMagicCrystal  Auto 
</source>
--[[User:David Brasher|David Brasher]] 15:43, 6 May 2012 (EDT)

Navigation menu