JetSteele Posted August 13, 2014 Share Posted August 13, 2014 Hi, I am making a custom (sort of) forge system to unlock powers that are found specifically in my mod. I am making it similarly to how the greybeards learn new words of power by meditating. Some background info. The player will unlock a spell that will allow him to meditate, when the player does this a forge system will open where he can "craft" the powers with unique ingredients found in the mod (soul fragment, dna, ect.) The forge system works fine but the second event to remove the "forge" once the player exits it doesn't fire. This issue leaves the furniture (marker) on the floor where any NPC can activate it. I used the power like crazy in whiterun market and when I went back there most of the NPC's were meditating. I know I could remove the furniture from sandbox but then if the player uses it enough times then there will be so many meditation spots in the world that will cause lag and possibly crashing. That said the forge works perfectly, the only issue is the second script doesn't fire when the player leaves the forge to remove it from the world which will also eliminate the chances of the power reacting badly with the game. Here is the script: Scriptname AdamantiumScript_MeditateMarker extends ObjectReference Quest Property AdamantiumDLCMeditate Auto Spell Property Meditate Auto Event OnActivate(ObjectReference akActionRef) Debug.MessageBox("Hello, world!") if ((akActionRef as Actor).GetSitState () >= 3) if ((akActionRef as Actor) == Game.GetPlayer()) (AdamantiumDLCMeditate as AdamantiumScript_MeditateQuestScript).GetUp() endIf endIf endEvent Event OnGetUp(ObjectReference akFurniture) Debug.MessageBox("Hello, world!") Cleanup() endEvent Function Cleanup() Debug.MessageBox("Hello, world!") Game.GetPlayer().DispelSpell(Meditate) Delete() endFunction Don't mind the debug.messagebox. That's only there because I want to see when it fires. If anyone wants to see the other two scripts (Quest and Magic Effect) that are connected to this then I could post them. But those ones work fine, its this one that I can't get working. Its the OnGetUp event that doesn't fire. Also I tried specifying what akFurniture was but I kept getting an error saying that ObjectReference can't be linked to Furniture. Anyways, anyone who can help is greatly appreciated. Sorry for the giant wall of text, just wanted to be as thorough as possible. Link to comment Share on other sites More sharing options...
Mattiewagg Posted August 13, 2014 Share Posted August 13, 2014 Sorry if I missed you explaining this, but what is the script attached to? Link to comment Share on other sites More sharing options...
JetSteele Posted August 13, 2014 Author Share Posted August 13, 2014 Furniture. Its a duplicate of the greybeards meditating seat Link to comment Share on other sites More sharing options...
Mattiewagg Posted August 13, 2014 Share Posted August 13, 2014 (edited) Furniture. Its a duplicate of the greybeards meditating seatI think I know the problem then. It's not firing because OnGetUp uses the reference the script is on for it - an actor. The furniture never gets up, so it won't work. So attach it to a PlayerAlias in a dummy script and it will fire when the player gets up. This will also allow you to use the If AkFurniture == MyObjRef condition. Edited August 13, 2014 by Matthiaswagg Link to comment Share on other sites More sharing options...
JetSteele Posted August 13, 2014 Author Share Posted August 13, 2014 ok but on the creation kit wiki it said that akfurniture was used for a specific object and I don't have that. The object is made when the spell is cast. The easiest way to explain this is: its like a conjuration spell. It makes the chair at the player and then needs to be deleted once the player is finished with it. Can I use OnGetUp if its on an object that needs to be made everytime you cast the spell or do I have to use another event? Maybe change Object Reference to Furniture and akFurniture to akActionRef? So it would look like this:Event OnGetUp(Furniture akActionRef)if akActionRef == Player... would that work? Link to comment Share on other sites More sharing options...
Mattiewagg Posted August 13, 2014 Share Posted August 13, 2014 (edited) ok but on the creation kit wiki it said that akfurniture was used for a specific object and I don't have that. The object is made when the spell is cast. The easiest way to explain this is: its like a conjuration spell. It makes the chair at the player and then needs to be deleted once the player is finished with it. Can I use OnGetUp if its on an object that needs to be made everytime you cast the spell or do I have to use another event? Maybe change Object Reference to Furniture and akFurniture to akActionRef? So it would look like this:Event OnGetUp(Furniture akActionRef)if akActionRef == Player... would that work?No. You could try something though. In the magic effect script that spawns the meditate thing, add a property called ObjectReference Property MyMeditateFurn Auto, and then set the cast furniture to that property through the script. Then you create a property in the alias script that references the other script, and call on the MyMeditateFurn property. I could explain this a lot better if you showed the script on your spell. Edited August 13, 2014 by Matthiaswagg Link to comment Share on other sites More sharing options...
JetSteele Posted August 13, 2014 Author Share Posted August 13, 2014 Scriptname AdamantiumScript_MeditationEnter extends activemagiceffect Conditional Quest Property AdamantiumDLCMeditate Auto Quest Property MeditateQuestBegin Auto Furniture Property MeditateMarker Auto Event OnEffectStart(Actor akTarget, Actor akCaster) if (akTarget == Game.GetPlayer()) (AdamantiumDLCMeditate as AdamantiumScript_MeditateQuestScript).GetUp() (AdamantiumDLCMeditate as AdamantiumScript_MeditateQuestScript).MeditateStart(MeditateQuestBegin) endif ((akTarget as Actor).PlaceAtMe(MeditateMarker, 1, true, false) as ObjectReference).Activate((akTarget as Actor), false) endEvent The archetype of the spell is set to script Link to comment Share on other sites More sharing options...
Mattiewagg Posted August 13, 2014 Share Posted August 13, 2014 (edited) Alright. Change the content of your player alias script to this: Adamantium_MeditationEnter Property ASME Auto; property name be whatever you want, but we're going with ASME cuz it's short ObjectReference MedMarker = ASME.MeditateMarker; this is just so we can refer to the chair faster- it's NOT a property, just a var Event OnGetUp(ObjectReference AkFurniture) If AkFurniture == MedMarker Debug.Messagebox("Player got up from MEDMARKER") Cleanup() EndIf EndEvent Function Cleanup() ;do your function stuff EndFunction That should work. If there's an error with setting the var, just get rid of the variable and use If AkFurniture == ASME.MeditateMarker instead of the one I wrote. And in your function where you use delete() do MedMarker.Delete() if using the var, or ASME.MeditateMarker.Delete(). Edited August 13, 2014 by Matthiaswagg Link to comment Share on other sites More sharing options...
JetSteele Posted August 13, 2014 Author Share Posted August 13, 2014 Compiling "AdamantiumScript_MeditateMarker"... C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AdamantiumScript_MeditateMarker.psc(8,33): no viable alternative at input 'ASME' C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AdamantiumScript_MeditateMarker.psc(8,37): required (...)+ loop did not match anything at input '.' C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AdamantiumScript_MeditateMarker.psc(8,16): Unknown user flag ASME No output generated for AdamantiumScript_MeditateMarker, compilation failed. I get this error when compiling the script with your changes and I get: cannot compare ObjectReference to furniture when compiling the script the second way you suggested Link to comment Share on other sites More sharing options...
Mattiewagg Posted August 13, 2014 Share Posted August 13, 2014 Compiling "AdamantiumScript_MeditateMarker"... C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AdamantiumScript_MeditateMarker.psc(8,33): no viable alternative at input 'ASME' C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AdamantiumScript_MeditateMarker.psc(8,37): required (...)+ loop did not match anything at input '.' C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\AdamantiumScript_MeditateMarker.psc(8,16): Unknown user flag ASME No output generated for AdamantiumScript_MeditateMarker, compilation failed. I get this error when compiling the script with your changes and I get: cannot compare ObjectReference to furniture when compiling the script the second way you suggestedTry doing If AkFurniture == ASME.MedMarker as Furniture Link to comment Share on other sites More sharing options...
Recommended Posts