ReDragon2013 Posted November 27, 2019 Share Posted November 27, 2019 (edited) 4 Objects and referencesFAQ: "A base object is whatever there is in the object window" obviously object window has the baseobjects and cell view has the objectReferencesFAQ: "a reference is ONLY a base object that is placed in a specific location of world and has a X, Y, Z coordinate, am I right? YES, but a Ref or Reference (also called ObjectRef or ObjectReference) may have two ways of placement direct placement into Skyrim world, so this Ref has a FormID with leading byte like 0xXX...... XX == 00h vanilla plaed by Skyrim.esm == 01h vanilla placed by Update.esm == 02h Dawnguard.esm == 03h Hearthfires.esm == 04h Dragonborn.esm .. == FEh last available loaded mod *.esp indirect placement via papyrus script ; https://www.creationkit.com/index.php?title=PlaceActorAtMe_-_ObjectReference XX == FFh objectReference oRef = self.PlaceAtMe(BaseObject, 1) actor aRef = self.PlaceActorAtMe(ActorBase)FAQ: "Are random spawns also references of their base objects?" ObjectReferenceFAQ: "So let's say I create a book, and place it in 2 dungeons, one book in each dungeon, my book is a base object, and has 2 references." YESFAQ: "A script (that extends book) attached to my book will work in both books" NO.. that is missunderstanding. every script is attached to ObjectReference, look at this: Scriptname defaultAddBookScript extends ObjectReference ; keep in mind this vanilla script is not attached to book, its attached to container Book PROPERTY itemToAdd AUTO {the misc item to place} Int PROPERTY count AUTO {how many of the above item the char should have} EVENT OnLoad() int i = self.GetItemCount(itemToAdd) IF (i < count) self.AddItem(itemToAdd, count - i, TRUE) ENDIF ENDEVENT every script attached to the book baseobject is also working for every reference placed in the skyrim world next script (attached to book baseobject) makes that player can see the right skill book or not depends on quest stages Scriptname DBSanctuarySkillBooksScript extends ObjectReference {Track which DB Sanctuary skill books the player has acquired to prevent duplicates or interferance from the DB10 Fire.} Quest property dunSkillBooksQST Auto Quest property DB10 Auto Quest property DB11 Auto Location property DarkBrotherhoodSanctuaryLocation Auto Location property DawnstarSanctuaryLocation Auto Int property dunSkillBooksQSTStage Auto EVENT OnCellLoad() if (!dunSkillBooksQST.GetStageDone(dunSkillBooksQSTStage)) if (Self.GetCurrentLocation() == DarkBrotherhoodSanctuaryLocation && !DB10.GetStageDone(1)) Self.Enable() ElseIf (Self.GetCurrentLocation() == DawnstarSanctuaryLocation && DB11.GetStageDone(80)) Self.Enable() Else Self.Disable() EndIf EndIf ENDEVENT FAQ: "but if I want a script to only affect one of the books I must extend ObjectReference script and attach this script to the book? Is that right?" Y..NO do not attach a script to the baseobject, instead attach the script to the book objectRef that is pre-placed by CK depends on the purpose you want to reach with your papyrus scriptingFAQ: "What's the difference between a reference and an ObjectReference? (I know that object reference is a script)" see second answer on top--- The real question should be: "What is the different between ReferenceAlias and ObjectReference?" an "Alias" is a part of a quest, Alias is used in scripts as type ReferenceAlias when you have not prefilled quest aliases (by using option "optional") a script is able to set/unset references dynamically like this https://www.creationkit.com/index.php?title=ForceRefTo_-_ReferenceAlias the reference has to be a valid (existing) Skyrim ObjectReference ReferenceAlias PROPERTY myAlias auto FUNCTION xyz_SetRef(ObjectReference oRef) ;---------------------------------------- myAlias.ForceRefTo(oRef) ENDFUNCTION FUNCTION xyz_ClearAlias() ;------------------------ myAlias.Clear() ENDFUNCTION Edited November 27, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
Evangela Posted November 28, 2019 Share Posted November 28, 2019 4 Objects and references -A base object is whatever there is in the object window, a reference is ONLY a base object that is placed in a specific location of world and has a X, Y, Z coordinate, am I right?-Are random spawns also references of their base objects?-So let's say I create a book, and place it in 2 dungeons, one book in each dungeon, my book is a base object, and has 2 references.A script (that extends book) attached to my book will work in both books, but if I want a script to only affect one of the books I must extend ObjectReference script and attach this script to the book? Is that right?-What's the difference between a reference and an ObjectReference? (I know that object reference is a script) 1. correct2. correct3. correct4. Scripts can be attached to references if you only want that reference to have its own script. However scripts can be references of the base script as well and therefor the reference scripts can do their own things provided the properties do not inherit that set on the base script. Link to comment Share on other sites More sharing options...
cdcooley Posted November 30, 2019 Share Posted November 30, 2019 Scripts in Papyrus are basically just class definitions from the perspective of most languages. It doesn't really matter how they get attached to a particular item. They can be attached to a base object or attached to a specific object reference. If you fill a property on the base object that property will take on that value for all references unless that same property gets reassigned by filling it again on a specific object reference. The Papyrus equivalent of object instances are the activated scripts attached to object references placed into the game world (and special singleton objects like Quests). Link to comment Share on other sites More sharing options...
Recommended Posts