Fienyx Posted September 4, 2014 Posted September 4, 2014 Thanks for trying to help. This is more than what my body is allowing me to handle. I can't read through the tutorial mem pointed out, although I had tried. Too much reading causing me too many migraines. Scripting is something I won't really be able to do. If it wouldn't be too much to ask, would someone care to tak this over? I have seen requests for this function which is why I tried. Probably dumb luck that I got see you sleep dll to work with PSE. That was a short script.
siskin Posted November 20, 2014 Posted November 20, 2014 You have two options for what you are trying to accomplish: 1) Use PSE as a Master. This means loading it in CSE at the same time as your plugin. Then you can change the if to: If IchSlaveQuest.PlayerEnslaved == 1 && [Same thing for aphro script].SexualDesire >= 76 && GetRandomPercent < 80 2) Without mastering PSE, find it with OBSE, assign it's quest to a reference and use it that way: ref rIchSlaveQuest set rIchSlaveQuest to GetFormFromMOD "PlayerSlaveEncounters.esp" "01B017" if eval ( GetVariable rTmp "PlayerEnslave" == 1 && GetVariable rAphroQuestName.SexualDesire >= 76 && GetRandomPercent < 80 The first method is much simpler, but restricts your addon to requiring PSE be installed or it won't even load.The second method is a little more complex, but can function with or without PSE ( Though the above will need an additional check to see if GetFormFromMOD succeeded ). Also you don't need to declare GetRandomPercent on it's own line before using. It is a function, not a variable. As for checking every few seconds, that will happen automaticaly with any quest script in a Begin GameMode block. The default is run the script every 5 seconds, you can change that with the fQuestDelay variable. Is there a similar way to check if NPC has an item(token) from another mod without creating dependency to that mod ? Also, Does LAPF have a function that returns if 2 characters are having sex? e.g. ref offender ref defender if XloversGetHavingSex(offender, defender) ;code if having sex else ;code if not having sex
WappyOne Posted November 20, 2014 Posted November 20, 2014 Is there a similar way to check if NPC has an item(token) from another mod without creating dependency to that mod ? Also, Does LAPF have a function that returns if 2 characters are having sex? e.g. ref offender ref defender if XloversGetHavingSex(offender, defender) ;code if having sex else ;code if not having sex 1) Same way: set rTmp to GetFormFromMOD "LoversBitch.esp" 022C03 ; xLoversBitchCanineSlotToken if ( IsFormValid rTmp ) if ( player.GetItemCount rTmp > 0 ) ; Code here will run if player has token indicating gone through Marae's initial bitch training. endif endif2) Yes, xLoversCmnGetPartner: if ( defender == Call xloversCmnGetPartner offender ) ;code if having sex else ;code if not having sex endif
siskin Posted November 20, 2014 Posted November 20, 2014 One more thing. You used 022C03 as xLoversBitchCanineSlotToken In CSE I see it as 03022C03 Can you confirm that my guess is right and the first 2 characters represent its position in the load order, and should be excluded from GetFormFromMOD calls ? Also, is this code corect ? ref nullref ref offender Set offender GetFirstRef 69 0 ;disregard the lack of calls to nextref in a loop, this is just an example if nullref == (Call xloversCmnGetPartner offender) ;this code is executed if offender is not having sex endif
WappyOne Posted November 20, 2014 Posted November 20, 2014 One more thing. You used 022C03 as xLoversBitchCanineSlotToken In CSE I see it as 03022C03 Can you confirm that my guess is right and the first 2 characters represent its position in the load order, and should be excluded from GetFormFromMOD calls ? Also, is this code corect ? ref nullref ref offender Set offender GetFirstRef 69 0 ;disregard the lack of calls to nextref in a loop, this is just an example if nullref == (Call xloversCmnGetPartner offender) ;this code is executed if offender is not having sex endif Yes, first two digits are load order and ignored if given to GetFormFromMOD since it is going to find it by name anyway. I thought you were asking for a check specific to two actors having sex together, which would use xLoversCmnGetPartner. If you want to check if an actor is having sex at all it is simpler and doesn't require a loop. Either check for existance of xLoversPkrIdentifier token (actor is having sex) or test Call xLoversCmnGetReady <refActor> (actor can start sex now, so not having sex, not dead, swimming, sitting, etc.).
siskin Posted November 21, 2014 Posted November 21, 2014 I was indeed asking if two actors are having sex, but as I started coding, I realised that my aproach would have produced horrible script load and want to use a more efficient method. I'm attempting to implement a fix that must work well with the original code. So I must check for xLoversPkrIdentifier. I need only if specifically in sex and no other case.
siskin Posted November 23, 2014 Posted November 23, 2014 I've tried to figure this out for the last 8 hours, but in the end I didn't succeed, so I'm asking for help. Why does it fail to get values/refs ? if (player.GetItemCount xLoversPkrIdentifier > 0);if player having sex... printtoconsole "Player having sex" set rTmp to GetFormFromMOD "LoversBitch.esp" "000ED9" ;xLoversBitchQuestScript if ( IsFormValid rTmp) PrintToConsole "Stolen quest ref from LoversBitch is valid with FormID %i" rTmp ; prints corect LoadOrderID + "000ED9" set partener to Call xloversCmnGetPartner Player ;PrintToConsole "Sex partener is %i" partener ; prints correct partner Set receivedDog to rTmp.GetRefVariable "playersDog" ; this leaves receivedDog as null. why ? PrintToConsole "ReceivedDog is %i" receivedDog ; prints refID 00000000 Set mytest to GetVariable "Version" rTmp PrintToConsole "Stolen variable from LoversBitch %x" mytest ; prints 0, so it also fails to retrieve value ;Set receivedDog to xLoversBitchQuest.playersDog ;this works but creates dependency PrintToConsole "playersDog is %n" receivedDog if partener == receivedDog ; ... with loversbitch companion... ;more code here endif endif endif
WappyOne Posted November 23, 2014 Posted November 23, 2014 I've tried to figure this out for the last 8 hours, but in the end I didn't succeed, so I'm asking for help. Why does it fail to get values/refs ? set rTmp to GetFormFromMOD "LoversBitch.esp" "000ED9" ;xLoversBitchQuestScript So close, yet so far. Variables are attached to the quest, not the script. Just like you use the quest name to get a varaible when accessing it directly ( set receivedDog to xLoversBitchQuest.playersDog ), you need to use Get(Ref)Var on the quest form, not the script form. This should work: set rTmp to GetFormFromMOD "LoversBitch.esp" "000ED7" ;xLoversBitchQuest
siskin Posted November 27, 2014 Posted November 27, 2014 I have 3 questions: 1) Is there a better way of detecting if the player is riding a horse than cycling through all actor refs in the cell and checking if reference.GetRider returns PlayerRef ? 2) Also, is there any way of detecting if player is sitting on a chair ? i can't find anything. 3) Is there a better way of dismounting and/or standing up from a chair than this? TapControl 4 ; Press Use and hope there isn't an npc in front of the player
movomo Posted November 27, 2014 Posted November 27, 2014 I have 3 questions: 1) Is there a better way of detecting if the player is riding a horse than cycling through all actor refs in the cell and checking if reference.GetRider returns PlayerRef ? 2) Also, is there any way of detecting if player is sitting on a chair ? i can't find anything. 3) Is there a better way of dismounting and/or standing up from a chair than this? TapControl 4 ; Press Use and hope there isn't an npc in front of the player 1. IsRidingHorse, maybe. 2. GetSitting, maybe. GetSitting also reports true when riding a horse. 3. Welp, sorry. But maybe. this_chair.Activate PlayerRef This should work unless the chair is scripted(not certain what's going to happen in that case), but I haven't tried this kind of thing before, so I can't tell how to figure out what's the chair reference that pc is currently using.I'd try walking through furniture references in the cell and pick the closest one. I mean, unless you find the proper method. That's a dirty hack you see.
siskin Posted November 27, 2014 Posted November 27, 2014 God. I searched for functions with names like those but didn't find anything. Next time I'll manually browse the wiki before asking a question... Regarding unsitting, yeah I'd prefer to stay away from dirty CPU consuming hacks, it's why I asked for a better way to detect riding as well. Thanks.
WappyOne Posted November 27, 2014 Posted November 27, 2014 You can try Player.SetAngle X -89 to force the player to look straight down before tapping use. Might need to wait a frame between SetAngle and TapControl.
emo877 Posted January 26, 2015 Posted January 26, 2015 (it isn't a question - just kind of complain and warning)Was making script for converting ~66% of actor's gold to "gold ingots" (one ingot for each 1000 gold), and found small "leakage" - it was removing more money than planned. Added debug printC and it's output surprised me. long var1 let var1 := getItemCount gold001 if 1500 < var1 let var1 /= 1500 ; later i added some fix here addItemNS goldIngot var1 ; result is ok let var1 *= 1000 removeItem gold001 var1 ; leakage! printC "converted %g gold" var1 endif With 4578 gold on input, it said: "converted 3052 gold".I had read somewhere what "all script variables are stored as float in savegames", and now i must suspect what any variable is calculating as Float, despite of variable type declared..And yes, script was fixed by adding Floor function (i wanted to write it in one line, let var1 := Floor(var1/1500), but it refuses parenthesis ). UPD: "in Oblivion, all longs are actually stored as floats, so they experience the same limitations as floats, and so cannot actually reach the ranges that a long should be able to reach (see the float article for more information on float's limitations; see the Discussion here for information on how this was discovered)"
Fienyx Posted January 26, 2015 Posted January 26, 2015 I really need to stop doing this to myself. I just wish I could give something back to the community. I greatly enjoy these mods, and try to make something nice, but due to medical reasons, only end up giving myself migraines and making myself physically ill. I was trying to make a check for LST and PSE to see if slaves / owners are flagged respawnable. The first script works for a no respawn token to add upon enslavement, then remove afterwards. Give to Owner for PSE, give to slave for LST scn NoRespawnToken begin onadd SetActorRespawns 0 end Here's my attempt at doing the check. I worked on this so long it literally made mr vomit. Hopefully someone can do something with it. (the failed script, not my vomit ) lol scn XLoversNoRespawnSlave ref actor ref rTmp begin gamemode get.IsModLoaded "LoversSlaveTrader.esp" "02001D24" ;xLoversSTQMainQuestScript if (get.IsModLoaded "LoversSlaveTrader.esp" "02001D24" == 1) && (actor == player) return elseif (get.IsModLoaded "LoversSlaveTrader.esp" "02001D24" == 1) actor.GetItemCount xLSTEnslaveToken if (actor.GetItemCount xLSTEnslaveToken == 0) actor.GetItemCount xlvrnrt if (actor.GetItemCount xlvrnrt ==0) return elseif (actor.GetItemCount xlvrnrt >0) set actor.GetItemCount xlvrnrt to 0 elseif (actor.GetItemCount xLSTEnslaveToken > 0) get.IsActorRespawning if (get.IsActorRespawning == 1) actor.additem xlvrnrt ;lovers no respawn token elseif (get.IsActorRespawning == 0) return endif endif endif get.IsModLoaded "PlayerSlaveEncounters.esp" "2021B018" ;IchPlayerSlaveQuestScript if (get.IsModLoaded "PlayerSlaveEncounters.esp" "2021B018" == 1) set rTmp to GetFormFromMOD "PlayerSlaveEncounters.esp" "2021B018 if (get.IsModLoaded "PlayerSlaveEncounters.esp" "2021B018" == 1) && (actor == player) return elseif (get.IsModLoaded "PlayerSlaveEncounters.esp" "2021B018" == 1) rTmp.OwnerRef if OwnerRef.IsActorRespawning == 1 actor.additem xlvrnrt elseif OwnerRef.IsActorRespawning == 0 actor.GetItemCount xlvrnrt if (actor.GetItemCount xlvrnrt ==0) return elseif (actor.GetItemCount xlvrnrt > 0) setactor.GetItemCount xlvrnrt to 0 endif endif endif end
emo877 Posted January 27, 2015 Posted January 27, 2015 @fienyx: Your code looks very unfamiliar for me (like if it's another game script language). I'll take some time to prepare my version (based on mem4ob4's solutions for plugin intercourse, implemented in PlayerSlaveCry - you are welcome to peek inside it too - it detects wanted mod under any name and accesses to it's objects; learning on other's working code is my old habit). If i understand correctly, xlvrnrt is your token - and task is to find correct reference to person; cause i have no LST, will deal only with PSE part - get access to SlaveOwner ref. Should return tomorrow.
Fienyx Posted January 27, 2015 Posted January 27, 2015 Yes, xlvrnrt is the no respawn token. With PSE I was trying to check for the owner. That same method should also work to check the enslaved npc in LST. My hope was to make the plugin check for either mod, and fully allw enslaving / being enslaved by any npc. I was studying other peoples scripts. My medical condition (multiple sclerosis) causes issues when I read too much, or even have to concentrate on something new. Sucks, I always liked learning new things and had hoped to learn this. Too bad my body basically tells me no. If you can get this to work the way I imagined it with no masters other than probably the lovers esm and oblivion esm, that would be great. I know a lot of people would be greatly appreciative.
emo877 Posted January 28, 2015 Posted January 28, 2015 Well, mod detection part looks working (because it is 100% copy of the same part of PlayerSlaveCry - verification based on knowing some cloth item id and checking it's model path as addittional proof); in commented part i tried more straight approach, checking quest variable requested in your task exactly, but it failed: it barked on wrong mod which had some ref the same id, and "HasVariable" check did not fired (as if all was right). Hope I'll learn correct method for quest variable access in future. ; quest-script, with default period 5sec. short var1short string_var var1str ref var1ref ref var2ref ref var3ref begin menumode 1 if getGameLoaded || GetGameRestarted let var1short := GetNumLoadedMods while 0 < var1short sv_Destruct var1str let var1short -= 1 let var1str := GetNthModName var1short ; let var1ref := GetFormFromMod $var1str "01B017" ; IchSlaveQuest id ; if\elseif (hasVariable "OwnerRef" var1ref)...\endif ; found unreliable let var1ref := GetFormFromMod $var1str "04DB1B" ; one of PSE' slave ballgags if (0 == IsFormValid var1ref) elseif (IsBipedModelPathValid 1 var1ref) let var1ref := GetFormFromMod $var1str "01B017" ; IchSlaveQuest if (IsFormValid var1ref) let var1short := -3 ; found mod and ref for endif endif loop if -3 == var1short printC "877findPSEownerREF: looks like PSE mod is found under name %q%z%q." var1str else printC "877findPSEownerREF: failed to found reliable PSE mod." endif endif end Next part is a bad news: after checking part reported "ok" (my flag in var1short become -3), gamemode part did nothing (as if no owners were at all). ; next part of the same script begin gamemode if -3 == var1short let var2ref := GetRefVariable "OwnerRef" var1ref if (0 == isFormValid var2ref) ; strange\invalid owner - do nothing.. elseif (var2ref.isActor) && (var2ref != var3ref) let var3ref := var2ref if (IsActorRespawning var2ref) printC "877findPSEownerREF: our new slaveOwner, %n is respawning. Shold we give him something?" var2ref ; var2ref.addSpell emo877hateSlavers else printC "877findPSEownerREF: %n, our new slaveOwner, is not respawning! Lucky us.." var2ref ; var2ref.addSpell emo877hateSlavers endif endif endif end Lately i thought - i'm not sure, if testing was correct: in purpose to got quick results, i used "enslave me" spell on town people, and it worked - but there was not "inventory sack" at the place of enslavement, which typicaly pops when "normal" (due gameplay) enslavement i got. With that consideration, "no owners" result is not final.. May be, it should be tested with more "natural" situations (and with more debug prints here and there). UPD (jan29) - failed to get proper OwnerRef in more thorough test serie ("real combat enslavement") last night; debug messages tell "owner ref variable is valid". Now i have googled\collected more other people discursions about "mod interacting", will read later (now@work, can't concentrate). ps. after friday i'll be off some time.
emo877 Posted January 30, 2015 Posted January 30, 2015 Kind of success, but i feel no proud somehow. Used some 'magical' command:runScriptLine "set z877findPSEownerQuest.var1short to IchSlaveQuest.EscapeEase"(from console log)877findPSEownerREF: internal PSE variable "playerEnslaved" is -6 now).877findPSEownerREF: should new slaveOwner, creature Sanctified Dead, be something special?full script body scn findPSEownerREFqs short var1short string_var var1str ref var1ref ref var2ref ref var3ref begin menumode 1 if getGameLoaded || GetGameRestarted let var1short := GetNumLoadedMods while 0 < var1short sv_Destruct var1str let var1short -= 1 let var1str := GetNthModName var1short ; let var1ref := GetFormFromMod $var1str "01B017" ; IchSlaveQuest ; elseif (hasVariable "OwnerRef" var1ref) ; found unreliable let var1ref := GetFormFromMod $var1str "04DB1B" ; one of PSE' slave ballgags if (0 == IsFormValid var1ref) elseif (IsBipedModelPathValid 1 var1ref) let var1ref := GetFormFromMod $var1str "01B017" ; IchSlaveQuest if (IsFormValid var1ref) let var1short := -3 ; found mod and ref for endif endif loop if -3 == var1short ; let var1ref := GetFormFromMod $var1str "01B018" ; IchSlaveQuestScript if (1 == hasVariable "OwnerRef" var1ref) ; this check seems unreliable printC "877findPSEownerREF: looks like PSE mod is found under name %q%z%q." var1str else printC "877findPSEownerREF: looks like PSE mod is found under name %q%z%q (but variable OwnerRef is questionable)." var1str endif runScriptLine "set z877findPSEownerQuest.var1short to IchSlaveQuest.EscapeEase" if (0 > var1short) printC "877findPSEownerREF: failed to get internal PSE variable)." else printC "877findPSEownerREF: internal PSE variable %qescape easy%q is %g now)." var1short let var1short := -3 ; should have more service vars runScriptLine "set z877findPSEownerQuest.var1short to IchSlaveQuest.PlayerEnslaved" if (0 <= var1short) printC "877findPSEownerREF: internal PSE variable %qPlayerEnslaved%q is %g now)." var1short let var1short := -3 ; should have more service vars endif endif else printC "877findPSEownerREF: failed to found reliable PSE mod." endif endif end begin gamemode if -6 == var1short let var1ref := GetFormFromMod $var1str "01B017" ; IchSlaveQuest ; let var1ref := GetFormFromMod $var1str "01B018" ; IchSlaveQuestScript ; let var2ref := GetRefVariable "OwnerRef" var1ref let var2ref := 0 runScriptLine "set z877findPSEownerQuest.var2ref to IchSlaveQuest.OwnerRef" if (0 == isFormValid var2ref) ; strange\invalid owner - do nothing.. elseif (var2ref == var3ref) ; the same owner - do nothing.. elseif (var2ref.isCreature) let var3ref := var2ref printC "877findPSEownerREF: should new slaveOwner, creature %n, be something special?" var2ref elseif (var2ref.isActor) let var3ref := var2ref if (IsActorRespawning var2ref) printC "877findPSEownerREF: our new slaveOwner, %n is respawning. Shold we give him something?" var2ref var2ref.addSpell emo877hateSlavers else printC "877findPSEownerREF: %n, our new slaveOwner, is not respawning! Lucky us.." var2ref var2ref.addSpell emo877hateSlavers endif endif elseif -1 > var1short runScriptLine "set z877findPSEownerQuest.var1short to IchSlaveQuest.PlayerEnslaved" if 0 == var1short let var1short := -3 else let var1short := -6 ; player enslaved printC "877findPSEownerREF: internal PSE variable %qplayerEnslaved%q is %g now)." var1short endif endif end Remark: search on that command (runScriptLine) in various mods i have bring very interesting pieces of code which dramaticaly extend my picture of modding tricks, definitely worth to learn. But i can suspect it can hit code execution speed (also dramaticaly). For example, in LoversRapers-RR (untranslated from japanese yet) such command issued in massive quantities to control actor's face\emotion(!).
mem4ob4 Posted March 10, 2015 Posted March 10, 2015 A quick function to determine facing of player and actor within +-45 deg.( face to face, front to back, etc.)Can be used to select context specific comments or vulnarability.Example: Player is walking with a guard on patrol behind them. A scan picks up the guard as in rangeand calls this function determining that it is position #2 (guard facing player back). The scan function,or another function/questscript can call a specific rRef.StartConversation rRef RandomNiceAsscomment scn PAfacing float PCangle ;Player z angle float Refangle ;Refs z angle float Faceangle ;diff of PC and Ref angle float Headangle ;Player heading angle short sFacing ;1=PC and Ref facing each other 2=Ref is facing PC back 3=PC is facing Ref back ref rRef ; ref selected from a scan function to find nearest actor (within a designated distance) Begin Function {rRef} set PCangle to Player.GetAngle z set Refangle to rRef.GetAngle z set sFacing to 0 if PCangle == Refangle ;both facing same direction set Faceangle to 0.0 else ; find the diff of the angles and adjust to positive angle < 180 if PCangle < Refangle set Faceangle to Refangle - PCangle else set Faceangle to PCangle - Refangle endif if Faceangle > 180.0 set Faceangle to 180.0 - ( Faceangle - 180.0 ) endif endif set Headangle to player.GetHeadingAngle rRef if Headangle < 45.0 && Headangle > -45.0 ;ref is infront of player if Faceangle < 45.0 ;player face back of Ref set sFacing to 3 elseif Faceangle > 135.0 ;face to face set sFacing to 1 endif else if Headangle > 135.0 || Headangle < -135.0 ;ref is behind player if Faceangle < 45.0 ;ref face player back set sFacing to 2 endif endif endif SetFunctionValue sFacing end
emo877 Posted March 25, 2015 Posted March 25, 2015 (line 23 of your code) if Faceangle > 180.0 set Faceangle to 180.0 - ( Faceangle - 180.0 ) endif If i understand correctly, that code (i'd simplified it to 360 - Faceangle) have purpose to keep value in range {-180; +180}, but i think, correct formula for that is Faceangle := Faceangle - 360 (or, shorter, Faceangle -= 360). For example, if Faceangle is 225°, this formula will give us -135° (not +135°!). Also, it seems useful to add input ref check by isFormValid, just to keep your code-followers vigilant Good luck! ps. my online access is very rare & random at these days, so i want to beg pardon if i will not able to read and reply in appropriate time.
mem4ob4 Posted March 25, 2015 Posted March 25, 2015 Faceangle needs to be range = 0..180 (positive number) for this particular application.Agreed, checking for valid ref is a good safety check, but can be done as a condition to calling the function. Mem
emo877 Posted March 27, 2015 Posted March 27, 2015 Oops, i had to read all code before make nitpick. Now it seems i understand the task ..(upd: wrong use of abs, see below) short sFacing ref rRef Begin Function {rRef} let sFacing := -1 if isFormValid rRef let sFacing := 0 if 45 > abs rRef.GetHeadingAngle Player let sFacing += 1 ; elseif 95 > abs rRef.GetHeadingAngle Player ; let sFacing += 4 endif if 45 > abs Player.GetHeadingAngle rRef let sFacing += 2 ; elseif 95 > abs Player.GetHeadingAngle rRef ; let sFacing += 8 endif endif SetFunctionValue sFacing ; result value: 0= any other position variant, -1= invalid ref, ; 3= both are facing each other, 2= player is facing to ref's back, 1= ref is facing to pc' back. ; more variants can be added as shown in commented sections -- for angle values used, ; option adds "sidelong glance" areas (i'm not sure i use right words): ; 4(ref is sided to pc's back), 6(ref is sided to pc's face), ; 8(pc is sided to ref's back), 9(pc is sided to ref's face) and 12(side by side). end UPD(mar30): first time my CS crashed on script compilation, ever. It seems, Abs function can deal with bare variable only (no crash, compiled ok). float rpAng float prAng short sFacing ref rRef Begin Function {rRef} let sFacing := -1 if isFormValid rRef let sFacing := 0 let rpAng := rRef.GetHeadingAngle Player if 45 > abs rpAng let sFacing += 1 ; elseif 95 > abs rpAng ; let sFacing += 4 endif let prAng := Player.GetHeadingAngle rRef if 45 > abs prAng let sFacing += 2 ; elseif 95 > abs prAng ; let sFacing += 8 endif endif SetFunctionValue sFacing end
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