Jump to content

Scripting Question


David Brasher

Recommended Posts

@scrivener07

 

I noticed you put that up on the wiki's example scripts. I tried to change it but you changed it right back. :turned:

 

Anyway, that first line should be

 

if (akSourceContainer == Game.GetPlayer())

otherwise you're just assigning the player to the akSourceContainer variable.

 

 

Opps, must of missed the change when I added more items to check. Barrel only took one item in the first example. I dont know how I looked at this script as many times as I have and didnt catch that. Thanks :ninja:

Link to comment
Share on other sites

Thanks for all the advice everybody. I finally figured out an alternate approach for how to do this.

 

Oblivion Scripting Language:

 

SCN AAFoundTheObject 

; Object script attached to the item you must find to advance the quest stage.

Begin OnAdd
    SetStage AAQuest 15
End

 

Papyrus:

 

Scriptname AAFoundTheObject extends ObjectReference  

Event OnActivate (ObjectReference akActionRef)
AAQuest.SetStage (15) 
EndEvent  

Quest Property AAQuest Auto

 

It is not an exact functional match, but it works. I will have to devote more research and development time to trying to get the proposed Event OnContainerChanged or Event OnItemAdded scripts working.

 

 

EDIT:

Okay. I got this one working now:

 

Scriptname AAFoundTheObject extends ObjectReference  

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
       if (akNewContainer == Game.GetPlayer())
               AAQuest.SetStage (15)
       endif
EndEvent

Quest Property AAQuest Auto

Edited by David Brasher
Link to comment
Share on other sites

I got a couple other versions of the script working. Although this one compiles, it does not do anything:

 

Scriptname AAFoundTheObject extends ObjectReference

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
     if akBaseItem == AAMiscItem
          AAQuest.SetStage (15)
     endIf
endEvent

Quest Property AAQuest  Auto  

MiscObject Property AAMiscItem  Auto  

Link to comment
Share on other sites

I got a couple other versions of the script working. Although this one compiles, it does not do anything:

 

Scriptname AAFoundTheObject extends ObjectReference

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
     if akBaseItem == AAMiscItem
          AAQuest.SetStage (15)
     endIf
endEvent

Quest Property AAQuest  Auto  

MiscObject Property AAMiscItem  Auto  

 

I see nothing wrong with that script. Make sure your properties are filled. I keep making that mistake over and over. I write out my properties and never fill them. Respond with a facepalm is that was it.

Link to comment
Share on other sites

So I guess this script would not be suitable for putting on the player? What I want to happen is the player has a quest to go find a loose item in a dungeon and pick it up. When the item is picked up, the quest updates. The player is the container, and if every quest-coder slapped a new script on the player for every quest, then mod conflicts would abound.
Link to comment
Share on other sites

So I guess this script would not be suitable for putting on the player? What I want to happen is the player has a quest to go find a loose item in a dungeon and pick it up. When the item is picked up, the quest updates. The player is the container, and if every quest-coder slapped a new script on the player for every quest, then mod conflicts would abound.

 

Introduction to quest alias 101-

Everything you just said is absolutely correct. But.. with the new alias feature you can assign data to objects indirectly. You can think of an alias as a magical hat. Anyone wearing this magical hat inherits all of its special traits. When the wearer takes off this magic hat(the alias) they return to their lame non-magical self.

 

So, using this idea you could create an alias called "player" and attach your script to that. Note, you can fill this alias with any actor, even a dog. If you do fill the "player" alias with the player then when your quest starts your quest will place that magic hat on the player and in effect, will have the script attach too. When your quest is finished so is your alias and the player returns to their lame unscripted self.

 

Here are two wiki articles that discuss aliases

http://www.creationkit.com/Bethesda_Tutorial_Quest_Objectives

http://www.creationkit.com/Bethesda_Tutorial_Quest_Aliases

 

edit: forgot to add, scripts attached to reference aliases have to use extends ReferenceAlias

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...