Jump to content

useful community scripts to start mods with


Guest Donkey

Recommended Posts

Yep, circumventing limitation. You can use quest stages like functions. It was a common trick back when obse was not so common and a modder somehow didn't want to / couldn't use obse. Anyways, you can't define function in a batchscript, so setting stage in a batch script is like calling a function. The four lines before setting quest stage are like passing arguments for the function. Pretty much all .ini files are the same...

Link to comment
  • 2 weeks later...

I have a script attached to an item that I give to npc. In this script I use GetContainer to get the reference of npc who is holding the item and passing it as a parameter to a function that gives him few more items. Everything seems to work in game, but the console is filling with errors saying I try to refer to "NULL or base object". I tracked this issue down to few lines in the said function where I check npc's gender and money amount. Does somebody know why this is happening?

 

EDIT: Scrach that.

 

I added a small line to print this actor's name and found out that "npc" who triggers this error is called <no name>. Soo I guess this is invalid reference. I wonder how that is possible though because I get first reference with GetFirstRef 35 1 (nearby npcs) and then run through them with While (IsFormValid npcActor) -loop. So if the form isn't valid should I not be able to add item to it in the first place?

Link to comment

Maybe the 'no name' is referring to the reference rather than the base actor?

 

Here's how I handle your situation:

 

After getting the reference the same way you do, I add a token with a script that has

ref me

Begin GameMode
let me := GetContainer
;do whatever with me
end
Link to comment

Yes, my code looks almost similar to yours. Only difference is that at "do whatever with me" part I have a function call with "me"-reference as parameter. And that part doesn't seem to be the problem, because after this happends maybe two times everything starts to work without any spam to console.

Link to comment

Yes, my code looks almost similar to yours. Only difference is that at "do whatever with me" part I have a function call with "me"-reference as parameter. And that part doesn't seem to be the problem, because after this happends maybe two times everything starts to work without any spam to console.

It sounds like something hasn't fully initialized. Maybe the script could check for some valid condition before calling the function, like having something equipped (or whatever is relevant for your purpose).

Link to comment

 

Yes, my code looks almost similar to yours. Only difference is that at "do whatever with me" part I have a function call with "me"-reference as parameter. And that part doesn't seem to be the problem, because after this happends maybe two times everything starts to work without any spam to console.

It sounds like something hasn't fully initialized. Maybe the script could check for some valid condition before calling the function.

 

 

Yeah I just added IsReference check before calling function and now it seems to work nice and quiet. I guess GetFirstRef isn't that reliable after all.

Link to comment

 

 

Yes, my code looks almost similar to yours. Only difference is that at "do whatever with me" part I have a function call with "me"-reference as parameter. And that part doesn't seem to be the problem, because after this happends maybe two times everything starts to work without any spam to console.

It sounds like something hasn't fully initialized. Maybe the script could check for some valid condition before calling the function.

 

 

Yeah I just added IsReference check before calling function and now it seems to work nice and quiet. I guess GetFirstRef isn't that reliable after all.

 

 

Puuk, try waiting one or more frames after the token is added to the actor and then try getContainer again? It may help.

Link to comment
  • 5 years later...

How do I get an npc to rape the player when they have arrived at a location?

I am trying to change LoversCoverYourself to make the guard lead the player into the barracks, but when they arrive in the barracks, the guards starts the dialogue with the player but then he just walks away. I use the same call that the mod uses as an alternative to pay for the nude crime. I also added a call to LoversRaperS. But none of it works.

Link to comment

Do you start sex in the dialog script?   And set Dialog to "Goodbye"

 

The dialog script

 

Call xLoversCmnInitQuestInterface
set xLoversQuest.offence to Player
set xLoversQuest.defence to GetSelf
set xLoversQuest.OffNudeFlag to 128   ;  set  sex is rape
set xLoversQuest.DefNudeFlag to 128
set xLoversQuest.SPos to 3   ; 3 = missionary. 1 = cowgirl. 2 = from Back. 4 = standing. 6 = blow job
Call xLoversMainSafeStart

Edited by fejeena
Link to comment

No, the original topic is called paybody and has this:

 

Call xLoversLTDaddonPayHT getself player 0
set LTDCoverYourself.timer to 150
player.PayFineThief
player.modCrimeGold -5
RemoveScriptPackage

 

I edited the xLoversLTDaddonPayHT to take one more input, 1 is rape and 0 is normal sex. In the original it was rape when you choose that topic. The player says "Don't you like what you see?...I'll do whatever you order me to..." and then it is rape instead of normal sex. So I changed it to normal sex. And then in the other option instead you get raped. But it doesn't work.

 

I use the same:

 

set LTDCoverYourself.timer to 0
set LTDCoverYourself.arrived to 0
set LTDCoverYourself.rapedist to 0
set LTDCoverYourself.xtarget to 0
set LTDCoverYourself.perv to 0
set LTDCoverYourself.walkdist to 0
Call xLoversLTDaddonPayHT getself player 1
removescriptpackage

 

but 0 set to 1 for rape. I tried with 0, and it still doesn't work.

All the switches are used to check if you have arrived in the town guard sleeping house.

Link to comment

But it's driving me crazy. I deleted all that and moved into the quest script.

 

I commented it all out:

 

;set LTDCoverYourself.timer to 0
;set LTDCoverYourself.arrived to 0
;set LTDCoverYourself.rapedist to 0
;set LTDCoverYourself.xtarget to 0
;set LTDCoverYourself.perv to 0
;set LTDCoverYourself.walkdist to 0
;Call xLoversLTDaddonPayHT getself player 1
removescriptpackage

 

and then instead inside the quest script I added this:

 


if 1 == perv.IsGuard && eval (1 == IsFormValid perv)
    let rapedist := perv.GetDistance xtarget
    ;PRINTC "%n is now %g centimeters away from raping you!" perv rapedist
    if rapedist < 100 && 1 == perv.GetIsCurrentPackage LTDtakeCriminalToBed
        ;MessageBoxEX "%n is now supposed to fuck you!" perv
;        perv.EvaluatePackage
        ;perv.RemoveScriptPackage
        ;set timer to 0
        ;set perv to 0
        ;call xLoversLTDaddonPayHT perv player 1

 

        if 1 == arrived ;this fucking retarded oblivion engine is fucking retarded, this block stopped the whole script from running, even tho arrived == 0
            Call xLoversLTDaddonPayHT perv player 1
            set timer to 0
            set arrived to 0
            set rapedist to 0
            set xtarget to 0
            set perv to 0
            set walkdist to 0

            return
        endif        

*********what is between my outburst above and her is what I moved from the dialog topic********

        
        ;set arrived to 1
        ;perv.StartConversation playerref
        ;return
    elseif 0 == perv.GetIsCurrentPackage LTDtakeCriminalToBed
        call xLoversLTDaddonFindBarracks perv playerref
        perv.AddScriptPackage LTDtakeCriminalToBed
    elseif walkdist != 0
        if perv.GetDistance playerref > walkdist && perv.GetDistance playerref > 400
            set walkdist to 0
            perv.AddScriptPackage LTDIndecencyArrest
            PrintToConsole "You try to run away from %n, but he is not having it!" perv
        else
            set walkdist to perv.GetDistance playerref
        endif
    elseif walkdist == 0
        set walkdist to perv.GetDistance playerref
    endif
endif   

 

That little piece "set this and that to 0" stops the whole quest from running! I can't understand why!

Further down in the script it checks if you are naked and then it casts a spell that sets you to "unclothed == 1" and the guards come to arrest you.

But this part

        if 1 == arrived ;this fucking retarded oblivion engine is fucking retarded, this block stopped the whole script from running, even tho arrived == 0
            Call xLoversLTDaddonPayHT perv player 1
            set timer to 0
            set arrived to 0
            set rapedist to 0
            set xtarget to 0
            set perv to 0
            set walkdist to 0

            return
        endif  

stops everything. The player never become naked when I take of her clothes.

Even when this

if 1 == perv.IsGuard && eval (1 == IsFormValid perv)

is 0, because there is no guard to take you, so perv is 0

So the engine should just skip that whole part.

If I comment out

;        if 1 == arrived ;this fucking retarded oblivion engine is fucking retarded, this block stopped the whole script from running, even tho arrived == 0
;            Call xLoversLTDaddonPayHT perv player 1
;            set timer to 0
;            set arrived to 0
;            set rapedist to 0
;            set xtarget to 0
;            set perv to 0
;            set walkdist to 0
;        endif

it works!!! But then of course there is no sex, The guard comes to arrest me, I say please let me go, the guards say yes I will let you go, follow me. But there is no sex of course, because the sex line is commented out.

Link to comment
11 hours ago, fejeena said:

Do you start set in the dialog script?

?????

I did that now. And it works

I was sitting all last night trying to fix it.

I don't understand why calling the no rape version of the sex function works from dialog, but the rape version doesn't work!

Also why that "1 == arrived" part of the script stops the whole mod????!!!

Link to comment

Cover your self is no sex mod.

And in the quest script are no Links to Lovers with PK functions.

Only in your added part

 

###################################

 

You have no 1 in the script, no short and no ref

if 1 == arrived

So what is 1 ?   For the script it is a name not a value

 

you set arrived to something

If Player.getdistance BarracksXMarker < 128

set arrived  to 1

endif

 

then you can check if arrived is 1

but not if 1 is arrived

Only  " If arrived == 1 "  can work

 

( Only if you create a short with name 1 (not sure if the CS let you use a short with name 1 )   and set the short 1 to 1 in the "Begin GameMode" block you can check if 1 is arrived )

 

---------------------

And don't know why the whole mod does not work with wrong script.

But i know that a wrong setting in a AI Package can crash the game and CR at start.

Edited by fejeena
Link to comment

Yes Lovers Sex only in the added script which is for the spectators.

 

In the dialog the script is started.   Direct the Script into the Dialog Script would be easier.

 

And funny is the script call

Call xLoversPayHT 0

 

the 0 set the function "mod" in the script

 and in the script it is used

    if mod
        me.ModDisposition player mod
    endif

 

Result is

NPC  ModDisposition player 0

No disposition change

Link to comment

The problem I had was with the "return" after all those variables were set to 0. I was modifiying more and got the same problem again, the quest just locked up from a few lines, and the only thing the lines got in common with the ones I posted about was the "return". After I commented that out it worked. Very very strange. The script shouldn't even check those lines because the conditions of the "if then else" wasnt there, still the script entered, found a "return", and stopped.

 

But you are right, it is not a lovers mod so it is not good written.

Link to comment

In AdultPlayPlus the     xLoversPkrEquipFuncItem "Lovers Equipment" [CLOT:01000813]    is used.

It is used in the After-Sex-talk-script.

If player and NPC  GetItemCount xLoversPkrEquipFuncItem==0

 

As long as the player or NPC has the token, there is a return loop.

 

and   after the token is removed there is still another check:      if Player.GetKnockedState != 0 || Player.GetUnconscious != 0

 

Then dialogue after Sex is started

 

So Sex must be finished and Player  must have got up again before the NPC talks to the player.

Link to comment

Thank you! It works. Now when the guard rapes you the other guards don't start combat with you because you assault the guard (??!!?!)

You were right about that it's not a lovers mod, that's why it has been so difficult to modify. So yesterday I rewrote the whole mod, it was much simpler and faster than to come up with solutions for the original mods behaviours.

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