Jump to content

Question about script: Detect Victim and if Actor is Player


egon123

Recommended Posts

Hello everyone!

I was working on my mod and encountered some problems.

 

I tried, when an animation is started to give the actors some faction which will open a new dialogue.

Basically that the npc remembers the sex and you can address it.

For that I wrote an detection script. But sex isn't just sex. There are many variables. Was the Player an actor? Was an creature involved? Was it rape or not?

Creature I solved in my test script. But Player and Rape gets more tricky.

 

First the script as it is now:

 

 

Scriptname Tif__SelfHook extends Quest


;---------------------------------------

SexLabFramework property SexLab auto
Faction Property DogFaction Auto
Tif__SelfDialogueMain Property SelfMain Auto
Actor Property PlayerRef Auto
;----------------------------------------------------------



event OnInit()
RegisterForModEvent("StageStart", "StartMessage")

endEvent





event StartMessage(string eventName, string argString, float argNum, form sender)
actor[] actorList = SexLab.HookActors(argString)
int stage = SexLab.HookStage(argString)




String spieler0 = actorList[0].GetLeveledActorBase().GetName()
String spieler1 = actorList[1].GetLeveledActorBase().GetName()
String spieler2 = actorList[2].GetLeveledActorBase().GetName()

actor Actor1 = actorList[0] as actor
actor Actor2 = actorList[1] as actor
actor Actor3 = actorList[2] as actor


int CreaZahl = SexLab.CreatureCount(actorList)

If Actor1.IsInFaction(DogFaction)
if (Actor2.GetActorBase().GetSex() == 1) && (Actor2 != playerref)
SelfMain.FuByDog(actor2)
Endif
if (Actor3.GetActorBase().GetSex() == 1) && (Actor3 != playerref)
SelfMain.FuByDog(actor3)
Endif

if (Actor2.GetActorBase().GetSex() == 1) && (Actor2 == playerref)
SelfMain.FuByDogPlayer(actor2)
SelfMain.FuByDogPlayerMarker(actor2)
SelfMain.FuByDogMarkerPlayerD(actor1)
Endif
if (Actor3.GetActorBase().GetSex() == 1) && (Actor3 == playerref )
SelfMain.FuByDogPlayer(actor3)
SelfMain.FuByDogPlayerMarker(actor3)
SelfMain.FuByDogMarkerPlayerD(actor1)
Endif
Endif

If Actor2.IsInFaction(DogFaction)
if (Actor1.GetActorBase().GetSex() == 1) && (Actor1 != playerref)
SelfMain.FuByDog(actor1)
Endif
if (Actor3.GetActorBase().GetSex() == 1) && (Actor3 != playerref)
SelfMain.FuByDog(actor3)
Endif

if (Actor1.GetActorBase().GetSex() == 1) && (Actor1 == playerref)
SelfMain.FuByDogPlayer(actor1)
SelfMain.FuByDogPlayerMarker(actor1)
SelfMain.FuByDogMarkerPlayerD(actor2)
Endif
if (Actor3.GetActorBase().GetSex() == 1) && (Actor3 == playerref)
SelfMain.FuByDogPlayer(actor3)
SelfMain.FuByDogPlayerMarker(actor3)
SelfMain.FuByDogMarkerPlayerD(actor2)
Endif
Endif
If Actor3.IsInFaction(DogFaction)
if (Actor1.GetActorBase().GetSex() == 1) && (Actor1 != playerref)
SelfMain.FuByDog(actor1)
Endif
if (Actor2.GetActorBase().GetSex() == 1) && (Actor2 != playerref)
SelfMain.FuByDog(actor2)
Endif

if (Actor1.GetActorBase().GetSex() == 1) && (Actor1 == playerref)
SelfMain.FuByDogPlayer(actor1)
SelfMain.FuByDogPlayerMarker(actor1)
SelfMain.FuByDogMarkerPlayerD(actor3)
Endif
if (Actor2.GetActorBase().GetSex() == 1) && (Actor2 == playerref )
SelfMain.FuByDogPlayer(actor2)
SelfMain.FuByDogPlayerMarker(actor2)
SelfMain.FuByDogMarkerPlayerD(actor3)
Endif
Endif


EndEvent

 

 

 

My questions:

 

1) How can I check if one of the actors is the player?

I tried it with "...&& (Actor2 == playerref )" and for not "...&& (Actor2 != playerref )"

For NPCs it worked. But with the player not. So I guess "...&& (Actor2 == playerref )" returns 0.

Seems like the wrong way to detect it. Someone got an idea?

 

2) How can I check if an actor is a Victim? Or if the animation counts as rape?

Basically, I need a way to ask sexlab this but I don't know how.

Without that the whole script becomes useless.

 

I hope someone with more experience can help me with that :)

Link to comment

Hello everyone!

I was working on my mod and encountered some problems.

 

I tried, when an animation is started to give the actors some faction which will open a new dialogue.

...

1) How can I check if one of the actors is the player?

I tried it with "...&& (Actor2 == playerref )" and for not "...&& (Actor2 != playerref )"

For NPCs it worked. But with the player not. So I guess "...&& (Actor2 == playerref )" returns 0.

Seems like the wrong way to detect it. Someone got an idea?

 

2) How can I check if an actor is a Victim? Or if the animation counts as rape?

Basically, I need a way to ask sexlab this but I don't know how.

Without that the whole script becomes useless.

 

I hope someone with more experience can help me with that :)

Current SexLab has events "Hook<EventType>", i.e. "HookAnimationStart"... Handler for this events has two parameters:

    RegisterForModEvent("HookAnimationStart", "AnimationStartHandler")
    ....
    function AnimationStartHandler(int tid, bool HasPlayer)
        ...
    endfunction

Parameter "HasPlayer" is self-explanatory. Via SexLab.GetController(tid) you receive current thread with ability to get actors, participating in animation (to check which is victim etc.) or everything you may need.

If you need to track every animation where player is envolved, use always available "PlayerTrack_<EventName>" events

    RegisterForModEvent("PlayerTrack_End", "MyPlayerSexEndHandler")
    ...
    function MyPlayerSexEndHandler(form akActor, int tid)
        ...
    endfunction

You has mentioned a faction. To track a faction's members animations:

    SexLab.TrackFaction(MyFaction, "MyFactionTrack")
    RegisterForModEvent("MyFactionTrack_End", "MyFactSLEnd")
    ...
    function MyFactSLEnd(form akActor, int tid)
        ...
    endfunction

See "SexLabFramework.psc", Ashal provided in comments great explanations about every function.

Just a small note: in your example you used "RegisterForModEvent" inside OnInit event. It's OK if your quest is started after each game load. In other cases you wil not catch events because RegisterForModEvent must be used on EVERY game load.

 

Kind Regards

Link to comment

 

 

 

Hello everyone!

I was working on my mod and encountered some problems.

 

I tried, when an animation is started to give the actors some faction which will open a new dialogue.

...

1) How can I check if one of the actors is the player?

I tried it with "...&& (Actor2 == playerref )" and for not "...&& (Actor2 != playerref )"

For NPCs it worked. But with the player not. So I guess "...&& (Actor2 == playerref )" returns 0.

Seems like the wrong way to detect it. Someone got an idea?

 

2) How can I check if an actor is a Victim? Or if the animation counts as rape?

Basically, I need a way to ask sexlab this but I don't know how.

Without that the whole script becomes useless.

 

I hope someone with more experience can help me with that :)

Current SexLab has events "Hook<EventType>", i.e. "HookAnimationStart"... Handler for this events has two parameters:



    RegisterForModEvent("HookAnimationStart", "AnimationStartHandler")
    ....
    function AnimationStartHandler(int tid, bool HasPlayer)
        ...
    endfunction

Parameter "HasPlayer" is self-explanatory. Via SexLab.GetController(tid) you receive current thread with ability to get actors, participating in animation (to check which is victim etc.) or everything you may need.
If you need to track every animation where player is envolved, use always available "PlayerTrack_<EventName>" events



    RegisterForModEvent("PlayerTrack_End", "MyPlayerSexEndHandler")
    ...
    function MyPlayerSexEndHandler(form akActor, int tid)
        ...
    endfunction

You has mentioned a faction. To track a faction's members animations:



    SexLab.TrackFaction(MyFaction, "MyFactionTrack")
    RegisterForModEvent("MyFactionTrack_End", "MyFactSLEnd")
    ...
    function MyFactSLEnd(form akActor, int tid)
        ...
    endfunction

See "SexLabFramework.psc", Ashal provided in comments great explanations about every function.
Just a small note: in your example you used "RegisterForModEvent" inside OnInit event. It's OK if your quest is started after each game load. In other cases you wil not catch events because RegisterForModEvent must be used on EVERY game load.

Kind Regards

 

 

 

 

Thank you for the answer and your help. I think I solved it :)

 

Problem 1 was stupid on my end. The check worked but I gave the wrong actor the faction. So the dialogue condition wasn't true.

 

Problem 2 took me some more work. But I think it works now :) Had to do much research since I'm not that experienced with scripts. But your post helped me. Especially the pointing to the SexLabFramework.psc.

 

Now I can expand the script :) Thanks again!

Link to comment

Archived

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

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use