Jump to content

Custom SL Hook


Recommended Posts

Posted

Hello. I’m trying to create a papyrus script with a custom hook, but it seems there is an error with “RegisterForModEvent”.

 

My code:

 

 

ScriptName aaaTest1 extends ObjectReference

 

Actor Property PlayerRef Auto
SexLabFramework Property SexLab Auto

;ObjectReference Property ItemRef Auto

Actor animActor

 

Event OnInit() ; This event will run once, when the script is initialized

EndEvent

 

Event OnActivate(ObjectReference akActionRef)

  TriggerSex(akActionRef as Actor)

EndEvent

 

Function TriggerSex(Actor akActor)

If SexLab.IsValidActor(akActor)

  ; create a new animation thread instance and store it in the "thread" variable
  sslThreadModel thread = SexLab.NewThread()

  ; add the actor
  thread.AddActor(akActor)

  string hook = "test1"
  thread.SetHook(hook)
 
  Debug.Notification("HookAnimationEnd_"+hook)
  RegisterForModEvent("HookAnimationEnd_"+hook, "AnimationEnd")
 
  thread.StartThread()

EndIf

EndFunction

 

event AnimationEnd(int ThreadID, bool HasPlayer)
Debug.Trace("AnimationEnd Event")
endEvent

 

 

All I get is an error:

 

 

[05/30/2015 - 12:00:49PM] Error: Unable to call RegisterForModEvent - no native object bound to the script object, or object is of incorrect type
stack:
[item 6 in container (000A2C94)].aaaTest1.RegisterForModEvent() - "" Line ?
[item 6 in container (000A2C94)]. aaaTest1.TriggerSex() - " aaaTest1.psc" Line 65
[item 6 in container (000A2C94)]. aaaTest1.OnActivate() - " aaaTest1.psc" Line 18

 

 

I checked other scripts, but I couldn’t find out what I’ve done wrong.

Any help would be much appreciated.

Posted

Though this might be a silly answer...is it the fact that the last line is endEvent instead of EndEvent? If that's the case then when it tries to call AnimationEnd in your RegisterForModEvent, it will run into errors.

I don't know if that helps...I really hope it does. I know nothing of Papyrus script. >_<

Posted

I don’t think that’s the problem. The compiler should notice wrong keywords.

But I noticed that other mods have similar errors. I really can’t imagine why this is happening.

 

 

[05/30/2015 - 01:50:50PM] Error: Unable to call RegisterForModEvent - no native object bound to the script object, or object is of incorrect type
stack:
[None].SOS_ActorMagicEffect_Script.RegisterForModEvent() - "" Line ?
[None].SOS_ActorMagicEffect_Script.OnEffectStart() - "SOS_ActorMagicEffect_Script.psc" Line 38
[05/30/2015 - 01:52:26PM] Error: Unable to call GetTargetActor - no native object bound to the script object, or object is of incorrect type
stack:
[None].CFEffectCreature.GetTargetActor() - "" Line ?
[None].CFEffectCreature.ChangeArousal() - "CFEffectCreature.psc" Line 167
[None].CFEffectCreature.OnEffectFinish() - "CFEffectCreature.psc" Line 43
[05/30/2015 - 01:52:26PM] Error: Cannot call GetRace() on a None object, aborting function call
stack:
[None].CFEffectCreature.ChangeArousal() - "CFEffectCreature.psc" Line 169
[None].CFEffectCreature.OnEffectFinish() - "CFEffectCreature.psc" Line 43
[05/30/2015 - 01:52:26PM] Error: Unable to call Dispel - no native object bound to the script object, or object is of incorrect type
stack:
[None].CFEffectCreature.Dispel() - "" Line ?
[None].CFEffectCreature.ChangeArousal() - "CFEffectCreature.psc" Line 232
[None].CFEffectCreature.OnEffectFinish() - "CFEffectCreature.psc" Line 43

 

Posted

Hmm...it seems to be saying that one of the parameters you put into RegisterForModEvent is wrong. I'm guessing it takes variables of type "event"...but what is "HookAnimationEnd_"+hook? It seems to be a string, unlike AnimationEnd. Or does RegisterForModEvent take parameters of type (string, event)?

I don't know if any of this helps, but I hope you can figure this out soon.

Archived

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

  • Recently Browsing   0 members

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