Jump to content

useful community scripts to start mods with


Guest Donkey

Recommended Posts

Guest Donkey

Post any cool,useful or just curious script you know.

 

If you are good scripting and don't mind releasing some for the community,please post your scripts here.

 

I have seen a similar post like this in the mount and blade boards and thought we could really use one for Oblivion as well. for Oblivion.

 

Not everyone is good at scripting, but are better in other areas. This could enhance there mods in a major way..

 

Since most mods for lovers requires lot's of scripts this could actually make that barrier simpler if they could have one place to start there search.

Link to comment
Guest Donkey

Well not really for me, but someone starting out modding will mostly needs script witch could be way over his or her head. This will mostly be basic. To get you starting out.

 

If you look at the lovers structure, they make use of heavy scripting already. So if you want to creating anything funny for a lovers plug-in not only do you need scripts, but also understanding how they function in-game.

Link to comment

Well basic:

like spell on target or touch

 

scn aLoversTestSpell

int foff ;nude bits

int fdef ;nude bits

ref tar ;actor1

ref me ;actor2

 

begin scripteffectstart

set tar to player

set me to getself

if Call xLoversCmnIsReady tar ; ready or not sub function LPK

if Call xLoversCmnIsReady me ; ready or not

 

Let foff := 8+1024 ;nude bits (head, arms etc see in obse help)

Let fdef := 8+1024 ;nude bits (head, arms etc see in obse help)

set xLoversQuest.Offence to tar;

set xLoversQuest.Deffence to me

 

set xLoversQuest.SPos to 1 ;pose number

 

set xLoversQuest.OffNudeFlag to foff    ;nude

set xLoversQuest.DefNudeFlag to fdef  ;nude

 

tar.Call xLoversMainSafeStart ;start sex on tar(player) point

endif

endif

end

Link to comment
  • 2 weeks later...
  • 3 weeks later...
Guest Donkey

Anyone know any sample script how those mounting horses works ?? i tried the one from vanilla game but somehow i can't mount my horse. The button does not work.

 

never mind got it to work..  :P

Link to comment
Guest Donkey

Here is useful one

;LoversCreaturesBedSafeStart
SCN xLoversCBStartSEXonBedR

; Option
; spos (short):

ref bed					;ref bed
ref me					;ref me
ref plr					;ref plr
long meZ				;long meZ
long plrZ					;long plrZ
short spos				;short spos
short lcir1				;shor lcir1
short lcir2				;shor lcir2
long percent			;long percent

Begin function { spos }

set plr to player																			; plr Player
set me to GetSelf																		; me Object RefID
set xLoversQuest.SPos to spos														; Lovers spos
set percent to GetRandomPercent													; percent 0-99

set plrZ to plr.Getpos z																; plrZ Player
set meZ to me.Getpos z																; meZ Object Z

if plrZ - MeZ >= 10 || plrZ - Mez <= -10										; plr me Z 10
set percent to 1																		; percent 1
endif

if percent < 50																			; 50% 
let bed := Call xLoversCmnGetUsableNearestBed plr me 500 0		; 、
if bed																						; bed
	set xLoversQuest.ExtFlag to 1												; Lovers 
	set xLoversQuest.ExtRef to bed												; Lovers RefID
endif
endif

Let lcir1 := Call xLoversCmnIsReady me
Let lcir2 := Call xLoversCmnIsReady plr

if lcir1 ==1 && lcir2 ==1																; xLoversCmnIsReady 
Call xLoversMainSafeStart															; 
endif

RemoveMe																					; 

End

 

This is the script for bed. and regular one. If you want to use it. use the call function like this Call xLoversCBStartSEXonBedR 1

 

This will call the above script so if you are like me and make a menu all you have to do. use this:

 

Call xLoversCmnInitQuestInterface

set xLoversQuest.offence to GetSelf

set xLoversQuest.defence to Player

call xLoversCBStartSEXonBedR 1

If you want the player to take charge turn the above around player to offence and Getself to defence. That will make sure you will Be the aggressor.

Link to comment
  • 1 month later...

Donkey' date=' could you please unban Destrocto\'s IP and account I\'m sorry for what I said, It was rude and uncalled for and I shouldn\'t of acted like another trolling douche who likes starting flame wars. 

Sincerest apologies from Destrocto.

[/quote']

 

I've unbanned it.

Link to comment

  this is mostly for new modders..

 

Lots of times you may want with dialog to do a bunch of things in the result box

 

example

 

set takeall to player.getitemcount 001CRsexslime

player.removeitemNS 001CRsexslime Takeall

set takeall to player.getitemcount Crelfhatecap

player.removeitemNS Crelfhatecap takeall

set takeall to player.getitemcount 001crgtsgreefring

player.removeitemNS 001crgtsgreefring takeall

set MixPotion to 0

 

I know poor example

 

any way result box is small, and troublesome to work with, i mean this will work, but.

 

instead in quest script make a short like " doall "

 

short doall

 

then add these lines in quest script

 

if doall == 1

set takeall to player.getitemcount 001CRsexslime

player.removeitemNS 001CRsexslime Takeall

set takeall to player.getitemcount Crelfhatecap

player.removeitemNS Crelfhatecap takeall

set takeall to player.getitemcount 001crgtsgreefring

player.removeitemNS 001crgtsgreefring takeall

                        setstage myquest 15

set MixPotion to 0

                        set doall to 0 ; set it right back to 0 you can call it with 1 again if needed

endif

 

now all you have to add to the result box in dialog is

 

set myquest.doall to 1

 

Quest scripts are very dependable as opposed to other things in the game

so this works very well.remember if you do a "setstage myquest" or "messagebox" do it at the bottom of the list.

 

Example

 

if doall == 1

set takeall to player.getitemcount 001CRsexslime

player.removeitemNS 001CRsexslime Takeall

set takeall to player.getitemcount Crelfhatecap

player.removeitemNS Crelfhatecap takeall

set takeall to player.getitemcount 001crgtsgreefring

player.removeitemNS 001crgtsgreefring takeall

set MixPotion to 0

                        set doall to 0 ; set it right back to 0 you can call it with 1 again if needed

                        Messagebox"fuck all this shit"

endif

 

Messagebox's act like a return, and everything after them will not get done, most of the time.

 

I know not much of a tip, but maybe it will help a few people.

 

Link to comment
  • 2 weeks later...
Guest syrevo

Hello Everyone

 

First sorry about my bad English

 

I need help with a script which should allow the player when a key pressed on keyboard to switch between all NPC and creature references within a specific distance or number of cells and play some shader effect on the selected reference.

each time the key pressed then the script should move to a new reference cycling between them.

I tried to write the script my self as i do write some scripts but never succeeded creating a script contains (GetFirstRef) and (GetNextRef), it always end with a script error.

 

Please help, i tried construction set wiki to learn how to use both functions but not enough explanation regarding these two functions.

Link to comment

It's probably a better idea to use GetHighActors, otherwise you'd need to use GetFirstRef and GetNextRef every time you try to cycle through actors.

 

scn example

array_var Actors

float fquestdelaytime

ref tempref

short menu
short choice
short keycode
short index
short tempshort

Begin GameMode

if (fquestdelaytime != 0.01)
	let fquestdelaytime := 0.01
	let Actors := ar_Construct Actors
	let menu := 1
	MessageBoxEX "Hold down a key and press 'Set Key' for use in cycling through nearby actors.%r|Set Key"
endif

if (menu == 1)
	let choice := GetButtonPressed
	if (choice < 0)
		let keycode := GetKeyPress 0
	else
		let menu := 0
		let choice := 0
		Return
	endif
endif

if (GetGameLoaded || GetCellChanged)
	ar_Erase Actors
	let Actors := GetHighActors
endif

if (OnKeyDown keycode)
	tempref.StopMagicShaderVisuals customshader
	let index += 1
	Label 1
	let tempshort := ar_Size Actors
	if (tempshort == 0)
		Return
	elseif (index >= tempshort)
		let index := 0
	endif
	let tempref := Actors[index]
	if (IsFormValid tempref == 0)
		ar_Erase Actors index
		GoTo 1
	endif
	tempref.PlayMagicShaderVisuals customshader
endif

End

Link to comment
Guest syrevo

It's probably a better idea to use GetHighActors' date=' otherwise you'd need to use GetFirstRef and GetNextRef every time you try to cycle through actors.

 

scn example

array_var Actors

float fquestdelaytime

ref tempref

short menu
short choice
short keycode
short index
short tempshort

Begin GameMode

if (fquestdelaytime != 0.01)
	let fquestdelaytime := 0.01
	let Actors := ar_Construct Actors
	let menu := 1
	MessageBoxEX \"Hold down a key and press 'Set Key' for use in cycling through nearby actors.%r|Set Key\"
endif

if (menu == 1)
	let choice := GetButtonPressed
	if (choice < 0)
		let keycode := GetKeyPress 0
	else
		let menu := 0
		let choice := 0
		Return
	endif
endif

if (GetGameLoaded || GetCellChanged)
	ar_Erase Actors
	let Actors := GetHighActors
endif

if (OnKeyDown keycode)
	tempref.StopMagicShaderVisuals customshader
	let index += 1
	Label 1
	let tempshort := ar_Size Actors
	if (tempshort == 0)
		Return
	elseif (index >= tempshort)
		let index := 0
	endif
	let tempref := Actors[index]
	if (IsFormValid tempref == 0)
		ar_Erase Actors index
		GoTo 1
	endif
	tempref.PlayMagicShaderVisuals customshader
endif

End

[/quote']

 

I can't Thank you enough for your help

your Script worked like a charm

Again thank you very much now I can continue my mod many thanks to you  :)

 

 

Link to comment
  • 3 months later...

Hi,

 

I am in need of assistence. I am trying to find out the cell in which a npc is sleeping. I want to do this with the sleep package (GetPackageLocationData). There are different options possible and one gives me a headache (searching for hours the cswiki now): 'Editor'. This is the position where the npc has been placed in the editor after creation. I found out that I can use GetStartingPos and GetStartingAngle to determine the position. But I cannot get a complete set of data to find out the cell or to position s.th. at this position. But how do I find out the cell-reference (need it to use GetParentCellOwner)? Please help!

Link to comment
  • 2 weeks later...

Hi' date='

 

I am in need of assistence. I am trying to find out the cell in which a npc is sleeping. I want to do this with the sleep package (GetPackageLocationData). There are different options possible and one gives me a headache (searching for hours the cswiki now): 'Editor'. This is the position where the npc has been placed in the editor after creation. I found out that I can use GetStartingPos and GetStartingAngle to determine the position. But I cannot get a complete set of data to find out the cell or to position s.th. at this position. But how do I find out the cell-reference (need it to use GetParentCellOwner)? Please help!

[/quote']

A bit late here, I know, but I think you will have to enable the NPC. They don't sleep in remote cells unless they have been enabled, and they won't be enabled by the game unless their cell is loaded.

 

If there is some chance that the NPC is sleeping in any given cell, you could activate them in the cell randomly chosen from the possibilities presented by the game or mod that introduced the NPC.

 

It might help if you said which NPC are you trying to find, and why you don't know the cell in which that NPC sleeps.

 

Link to comment

Hello , Have A lil Question

Umm How Do u Enchant Something that On wearing it It forces Special Animations ,

Specifically Walk Animations In My Case.

Im A bit Noob When It Comes To modding , A Helpful Script Perhaps Also I want only the The Animations I have And Disable the others

Is It possible ?

 

Thanx In Advance

:)

Link to comment

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.

Link to comment

Slammer,

 

Can't you use GetInventoryObject and then RemoveItemNS?

 

This could be in a regular script attached to the added token, if this is always the function you want for that type of token. If not, you may need to condition it, or put the RemoveItemNS in the result script.

Link to comment

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?

Link to comment

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.com/showthread.php?tid=1204 post 2

Link to comment

I need a bit of scripting help myself' date=' 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.

[/quote']

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

 

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.

 

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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