WaxenFigure Posted February 19, 2015 Posted February 19, 2015 I will skip the Actor theActor thingy for now. The script works now! Thanks again for your patience Now I am off to read more about triggering an animation with a follower when using another activator. So, I guess what I want to say is: I'll be back Have fun, seriously. Nothing makes the game more boring than turning it into a chore. Make sure it remains a challenge and fun.
Buddy Christ Posted February 19, 2015 Author Posted February 19, 2015 Oh it is so much fun, I mean it. First: Learning something new is always a great thing. Second: If it challenges me it is even better. Third: Having a place to ask stuff when I am stuck and getting help! And fourth: Trying to be kind of creative and eager to know what others think about my "work" is exciting. Sadly, I am a slow learner when it comes to learning by reading. But I don't have to have everything ready for my next update. Just a bit more clutter and the house is ready for the first release. Adding some more books to read and at the weekend I will upload it, I hope.
Buddy Christ Posted February 20, 2015 Author Posted February 20, 2015 Aaaaand here I am again I was considering a script that would allow the akActivator (mostly the player unless you tell one of your followers to use the Activator) to start a 2 person scene with one of the player's followers. I am stuck right now at how to actually make the script look for a follower in the vicinity. This is what I came up with so far (it compiles with the error that FollowerRef is not defined, which I wasn't surprised about, it is just a placeholder at the moment until I have figured out how to make the script check for available followers: Event onActivate(ObjectReference akActivator) Actor FirstActor = (akActivator as Actor) Actor SecondActor = (FollowerRef) SexLabUtil.QuickStart(FirstActor, SecondActor) EndEvent At the same time, I am trying to wrap my head around this: Actor[] function FindAvailablePartners(actor[] Positions, int TotalActors, int Males = -1, int Females = -1, float Radius = 10000.0) Because I have a hunch that this is needed to find another partner inside the house (even if there are only followers around). I am having a bit of trouble with understanding the practical application of this line. I guess that line would be helpful to start a masturbation animation if there is no partner around (for which I would include the TreatasFemale/Male as well), but I have no idea how to make sure how an "if no partner" line should look, I presume that the "int TotalActors" plays a role and that it includes the player, so it probably has to be something like "if TotalActors = 1 *the stuff to call up a masturbation animation* and an elseif that leads to the QuickStart. Do I need to create an array for the Actors first with this? Actor[] function MakeActorArray(Actor Actor1 = none, Actor Actor2 = none, Actor Actor3 = none, Actor Actor4 = none, Actor Actor5 = none) If so, then I have another thing I can't wrap my brain around And would it be advised to include the sort function, if "SecondActor" happens to be a male follower? Actor[] function SortActors(Actor[] Positions, bool FemaleFirst = true) Questions over questions I am probably looking at this too simple-minded and there is a lot more to it than I imagine....
Guest Posted February 20, 2015 Posted February 20, 2015 Hello GornGrimm, first of all you need to find the "follower(s)". If you rely only on vanilla followers then: ReferenceAlias Property Follower Auto Function whatever() SexLab.QuickStart(PlayerRef, Follower.getActorRef()) End Function And you have to set the property Follower as the Alias inside the Quest DialogueFollower. If you wish to support multiple follower, then the way to do it depends on the multi-follower mods yo wish to support. A generic way can be this one: Faction Property CurrentFollowerFaction Auto Race[] Property validHRaces Auto Actor Function getAFollower() Cell currCell = PlayerRef.GetParentCell() int i = currCell.GetNumRefs(62) as Int Actor[] AllFollowers = new Actor[4] ; "Max four, this number can be increased" int numFollowers = 0 while(i) i -= 1 Actor f = currCell.getNthRef(i, 62) as Actor if (f) if (!f.isDisabled() && (f.IsInFaction(CurrentFollowerFaction) || f.IsPlayerTeammate()) && f != PlayerRef && validHRaces.find(f.GetActorBase().GetRace()) != -1) ; "That's my follower" AllFollowers[numFollowers] = f numFollowers += 1 if (numFollowers >= 4) ; "Max 4" i = 0 EndIf EndIf EndIf EndWhile if (numFollowers == 0) return None ; "No follower available" endIf return AllFollowers[Utility.RandomInt(0, numFollowers - 1)] ; "pick a random one" EndFunction If the function returns "None" then no follower is available, if it is not None, then the actor is a valid follower (randomly chosen.) The property "ValidHRaces" has to be initialized manually, and then you can add all the races that will be good. Remember that by default, a Dog race can be a follower. You may want to exclude it. The function "SortActors" will try to put the actors in the correct positions depending on the sex, the "gender", and what is the position expected to have. Very good for straight sex. But it does not do miracles: you you pass two males, and the animation will be a blowjob, then one of the two will play the female role.
Buddy Christ Posted February 20, 2015 Author Posted February 20, 2015 Just as I thought, pretty naive thinking on my part Thank you again! I guess I will need some time to disect all of this and fiddle around with it. So I guess, you will have a break from me for a day or two
Buddy Christ Posted February 21, 2015 Author Posted February 21, 2015 After spending the whole evening trying to figure it all out, I realized that it probably is easier for me to make a script that checks for NPCs in general, not specific for followers (followers are regarded as NPCs, right?) That way I can use the script in different places without too much of a hassle. Since only the player and follower(s) are in the house it should work with them, right?
Guest Posted February 21, 2015 Posted February 21, 2015 Followers are NPC, yes. Just check that the Actors are not disabled. And maybe the race, creatures are NPC too.
WaxenFigure Posted February 21, 2015 Posted February 21, 2015 If this is in a player owned house then you could have adopted children present, their pet, a housecarl and not so obvious but a damn big nuisance mannikins are also possible problems. All those can be filtered out but you are now forewarned.
Buddy Christ Posted February 21, 2015 Author Posted February 21, 2015 It is a player owned house (or is supposed to be), but it is one I made and there is no room for children in it and no manniquins are placed. Since I would only put the activator for the script in places that I make myself, it shouldn't be a problem with the script. (I make a haphazard guess here.) The only NPCs in the house would be followers entering together with the player.
WaxenFigure Posted February 21, 2015 Posted February 21, 2015 That means you won't have to filter out so much then and the code will be cleaner and faster, right up to the point where people start asking you to add rooms for their adopted children and mannikins to dress up the place .
Guest Posted February 21, 2015 Posted February 21, 2015 Personally I prefer to filter on races. This will skip all the "child" races, the creatures, the mannequins, etc. The theRaces.find(actorBase.getRace()) is really fast. theRaces = Race[] actorBase is the ActorBase of the actor you are testing But of course it has a side effect: if somebody adds a new race, it will not be included in your animation...
Buddy Christ Posted February 22, 2015 Author Posted February 22, 2015 Hi, it is me again (Surprise!!!) Still wrapping my head around the whole NPC validating thing, so I thought, I should learn a bit more first. That is why I came up with the "great" idea of making an object "summon" an NPC that I created. (Actually I tried to make it with a spell first, but *poof* went my head again....) So I kind of cheated and placed the NPC inside the house as "disabled". Then I built an activator and attached a script that a] enables the NPC and b] starts a sex scene with him and the akActivator. I actually did some reading in Ashal's tutorials and I think I learned some stuff by now. The script compiled fine and it *kind of* works. It enables the NPC, but he starts to sandbox right away and sits down on a chair (in fact, the only usable chair at the moment in the house ) If I activate the object again, the sex scene starts. I have no idea why I have to activate the object a second time to start the scene. Maybe it is the order of the lines that prevents a direct "enable" and *bam here we go*? (Yeah, I am cheap, instead of plunging into the whole validate actor thingy, I took a short cut ) Scriptname SMUTSvenSummon extends ObjectReference SexLabFramework Property SexLab Auto Actor Property SMUTMaleMeat1 Auto Function onActivate(ObjectReference akActivator) actor[] sexActors = new actor [2] sexActors[0] = (akActivator as Actor) sexActors[1] = (SMUTMaleMeat1) SMUTMaleMeat1.enable() sslBaseAnimation[] anims SexLab.StartSex(sexActors, anims) Utility.Wait(100.0) SMUTMaleMeat1.disable() EndFunction I had the line "SMUTMaleMeat1.enable()" above "actor[] sexActors = new actor [2]" at first and changed it, because I thought that it might be the reason for his sitting down. But it seems like that was not it. He still does it. Another note: I want to disable the NPC afterwards again, because I don't want him to hang around the house. I used the value 100 for starters, since I am not sure, how long the animations normally run. At least I managed to write a script that compiled after a lot of trial and error and kind of works, which makes me a tiny bit proud Wouldn't have thought that I could manage that when I posted my first question here.
Guest Posted February 22, 2015 Posted February 22, 2015 Here some help, my friend. (Kamerad?) First actor.enable() requires time. If you enable it and then immediately start sex then Sexlab will not start a thread (and will provide a trace in Papyrus like "Blah, blah, blah -- They are not loaded" or "Blah, blah, blah -- They are dissabled") Quick trick: do a wait until the actor gets fully loaded (usually it is a fraction of second): While (SMUTMaleMeat1.isDisabled() || !SMUTMaleMeat1.Is3DLoaded()) Utility.wait(0.2) EndWhile To disable it at the end the "wait" is a really bad idea. You have no idea (not possible to know) how long the animation will last. There is a solution but it is a little bit more complicated than the super-easy "QuickStart" function from SexLab. You need to create a Thread and register for a mod event (Like AnimationEnd) and then disable your actor when this event is fired by SexLab. Here is an example: Scriptname SMUTSvenSummon extends ObjectReference SexLabFramework Property SexLab Auto Actor Property SMUTMaleMeat1 Auto Function onActivate(ObjectReference akActivator) actor[] sexActors = new actor [2] sexActors[0] = (akActivator as Actor) sexActors[1] = SMUTMaleMeat1 SMUTMaleMeat1.enable() While (SMUTMaleMeat1.isDisabled() || !SMUTMaleMeat1.Is3DLoaded()) ; "Let's wait him/her" Utility.wait(0.2) EndWhile sslThreadModel Thread = SexLab.NewThread() Thread.AddActor(sexActors[0]) Thread.AddActor(sexActors[1]) Thread.SetHook("ThatIsDone") RegisterForModEvent("OrgasmEnd_ThatIsDone", "EndSex") sslBaseAnimation[] anims ; "You can define your animations if you want..." Thread.SetForcedAnimations(anims) ; "...but if do not initialize the array, do not use these two lines" Thread.StartThread() ; "This will replace: SexLab.StartSex(sexActors, anims) " EndFunction Event EndSex(string eventName, string argString, float argNum, form sender) SMUTMaleMeat1.disable() EndEvent Of course you can use the name you want for the event (It is the "Hook") and you can ask for any stage of the animation (just check a Papyrus log to see all of them) Hope this helps.
WaxenFigure Posted February 22, 2015 Posted February 22, 2015 An additional note, you should have your Papyrus log turned on when testing and that is the first thing you ought to be looking at even if the test appeared to work. You want to make sure it all worked correctly and didn't have errors that will cause a problem later.
Buddy Christ Posted February 22, 2015 Author Posted February 22, 2015 Thank you both again! I knew my way was a bit over simplistic and it could cause some problems. Now I abandoned the whole "validate" stuff and have to dive into hooks And I acutally wondered why I had no traces in the papyrus logs. Turned out, I was using a profile in MO that had turned the log turned off Well, back to work on those scripts! *pushes sleeves up* ETA: Here some help, my friend. (Kamerad?)
Guest Posted February 22, 2015 Posted February 22, 2015 Here some help, my friend. (Kamerad?) Nein. I was born in Italy, lived all across Europe, married a Ukrainian lady, and now I am living in eastern US. But I always try to say some words in the language of the other.
Buddy Christ Posted February 22, 2015 Author Posted February 22, 2015 Ah, I see And I finally am almost happy with the way the mod works, I guess now I have to do a fade out screen and a fade in, so that NPCs not just appear without any effect. Or I might rework it in the future to actually make the activators cast a summoning spell with an appropriate magical effect. What started as a little "extra" for my book mod took a lot of time, I probably should return to writing some smut for a bit now. But fear not, I will bother you again, as soon as I decide to re-work the whole scripts again
Guest Posted February 22, 2015 Posted February 22, 2015 No problem my friend. Bug me anytime you want. I will always answer.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now