donotbugme Posted February 22, 2016 Posted February 22, 2016 I have a book with item id 'SGSNote01' I have an Alias in my quest called FirstNote where the specific reference is an instance of SGSNote01 I am trying to run a script SGSFirstNoteScript with the following Scriptname SGSFirstNoteScript extends ObjectReference ReferenceAlias Property FirstDoor Auto Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) Debug.Messagebox("Please do something? please?") EndEvent Event OnRead() Debug.Messagebox("First Note OnRead fired") EndEvent Event OnActivate(ObjectReference akActionRef) Debug.Messagebox("First Note OnActivate Fired") EndEvent Event OnGrab() Debug.Trace("Note has been grabbed") endEvent Nothing Fires. when I pick up the item. I have absolutely no idea why. The Note is sitting on the floor, the only noteworthy(hehe) aspect of the item is that I have enabled "Havok do not settle". Picking up the Note does nothing. Reading it does nothing. I should be getting a messagebox pop up for anything since the code does compile. I have other scripts and events fire not on this item. I have an almost identical script that works just fine on another item that is not a book - CoinPickupScript1 Scriptname SGS_CoinPickupScript1 extends ReferenceAlias Actor Property PlayerRef Auto Quest Property ThisQuest Auto Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) If akNewContainer == PlayerREF ThisQuest.SetStage(5) PlayerRef.moveto(labyrinthstart.GetRef()) Debug.Messagebox("OnContainerChangedFired") EndIf EndEvent ReferenceAlias Property LabyrinthStart Auto Anyone know what I should try to get this to work? I feel out of ideas. Update1: Added a script to the book itself and it seems to work just fine. Assuming theres some problem with filling the alias that isn't working for me. Using the exact same code attached to the book itself rather than through a quest. Quest Alias Tab Screenshot http://i.imgur.com/IoowOVp.png Scriptname SGSHardScriptCopyNote01 extends ObjectReference Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) Debug.Messagebox("Please do something? please?") EndEvent Event OnRead() Debug.Messagebox("First Note OnRead fired") EndEvent Event OnActivate(ObjectReference akActionRef) Debug.Messagebox("First Note OnActivate Fired") EndEvent Event OnGrab() Debug.Trace("Note has been grabbed") endEvent EDIT: Fixed Formatting Update1: Added info about adding a script to a hard copy of the item instead of refalias Update2: added screenshot of Quest Alias Window to check for settings. Both seem set identically with the reserved flag set.
aqqh Posted February 22, 2016 Posted February 22, 2016 probably alias did not fill. you cant reference base object to an alias. You need a RefID of the object in game. It's like with actors - base actor ID and RefID is not the same thing even for the unique actors. Basically you need a RefID of your note and then manually attach it to an empty alias like this alias_Note.ForceRefTo(Game.GetPlayer().PlaceAtMe(Note)) Put it for example in stage 0 of start game enabled quest Alias_Note is a property of that empty alias ForceRefTo is script command to manually assign given reference to an alias Game.GetPlayer().PlaceAtMe(Object_Property) returns a RefID of a newly created reference of given base object (it creates your note in game, it wont appear anywhere but the game will create an object with it's own RefID) Note - base object (objectreference property linked to your note BaseID)
donotbugme Posted February 22, 2016 Author Posted February 22, 2016 I'm not really understanding the process here despite your instructions. Sorry. Here is a image i have with the expected error because I dont know how to reference the world item I have with a new ref editor id: http://i.imgur.com/4JlXdvb.png Basically what I understand is I Alias_Note.forceRefTo( "an instance of the note I have placed in the world where I have named it the desired Ref Editor Id and that will fill the alias". Im just missing a piece on where to put it together where I can add the reference editor ID as a property in my script in order to set it.
aqqh Posted February 23, 2016 Posted February 23, 2016 When you create a book (or whatever else) in Creation Kit you just created a new base item. This item exist in "game library" but it does not exist in the game world anywhere yet. For example when you take your newly created letter and place it on a table at Riverwood Trader you have just created a new reference of an existing base object. This object exists in a game world so if you go to Riverwood Trader and check that table your letter would be there and it would have it's own, unique RefID. To fill an alias you need that unique RefID. So if you dont want to place your letter anywhere you can use PlaceAtMe instead - because this is what PlaceAtMe does. It creates a new reference of given base object. For example if you use console to placeatme some NPC game would create a new clone of that NPC, which would look the same as original one, which will have exactly the same BaseID, but will have i's own, unique RefID. Basically what (Game.GetPlayer().PlaceAtMe(Note)) does is that you force the game to create your letter in the game world. And then - for example - this newly created letter can be given to the courier which would deliver it to player. We got it like this in Sex Slaves to start the very first quest: quest aqss_MiaVessInter is set to start on game enabled - which means this quest will enable as soon as mod is loaded and starting stage script code (stage 0) would be executed. alias_Note.ForceRefTo(Game.getPlayer().PlaceAtMe(Note)) ;this creates a note in the game world and assigns it to an empty alias (WICourier as WICourierScript).addAliasToContainer(alias_Note) ;this gives the note to vanilla courier which would deliver it to player as soon they would visit any kind of town ReferenceAlias Property Alias_Note Auto ;alias property Quest Property WICourier Auto ;property of vanilla courier quest Book Property Note Auto ;property of Base object of our note which advances the quest further if delivered and even further if you read it. To make the note to advance our quest we used vanilla scripts DefaultOnReadSetQuestStage, defaultSetStageOnPlayerAcquire attached to Note alias Like this: you do not modify these scripts - just set their properties to whatever that you need like this:
donotbugme Posted February 23, 2016 Author Posted February 23, 2016 Alright I think I understand what I will need to do once I have a go at getting it working for dynamically creating an instance of a letter and assigning it as an alias; however one point im a little unsure of - just point out if my question is going around in circles. your explanation seems to be creating a new instance of the base object in a script and for example adding it to container and then using that created instance (that possesses a unique refId) and forcing it to be the quest alias. I believe I understand that but my note already exists in the game world. Basically My issue is that in the creation kit I have created a new instance of the base object in a cell and I believe as you have stated that should already possess a RefID. What is happening is that I have set my note to be the forced reference for Alias_Note and it isn't getting filled. Its confusing because I have literally done the same thing with an instance of a zad posture collar and scripts fire on pickup but the same process is not working for the instance of the book I have created in the same cell. For example when you take your newly created letter and place it on a table at Riverwood Trader you have just created a new reference of an existing base object. This object exists in a game world so if you go to Riverwood Trader and check that table your letter would be there and it would have it's own, unique RefID. If theres anything youd like me to clarify before you give me a response go ahead and i'll do my best to give you the detail needed.
donotbugme Posted February 23, 2016 Author Posted February 23, 2016 My Mind is actually blown now. I've never felt so confused for so long I thought the alias wasn't filling so i tried firing a new event in the script. Scriptname SGSPotionPickupGag extends ReferenceAlias ReferenceAlias Property FourthDoor Auto zadlibs Property libs Auto Event OnInit() debug.messagebox("The fucking potion is inited") EndEvent Event OnContainerChanged(ObjectReference akOldContainer, ObjectReference akNewContainer) Debug.Messagebox("Upon touching the blue magicka potion your jaw is stretched wide, a ballgag harness has been magically strapped around your head") libs.manipulatedevice(game.GetPlayer(), libs.gagball, true) FourthDoor.GetRef().Lock(ablock=false) Utility.Wait(1.0) EndEvent EDIT: Doesnt seem like any events fire apart from OnInit() "The fucking potion is inited" when I load up the game but picking up the item sitting on the ground is not triggering OnContainerChanged. I'm mystified and wondering what I need to do to get the event to work, quite possibly OnContainerChanged may simply just not be called when picked up in the world and I need some other event to listen for.
donotbugme Posted February 23, 2016 Author Posted February 23, 2016 I've been slamming my head against this problem for I shit you not 12 hours. Turns out I had in one of my scripts I did not assign zadquest to the zadlibs property for devious devices. Somehow I do not understand precisely but what I observed was that changes to my scripts were compiled and reported "succeeded" but something was fucking up and it wasn't applying shit. fuck! so much time and effort spent on this ridiculous oversight! I always have to make sure to check my properties going forward now
Recommended Posts
Archived
This topic is now archived and is closed to further replies.