Roggvir Posted October 18, 2014 Posted October 18, 2014 I added player dialog choice to cast spell on NPC with this attached script: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment ;NEXT FRAGMENT INDEX 6 Scriptname RoggTestDlgChoiceScript Extends TopicInfo Hidden ;BEGIN FRAGMENT Fragment_5 Function Fragment_5(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE akActorA = Game.GetPlayer() akActorB = akspeaker akSpell.cast(akActorA, akActorB) ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment SexLabFramework Property SexLab Auto Idle[] Property CalmAnimations Auto Actor Property akActorA Auto Hidden Actor Property akActorB Auto Hidden SPELL Property akSpell Auto When the spell is cast, it runs this magic effect script: Scriptname RoggTestMagicEffectScript extends activemagiceffect SexLabFramework Property SexLab Auto Idle[] Property CalmAnimations Auto Actor Property akActorA Auto Hidden Actor Property akActorB Auto Hidden Event OnEffectStart(Actor akTarget, Actor akCaster) akActorA = akCaster akActorB = akTarget sslBaseAnimation[] Animations Animations = SexLab.GetAnimationsByTags(2, "Pillory,Vaginal,Aggressive,DomSub", "SubSub,Oral,Anal", true) sslThreadModel SexThread = SexLab.NewThread() SexThread.AddActor(akActorB, isVictim = true) SexThread.AddActor(akActorA) SexThread.SetAnimations(Animations) SexThread.SetBedding(0) SexThread.DisableRagdollEnd(akActorA, disabling = True) SexThread.DisableRagdollEnd(akActorB, disabling = True) SexThread.DisableLeadIn(disabling = True) SexThread.DisableBedUse(disabling = True) SexThread.DisableUndressAnimation(akActorB, disabling = True) SexThread.DisableUndressAnimation(akActorA, disabling = True) float[] posCorrection = new float[3] posCorrection[0] = akActorB.GetPositionX() - (22.5 * Math.sin(akActorB.GetAngleZ())) posCorrection[1] = akActorB.GetPositionY() - (22.5 * Math.cos(akActorB.GetAngleZ())) posCorrection[2] = akActorB.GetPositionZ() float[] angleCorrection = new float[3] angleCorrection[0] = akActorB.GetAngleX() angleCorrection[1] = akActorB.GetAngleY() angleCorrection[2] = akActorB.GetAngleZ() SexThread.CenterOnObject(akActorB) SexThread.CenterOnCoords(posCorrection[0], posCorrection[1], posCorrection[2], angleCorrection[0], angleCorrection[1], angleCorrection[2], true) SexLab.Log("ROGG: TEST 1") SexThread.RegisterForModEvent("StageEnd_RoggTest", "RoggTest_StageEnd") SexThread.SetHook("RoggTest") SexThread.StartThread() EndEvent Event RoggTest_StageEnd(string eventName, string strArg, float numArg, Form sender) SexLab.Log("ROGG: TEST 2") UnregisterForModEvent("StageEnd_RoggTest") EndEvent It seems that the RoggTest_StageEnd event handler is never called. I see the "ROGG: TEST 1" both in console and papyrus log file, the scene starts and plays, but i never see "ROGG: TEST 2" - not in console nor papyrus log. Also, i dont see any errors (related to my scripts) in papyrus log file (see attached file). I spent already many hours searching and reading, but i cant find out why, so any help would be much appreciated.
Ashal Posted October 18, 2014 Posted October 18, 2014 You are registering the thread for the event, so the thread is the one receiving it. SexThread.RegisterForModEvent("StageEnd_RoggTest", "RoggTest_StageEnd") ; // Change to... RegisterForModEvent("StageEnd_RoggTest", "RoggTest_StageEnd") Sidenote: Registered events will only last for as long as the form exists, in the case of active magic effects, it only exists for as long as the effect is active. So if the effect expires or has no duration, it will fail to call. So if you do not expect the magic effect to live long, it's better to register your events on a separate form, usually a quest script. Also those are the old hook system and considered deprecated, they'll still work for the foreseeable future, but I'd like to remove support for them at some point. The new hook system looks like this: Event OnEffectStart(Actor akTarget, Actor akCaster) ; // ... RegisterForModEvent("StageEnd_RoggTest", "RoggTest_StageEnd") ; // ... EndEvent Event RoggTest_StageEnd(string eventName, string strArg, float numArg, Form sender) sslThreadController SexThread = SexLab.HookController(strArg) EndEvent ; // CHANGE TO New style hooks: Event OnEffectStart(Actor akTarget, Actor akCaster) ; // ... RegisterForModEvent("HookStageEnd_RoggTest", "RoggTest_StageEnd") ; // ... EndEvent Event RoggTest_StageEnd(int ThreadID, bool HasPlayer) sslThreadController SexThread = SexLab.GetController(ThreadID) EndEvent
Roggvir Posted October 18, 2014 Author Posted October 18, 2014 Thank you very much for such swift reply. I hope it helps, saddly, i am now stuck on some quest dialogue problem (SEQ generated, quest running, yet dialog choices not shown). Will get back to confirm it works after i figure out the new problem.
WaxenFigure Posted October 18, 2014 Posted October 18, 2014 Thank you very much for such swift reply. I hope it helps, saddly, i am now stuck on some quest dialogue problem (SEQ generated, quest running, yet dialog choices not shown). Will get back to confirm it works after i figure out the new problem. Dialogue not showing is either incorrect conditions on the dialogue or other dialogue set on the subject that uses the "blocking" feature and has a higher dialogue priority.
Roggvir Posted October 19, 2014 Author Posted October 19, 2014 Thank you very much for such swift reply. I hope it helps, saddly, i am now stuck on some quest dialogue problem (SEQ generated, quest running, yet dialog choices not shown). Will get back to confirm it works after i figure out the new problem. Dialogue not showing is either incorrect conditions on the dialogue or other dialogue set on the subject that uses the "blocking" feature and has a higher dialogue priority. Or probably just a total lack of understanding how the dialogues work I am not creating a new NPC, i only want a few top-level topic lines the player can choose from when talking to any NPC (some conditions would be added later). So, i made a start game enabled quest (no conditions), added some player dialogue branch +topic +info (no conditions), and thought it should be shown for every NPC. The quest seems to be running (console command 'sqv' says so), yet i dont see it in my journal, and my player dialog choices are not shown for any NPC (tried almost anyone in Whiterun). And i did create the SEQ file, and i am using save made prior making this quest (saving into another slot to load the new save just to be sure). I guess there must be something wrong with my quest (even though it seems running, something is off). And when i added the very same topic and info to follower dialog, it shows, so no problem there i guess. EDIT: Missing dialogue topics solved Looks like there must be an NPC "response" for everything the player says, otherwise the choice wont show I noticed this was the only difference between the topics in my non working quest and those i tried before in follower dialog. Now if i could also get rid of the delay before the dialog closes after selecting a choice (thats why i removed the NPC response before - it was my attempt on removing this delay).
Recommended Posts
Archived
This topic is now archived and is closed to further replies.