Duk3nat0r Posted April 15, 2017 Share Posted April 15, 2017 (edited) I'm trying to make doomstones appear as trophies when the players has activated the original doomstone in Skyrim. Here is the script I'm using: Scriptname tdNPScriptDoomstoneDISP extends ObjectReference {It activates a doomstone display as trophy when the player found and activated it in the world} ObjectReference Property EnableRef_01 Auto{Doomstone trophy that needs to be Enabled}Spell Property ShrineSpell Auto{doom....Ability}Int Property DoOnce Auto{Edit value to 0}GlobalVariable Property tdDisplayMax Auto{Self created Global Value of 0} Event OnInit() If DoOnce == 0 RegisterForUpdate(20) EndIfEndEvent Event OnUpdate() if (Game.GetPlayer().HasSpell(ShrineSpell)) Self.Enable() UnregisterForUpdate() tdDisplayMax.Value += 1 DoOnce = 1 endif EnableAll() endevent Function EnableAll() EnableRef_01.enable() EndFunction Note that the doomstone display, is set as 'initially disabled'. The problem I'm having is it doesn't seem to work as all the doomstone displays are showing, even though a new character haven't activated them in Skyrim yet. Can anyone give some pointers why this isn't working? Edited April 15, 2017 by Th3 Duk3 Link to comment Share on other sites More sharing options...
foamyesque Posted April 16, 2017 Share Posted April 16, 2017 (edited) Your OnInit is firing on game load, I believe, and triggers the update. Since EnableAll is outside of the conditional on the update, it will always fire and enable the reference. My approach to this problem would be to build a quest, put the doomstones in quest aliases, and then attach a script to the aliases that tracks an OnActivate event that then, in turn, enables the trophy, which would be passed in as a property. Edited April 16, 2017 by foamyesque Link to comment Share on other sites More sharing options...
Duk3nat0r Posted April 17, 2017 Author Share Posted April 17, 2017 (edited) Mmm, yes I see what you mean. Won't this be easier?: EDIT: still can't get it to work. Even tried replacing the doomstones with static versions, so it must be something with the script itself. Also tired HasMagicEffect instead of HasSpell, didn't make any difference. Scriptname tdNPScriptDoomstoneDISP extends ObjectReference {It activates a doomstone display as trophy when the player found and activated it in the world} ObjectReference Property EnableRef_01 Auto{Doomstone that needs to be Enabled}Spell Property ShrineSpell Auto{doom....Ability}Int Property DoOnce Auto{Edit value to 0}GlobalVariable Property tdDisplayMax Auto{Self created Global Value of 0} Event OnCellAttach() if DoOnce == 0 if (Game.GetPlayer().HasSpell(ShrineSpell)) if EnableRef_01.IsEnabled() == false EnableRef_01.enable() DoOnce = 1 tdDisplayMax.SetValue(tdDisplayMax.GetValue() + 1) endIf endIf endIfendEvent Edited April 17, 2017 by Th3 Duk3 Link to comment Share on other sites More sharing options...
foamyesque Posted April 17, 2017 Share Posted April 17, 2017 (edited) What are you trying to attach this script to, and how? The doomstone? I'd set it up like so: DoomstoneTrophyScript extends ReferenceAlias ObjectReference Property EnableRef Auto bool bFired = false Event OnActivate(ObjectReference akActionRef) if !bFired if akActionRef == Game.GetPlayer() EnableRef.Enable() bFired = true endif endif EndEvent Then use quest aliases to attach the script to the doomstones, so you don't have to edit their forms. Fill in the property with what you want to enable. The OnActivate event will be fired whenever the player tries to use a doomstone, the bFired check will see whether the script has ever completed before, and the akActionRef check will make sure it's the player that did it (just in case). If all those conditions match, then it will enable the reference and change the flag to throw out any further activations. You could also use state changes so that after the first activation no future OnActivate events fire at all, but this script's simple enough and the checks fast enough that that's unnecessary. Edited April 24, 2017 by foamyesque Link to comment Share on other sites More sharing options...
Duk3nat0r Posted April 18, 2017 Author Share Posted April 18, 2017 I've placed duplicate doomstones as trophies in a player house that I want to show up after the player has activated them. I started with the scripts attached to the doomstones themselves, then later tried attaching the scripts to xmarkers as parents to them. I was able to make this work with the priest masks where when you entered the cell, the script would check to see if the priest is dead or not, and if it was, the xmarker would enable the mask display. Now I'm trying to do the same with the doomstones. The second script I listed, is the same one I used with the masks, only difference, instead of checking to see if the priest is dead, I want to check if the player has the magic effect of the doomstone. use quest aliases to attach the script to the doomstonesnot sure how to do this. Link to comment Share on other sites More sharing options...
foamyesque Posted April 18, 2017 Share Posted April 18, 2017 I've placed duplicate doomstones as trophies in a player house that I want to show up after the player has activated them. I started with the scripts attached to the doomstones themselves, then later tried attaching the scripts to xmarkers as parents to them. I was able to make this work with the priest masks where when you entered the cell, the script would check to see if the priest is dead or not, and if it was, the xmarker would enable the mask display. Now I'm trying to do the same with the doomstones. The second script I listed, is the same one I used with the masks, only difference, instead of checking to see if the priest is dead, I want to check if the player has the magic effect of the doomstone. use quest aliases to attach the script to the doomstonesnot sure how to do this. Create a quest. Then create however many aliases as there are doomstones, and add the script to each alias. Then set each alias to be filled by a specific doomstone using match type: forced (which will give you a cell/reference popup menu allowing you to select from among every reference in the game). Aliases of ObjectReferences are passed any events that fire for that object reference, so the script will then fire whenever the doomstone is activated. Note: The doomstones I am referring to here are the actual, working ones that you want to have trigger the display of your trophy duplicates. Those trophy ones will be specified via the script's property. Link to comment Share on other sites More sharing options...
Duk3nat0r Posted April 21, 2017 Author Share Posted April 21, 2017 (edited) Ok, I don't really know about quests, so let me make sure I understand correctly: The script will be attached to the allias in the quest, not the doomstone itself (that would be nice) I get how to set up the allias and know how a script can be attached to it, but I'm not sure how to set up the quest. At the moment I'm going through a few tutorials on quest, but my head is still spinning :sick: Just one stage: 0 ?And just allias' ?? Edited April 21, 2017 by Th3 Duk3 Link to comment Share on other sites More sharing options...
foamyesque Posted April 23, 2017 Share Posted April 23, 2017 (edited) Ok, I don't really know about quests, so let me make sure I understand correctly: The script will be attached to the allias in the quest, not the doomstone itself (that would be nice) I get how to set up the allias and know how a script can be attached to it, but I'm not sure how to set up the quest. At the moment I'm going through a few tutorials on quest, but my head is still spinning :sick: Just one stage: 0 ?And just allias' ?? That's correct; the script is attached to the quest alias, which means you don't need to edit the base doomstones at all (and if you have, run the mod through TESEdit to clean the unneeded changes). That way you don't interfere with anyone else who might want to do something with them. For this, you shouldn't need to bother with stages or anything particularly complicated. Tick Start Game Enabled, create an alias, attach the script to it, then use CTRL-D to duplicate it for however many doomstones there are. Then you point each alias at a different doomstone by choosing the Forced fill condition and selecting the doomstone. I find the cell/reference name lists easier and less error prone than horsing around with the cell render window when doing this. Then, for each alias, you'll need to modify the property in the attached script. There's only going to be one, and, as with the alias filling, it'll give you a cell/object reference list. Pick the thing you want to enable that matches with the doomstone you chose for that alias and hit OK.Then you'll probably want to rename the alias to something meaningful. You could just use Doomstone01 through DoomstoneXX, or you could name them specifically as LordStone, MageStone, ThiefStone, etc. Your call; all the game cares about is that they're distinct. What matters is you being able to parse them if you ever come back to this, or if you want to use those aliases in other scripts or quests for whatever reason. Edited April 23, 2017 by foamyesque Link to comment Share on other sites More sharing options...
Duk3nat0r Posted April 23, 2017 Author Share Posted April 23, 2017 Thank you foamyesque, thanks to you I learned something new. Kudos +1 Link to comment Share on other sites More sharing options...
Recommended Posts