Why is game ignoring this script?

Post » Wed Jan 21, 2015 2:02 am

Scriptname DropIt extends ObjectReference Armor Property AR AutoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)Actor PlayerRef = Game.GetPlayer()  If PlayerRef == akNewContainerPlayerRef.DropObject(Self)EndIfEndEvent

Why is the game ignoring Self??? When I replace Self with Ar it works. I have tried Self.GetBaseObject().

Does anyone know?

User avatar
Sherry Speakman
 
Posts: 3487
Joined: Fri Oct 20, 2006 1:00 pm

Post » Tue Jan 20, 2015 11:28 pm

Move the variable declaration out of the Event call. I don't believe Papyrus supports that.

User avatar
Elle H
 
Posts: 3407
Joined: Sun Aug 06, 2006 3:15 am

Post » Wed Jan 21, 2015 1:24 am

You lost me. The declaration is above the Event Call. You are talking about Armor Property AR Auto right?

User avatar
sarah taylor
 
Posts: 3490
Joined: Thu Nov 16, 2006 3:36 pm

Post » Tue Jan 20, 2015 7:53 pm

Sorry, I'm exhausted from a long day, that was not a very helpful post. :tongue:

I'm referring to this:
Actor PlayerRef = Game.GetPlayer()

Change your script to look like one of these:

Scriptname DropIt extends ObjectReferenceArmor Property AR AutoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)If akNewContainer == Game.GetPlayer()Game.GetPlayer().DropObject(Self)EndIfEndEvent
Scriptname DropIt extends ObjectReferenceArmor Property AR AutoObjectReference Property PlayerRef AutoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)If akNewContainer == PlayerRefPlayerRef.DropObject(Self)EndIfEndEvent
You either declare PlayerRef as a property outside of the Event, and set its value in the CK, or you use the Game.GetPlayer() function in the script itself.
User avatar
Dalton Greynolds
 
Posts: 3476
Joined: Thu Oct 18, 2007 5:12 pm


Return to V - Skyrim