Jump to content

[SOLVED] Noob Problem with Hooks


Recommended Posts

Posted

Hello everybody!

 

I have a little problem using hooks. I am new to modding and maybe someone can enlighten me.

 

So, I have a quest where the player talks to a farmer. After the dialogue ends, sex starts.

After the sexscene is finished, some stuff should happen. So I thought I try out hooks to do that since there is

stuff happening that shouldn't happen during the sexscene but after it finished.

 

In the Dialogue TopicInfo window I have a script which starts the sexscene after the dialogue ends.

The code for this looks like this.

Actor Property PlayerRef  Auto  
SexLabFramework Property SexLab  Auto  

;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akSpeakerRef)
Actor akSpeaker = akSpeakerRef as Actor
;BEGIN CODE
;
actor[] sexActors = new actor[2]
    sexActors[0] = PlayerRef
    sexActors[1] = akSpeaker

sslBaseAnimation[] anims
RegisterForModEvent("AnimationEnd_SexFarmer", "SexEnd")
;Start Sex
SexLab.StartSex( sexActors, anims, hook = "SexFarmer")

;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

The sexscene starts and ends and then nothing.

As I understand, the RegisterForModEvent Function looks for the AnimationEnd Event. Due to me adding the SexFarmer bit at the end it only gets the AnimationEnd event for my  "SexFarmer" Sexscene. Then I can use Event SexEnd to do some stuff at the end of the Animation.

 

So the code for the Event at the moment looks like this:

event SexEnd(string eventName, string argString, float argNum, form sender)
  	Debug.MessageBox("Test")
	UnregisterForModEvent("AnimationEnd_SexFarmer")
endEvent

After the sexscene ends there should be a messagebox pop up and say "Test". The problem is, it doesn't work. I am not sure where to put the event code. I tried to put it right after the Start Sex Function in the Dialogue Topic Window. When this didn't work I put the code in the Quest script (script tab in quest window) but it didn't work either.

I thought the AnimationEnd Event would always be recognized regardles where I put the event SexEnd code. Or did I forget something else?

 

 

 

EDIT: I started over again. Made a new quest and everything works. Don't know what went wrong because I used the same code again. Wrote a function for the sex to start and had the event in the same script. Then I called the startsex function from the dialogue and everything worked just fine.

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...