Jump to content

Welcome to LoversLab
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!

useful community scripts to start mods with


  • Please log in to reply
182 replies to this topic

#21
arelim

arelim

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts
How would I go about removing all items in the actors inventory except the stuff thats non-playable?

My guess is some kind of loop ... so pseudocoded something like : 'for each item in the inventory, if playable, remove item, else, do nothing.' ...

Is that the best way?
  • 0

AdBot

AdBot
  • Advert

#22
Slammer64

Slammer64

    The Old Man of the Forum

  • Contributor
  • PipPipPipPipPip
  • 1,778 posts
Many thanks Grumbler, I'm still a newb when it comes to Oblivion scripting, I didn't even know about that GetInventoryObject function. I'll try it and see.
  • 0

#23
gregathit

gregathit

    Duck and Cover

  • Moderators
  • 17,829 posts
Hello, I have what I hope is a fairly easy question to answer.......

Where can I find (and adjust) the script (assuming it is a script) that sets the sex pos groups?

Example - say I sneak up on someone to force them - how can I change which group of positions are used for "the act". What I would like to do is make a custom group (say 5 as I haven't seen that one used yet) and make that group fire when I rape someone (or get raped...:)).

Edit: I already know how to change the ini's to the new group I just can't figure out how to get it to accept and use that group.

2nd Edit: Found what I was looking for (thought I had seen it on this site :) )
http://www.loverslab...ad.php?tid=1204 post 2
  • 0

#24
BisquitsNgravy

BisquitsNgravy

    Member

  • Members
  • PipPipPip
  • 105 posts
I am hoping that someone can point me to an example of a script to change an npc's movement animations, specifically from default walking animations to a different set of animations temporarily.

Thanx in advance
  • 0

#25
galgat

galgat

    Mega Poster

  • Contributor
  • PipPipPipPipPip
  • 2,156 posts

I need a bit of scripting help myself, I need a sample script that gives me an idea how to handle adding a scripted token to an NPC via dialog and remove any other designated tokens at the same time. Like adding a wait token that calls a "Wait" script while removing a follow token that calls a "follow" script. Everything I have tried doesn't seem to work. I want to avoid putting anything in the result script box if I can, except for maybe adding the token in the first place. Any help would be appreciated, I just wish Oblivion scripting had an "if exists" function.

******************************************************

SCN TakeAllOfThisItemFromMe

Short HowMany
short doonce

BEGIN GAMEMODE

if doonce == 0 ;like if you only want to do this once

set set HowMany to [player-NPC].getitemcount [SomeItem]
[player-NPC].removeitem [SomeItem] HowMany ;this will remove all of that item
set doonce to 1 ;stop from endlessly repeating this action

endif
**********************************************************

I use this a lot, because sometimes through fat finger, or something I may allow an NPC or the PC to acquire more than one of the items, that I intended them to only have one of.


this little piece of scripting check to see how many they have, and removes all of them.


To make it work in the result box just drop the BEGIN Game Mode and the script name. and you would not need the doonce.
***********************************************

Short HowMany


set HowMany to [player-NPC].getitemcount [SomeItem]
[player-NPC].removeitem [SomeItem] HowMany
********************************************************
;this will remove all of that item, Kool thing is if they don'e have it, it won't ctd, or bother anything.
;note NPC must be Ref for NPC Not the NPC name you find in the editer and all NPC can be asigned a Reference ID.

;you can have 10 of the same guards in the game and give all of them a different Reference ID name, and that Ref will make each of them unique.

;you could have a check to see if they even have the item. Still all fitting in the result box
*************************************************
Short HowMany
if player.getitemcount [someItem] > 0


set HowMany to [player-NPC].getitemcount [SomeItem]
[player-NPC].removeitem [SomeItem] HowMany
endif

***********************************************

but you could also make the script, and use the call command to make it work, again in the result box.

*****************************************
ReferenceID.Call TakeAllOfThisItemFromMe 0
*********************************
script would look like this and need to ba a function
****************************************
SCN TakeAllOfThisItemFromMe

Short TakeAll ;with this you can change number, and have elseif to pick other Items
ref me

Begin Function { takeall )
set me to getself
if takeall == 0 ;for this item you would "ReferenceID.Call TakeAllOfThisItemFromMe 0" to call function
if Me.getitemcount [someItem] > 0


set HowMany to me.getitemcount [SomeItem]
me.removeitem [SomeItem] HowMany
endif
elseif takeall == 1 ;for this item you would "ReferenceID.Call TakeAllOfThisItemFromMe 1" to call function
if Me.getitemcount [someItem2] > 0


set HowMany to me.getitemcount [SomeItem2]
me.removeitem [SomeItem2] HowMany
endif
endif

END

*****************************************
; for the call command the do once again would probably not be needed..this requires OBSE

added to the script can also be such stuff ass


Additem [Whatever] [quanity]

example::: additem sword 1 or Player.additem sword 1 or NPC.additem sword 1



thing is there are many ways to add, and subtract items.. but if you want dialog to do it, then the script or call command must wind up in the results box.


  • 0

#26
BisquitsNgravy

BisquitsNgravy

    Member

  • Members
  • PipPipPip
  • 105 posts

I am hoping that someone can point me to an example of a script to change an npc's movement animations, specifically from default walking animations to a different set of animations temporarily.

Thanx in advance


Ignore this I figured it out on my own thanks anyway!
  • 0

#27
Slammer64

Slammer64

    The Old Man of the Forum

  • Contributor
  • PipPipPipPipPip
  • 1,778 posts
Many thanks for the help Galgat, I'll see what I can do with that.
  • 0

#28
ZaZ

ZaZ

    KinkAnimator

  • Contributor
  • PipPipPipPipPip
  • 1,770 posts

I am hoping that someone can point me to an example of a script to change an npc's movement animations, specifically from default walking animations to a different set of animations temporarily.

Thanx in advance


Ignore this I figured it out on my own thanks anyway!


Umm can U post the method U used thanx

  • 0

#29
fg109

fg109

    Member

  • Members
  • PipPip
  • 18 posts
@mastercchris

Not sure how BisquitsNgravy did it, but you can do the same by using the OBSE command "ToggleSpecialAnim". In your first post, you said that you wanted to enchant an item with something that would do that. It's possible to do it through enchantment, but I think it would be a lot easier to just use tokens, so that's what this script is for:

scn examplescript

ref actor

Begin OnAdd

	set actor to GetContainer
	actor.ToggleSpecialAnim "YourAnimFile.kf" 1
	actor.Update3D

End

Begin OnDrop

	actor.ToggleSpecialAnim "YourAnimFile.kf" 0
	actor.Update3D

End

Your animation file needs to be in the special animations folder.


@Slammer64

Galgat's examples work just fine, but they seem a little complicated for what you want done. You could do what you wanted by just using this:

scn examplescript

ref actor
short count

Begin OnAdd

	set actor to GetContainer
	
	set count to actor.GetItemCount YourItem1
	actor.RemoveItemNS YourItem1 count
	
	set count to actor.GetItemCount YourItem2
	actor.RemoveItemNS YourItem2 count
	
	;etc.

End


@arelim

Correct, you have to use some type of loop in order to do this. Example script for a spell:

scn examplescript

ref actor
ref item

Begin ScriptEffectStart

	let actor := GetSelf
	
	ForEach (item <- actor)
		if (item.IsPlayable2 == 0)
			item.RemoveMeIR
		endif
	loop

End

Not sure if that would work if you happen to have more than one for some of the unplayable items. I don't know if it will work, but you might have to change it to this:

scn examplescript

ref actor
ref item
short count

Begin ScriptEffectStart

	let actor := GetSelf
	
	ForEach (item <- actor)
		if (item.IsPlayable2 == 0)
			let count := actor.GetItemCount item
			actor.RemoveItemNS item count
		endif
	loop

End

  • 0

#30
(Donkey)

(Donkey)
  • Guests
Been doing some major script translation for rev 91. And this script was bit strange.

scn xLoversMainScriptStepWaitReady

;This script to allow wait function between various scripts. Makes sure wait is ready.
;Step1:

array_var ar
float passed

ref xme
ref zme
ref offence
ref defence

float f0

Begin Function { ar passed }

	;Added by Rev60 blockDelay ‚has been added
	;This makes sure you can't keep pressing block after an another.
	;Even if you do, it would not make a difference.
	if eval( ar["blockDelay"] > 0 )
		let ar["blockDelay"] -= passed
		return
	endif


	;Begins by declaring defender(zme) and attacker(xme) within an array 
	let xme := ar["xme"]
	let zme := ar["zme"]
	let offence := ar["offence"]
	let defence := ar["defence"]

;printC "xLoversMainScriptStepWaitReady: %n to %n" offence defence


	;Added by Rev63 KnockedState ‚if defender or offender side is concerned.
	if xme.GetKnockedState || zme.GetKnockedState
		if eval( ar["bpl"] )
			Message "’Offender or defender is currently in knocked state"
		endif
		let ar["xLoveStep"] := 4	;Lets array jump to step 4
		return
	endif


	;Added by Rev60 Check if both offender and defender is not in knocked state
;	if xme.GetKnockedState == 0
		set f0 to xme.GetAngle Z + xme.GetHeadingAngle zme
		xme.SetAngle Z f0
;	endif
;	if zme.GetKnockedState == 0
;		set f0 to zme.GetAngle Z + zme.GetHeadingAngle xme
;		zme.SetAngle Z f0
;	endif


	;Added by Rev60 Calls the scrip and either set it to offender or defender
	if Call xLoversPkrIsEquipFuncTarget xme
		return	;BLOCK
	endif
	if Call xLoversPkrIsEquipFuncTarget zme
		return	;BLOCK
	endif


	;Check delay and if time is passed
	;Added by Rev60 
	if eval(ar["checkDelay"] > 0)
		let ar["checkDelay"] -= passed
		if xme.GetKnockedState==0 && zme.GetKnockedState==0 && xme.IsOnGround && zme.IsOnGround	;; && xme.AnimPathIncludes "getupface"==0 && zme.AnimPathIncludes "getupface"==0
			let ar["checkDelay"] := 0	;END
		else
			return	;BLOCK
		endif
	endif


	;Advance to next step
	;Jump to next script
	let ar["xLoveStep"] += 1
	
End

Especially this part:

;Added by Rev60 Check if both offender and defender is not in knocked state
; if xme.GetKnockedState == 0
set f0 to xme.GetAngle Z + xme.GetHeadingAngle zme
xme.SetAngle Z f0
; endif
; if zme.GetKnockedState == 0
; set f0 to zme.GetAngle Z + zme.GetHeadingAngle xme
; zme.SetAngle Z f0
; endif


Could this be bug who slipped in ?? Should it not look like this instead ??

;Added by Rev60 Check if both offender and defender is not in knocked state
; if xme.GetKnockedState == 0
; set f0 to xme.GetAngle Z + xme.GetHeadingAngle zme
; xme.SetAngle Z f0
; endif
; if zme.GetKnockedState == 0
; set f0 to zme.GetAngle Z + zme.GetHeadingAngle xme
; zme.SetAngle Z f0
; endif


If this is the case that could be why some where reporting about knocked states keep appearing.
  • 0

#31
BisquitsNgravy

BisquitsNgravy

    Member

  • Members
  • PipPipPip
  • 105 posts

@mastercchris

Not sure how BisquitsNgravy did it, but you can do the same by using the OBSE command "ToggleSpecialAnim". In your first post, you said that you wanted to enchant an item with something that would do that. It's possible to do it through enchantment, but I think it would be a lot easier to just use tokens, so that's what this script is for:




Sorry it took me awhile to get back to this. I did mine through a scripted spell, actually two spells:

You won't want to use this as is because of the removeallitems statement.

scriptname a00BisSlaveBound

short updateCount
short Bound

Begin ScriptEffectStart
	removeallitems
	set Bound to 1
		SetRestrained 1
			ToggleSpecialAnim "BisWalkBackward.kf" 1
			ToggleSpecialAnim "BisWalk.kf" 1
			ToggleSpecialAnim "BisIdle.kf" 1
			ToggleSpecialAnim "BisFastForward.kf" 1
			ToggleSpecialAnim "BisTurnLeft.kf" 1
			ToggleSpecialAnim "BisTurnRight.kf" 1
		Update3D
		SetRestrained 0
	End
	

Begin ScriptEffectUpdate
  set updateCount to updateCount + 1
End





scriptname a00BisSlaveUnBound

short updateCount
short Bound

Begin ScriptEffectStart
	set Bound to 1
		SetRestrained 1
			ToggleSpecialAnim "BisWalkBackward.kf" 0
			ToggleSpecialAnim "BisWalk.kf" 0
			ToggleSpecialAnim "BisIdle.kf" 0
			ToggleSpecialAnim "BisFastForward.kf" 0
			ToggleSpecialAnim "BisTurnLeft.kf" 0
			ToggleSpecialAnim "BisTurnRight.kf" 0
		Update3D
		SetRestrained 0
	End
	

Begin ScriptEffectUpdate
  set updateCount to updateCount + 1
End


Hope this helps someone. Oh and BTW nice to see you here again Donkey!

  • 0

#32
BisquitsNgravy

BisquitsNgravy

    Member

  • Members
  • PipPipPip
  • 105 posts
Here is an example of the same spell as my last post except this one is timed and is a self spell. I know there are probably better ways to do this but I am learning kind of in a vacuum but I am slowly picking it up.


scriptname a00Bisonallfours

ref mySelf
ref EquippedItemr
short updateCount
short dropToFloor

Begin ScriptEffectStart
				set EquippedItemr to GetEquippedObject 13
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 16
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 20
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 18
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 19
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 21
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 2
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 3
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 4
				UnEquipItemNS EquippedItemr
				set EquippedItemr to GetEquippedObject 5
				UnEquipItemNS EquippedItemr
				set dropToFloor to 1
				mySelf.SetRestrained 1
				mySelf.ToggleSpecialAnim Bisbackward.kf 1
				mySelf.ToggleSpecialAnim Bisforward.kf 1
				mySelf.ToggleSpecialAnim Bisidle.kf 1
				mySelf.ToggleSpecialAnim Bisleft.kf 1
				mySelf.ToggleSpecialAnim Bisright.kf 1
				mySelf.ToggleSpecialAnim Bisturnleft.kf 1
				mySelf.ToggleSpecialAnim Bisturnright.kf 1
				mySelf.Update3D
				mySelf.SetRestrained 0
			End
	

Begin ScriptEffectUpdate
  set updateCount to updateCount + 1
End

Begin ScriptEffectFinish
	set dropToFloor to 1
		mySelf.SetRestrained 1
		mySelf.ToggleSpecialAnim Bisbackward.kf 0
		mySelf.ToggleSpecialAnim Bisforward.kf 0
		mySelf.ToggleSpecialAnim Bisidle.kf 0
		mySelf.ToggleSpecialAnim Bisleft.kf 0
		mySelf.ToggleSpecialAnim Bisright.kf 0
		mySelf.ToggleSpecialAnim Bisturnleft.kf 0
		mySelf.ToggleSpecialAnim Bisturnright.kf 0
		mySelf.Update3D
		mySelf.SetRestrained 0
  Message "Spell is finished. ScriptEffectUpdate was run %.0f times", updateCount
End

  • 0

#33
fg109

fg109

    Member

  • Members
  • PipPip
  • 18 posts
@Donkey

That part of the code only makes it so that the attacker (xme) will keep facing the defender (zme).

The only part of the script which deals with the messages is when either the attacker or defender is knocked down/out, and then it ups ar["xLoveStep"] to 4. After which, I assume that the function is no longer called so the message does not repeat itself.
  • 0

#34
ZaZ

ZaZ

    KinkAnimator

  • Contributor
  • PipPipPipPipPip
  • 1,770 posts
Thanx to fg109 and BisquitsNgravy

Will work on These tonite and let u guys know the progress ,
Will Post the anims too if they are worth it

Just wanna give back something to the community for creating awesome mods

Cheers

Edit

Tried Out fg109 Method Yea I needed the Equipment in conjunction with the Anims , Somehow its working for the player only not for NPC's Im Posting the Scripts

Spoiler


Spoiler

Spoiler


What Am I doin Wrong ....
Thanx In Advance
  • 0

#35
ZaZ

ZaZ

    KinkAnimator

  • Contributor
  • PipPipPipPipPip
  • 1,770 posts
After messing around with the scripts from BisquitsNgravy I got what i wanted to some extent
Although I Would Prefer an enchantment
But His Script Seems Like a Great way to test on NPC'S(Since I wanted to see from another perspective)

Had a Few CTD's With the spell Effects and Range settings( :P lol At one Point all the Npc's in IC market got the disired effect The game Couldn't handle it I guess)
So I Created the spell , added it to a merchant , Bought it , Cast the spell , Used MCS Follow order . ( Noobish Method I know :P)

Im Posting the Script In-case it will come handy for novice modders like myself.....

Thanx fg109 & BisquitsNgravy for the help .

Spoiler




A lil Tweaking is Remaining , Will Post when Its done .
  • 0

#36
Teechan

Teechan

    Plays With .KF

  • Members
  • PipPipPip
  • 117 posts
One thing that interested me the most was how LPK or plugin could allow you to adjust FOV before boinking, allowing one to see your character closer. Vanilla Oblivion resets the cam back to 75 FOV when in 3rd person or flying cam mode, but I'd like to be able to adjust FOV (to say, 35 or 25) in those modes.

I'm still going through the scripts to try and figure that out, but if anyone happens to know how I can get this to work as a spell or crystal ball, I'd be happy. :)


EDIT:

I realized I can get this to work with the console command "con_SetINISetting". Nevermind. :P
  • 0

#37
JairJy

JairJy

    Member

  • Members
  • PipPip
  • 17 posts
Hello people. I'm trying to make a kind of patch that resolves all the issues concerning graphic and roleplaying incompatibilities with Kou's Oblivion Trap Mod, that includes small changes to some mods like TrueCrime or LoversAdultPlayPlus.

Now I'm suck and I need your help. When a male is having sex, if the setting on Lovers and PK is adjusted to remove his clothes in the lower part of the body, Lovers and PK removes that cloth and changes the mesh from that part to ashardware1.nif (or asbonerhardnormalskin.nif, depending of the settings) so the man shows a boner, no matter if he is the attacker or the defender.

What I want to do is to configure Lovers and PK.esp to change this behavior only when the male is the defender, by do not change his Lowerbody.nif, so he can stay nude and with the original part of his body (without the boner). The problem is I can't find the script when this change occurs or is managed.

So, someone knows where I can change this? Thank you.
  • 0

#38
Justinof

Justinof

    Member

  • Members
  • PipPipPip
  • 209 posts
Good luck, there are many scripts involved.
I have made a research time ago about how futanari cocks are equipped, you may find some hints there.

http://www.loverslab...ad.php?tid=2322
  • 0

#39
legraf

legraf

    Member

  • Members
  • PipPipPip
  • 93 posts
I (and perhaps others) could use an example of how to gracefully swap information between separate .esp's. In particular, I'm looking for a way for .esp #1 to use a variable defined in .esp #2 if #2 is present, but not to choke and die if #2 is absent (and thus the variable is undefined).

Of course, the obvious places I've started are with IsModLoaded and GetFormFromMod, but I'm still stuck. Even though it's in a loop that'll never execute if .esp #2 isn't loaded (conditional on IsModLoaded), the CS Editor gripes if I simply use the variable's EditorID directly without loading up .esp #2 (of course). But if I do the following:

if IsModLoaded "esp2.esp"
	set refVar to GetFormFromMod "esp2.esp" "004cd4"
;004cd4 above points to a particular float in esp2
endif

How can I access the variable? I thought I'd be able to use the refVar directly in operations such as:
set tempfloat to refVar

but that fails. In fact I'm changing from a float to an integer, and in the example I'm trying the esp2 variable happens to be a global variable.

I can use reference variables, IsModLoaded and GetFormFromMod to access inventory objects or scripts in .esp #2, but not simple variables, consarnit.
  • 0

#40
wulfy1

wulfy1

    Member

  • Members
  • PipPipPip
  • 71 posts
Hi guys,

I have been looking all over but I cannot figure out how to award sex experience for any given action. For instance, the player finds a sexually oriented object out of 100 for use in a quest and you want to award that player experience for just finding the object. I'm not a scripter by any stretch of the imagination but I have a pretty big non-Lovers mod that I am converting to interface with Lovers

Thanks,
Wulf
  • 0