Jump to content

NOTICE: The new site is now moved to the original www.loverslab.com URL. The site may be up and down during this transition and there is still some tweaks and setup going on, so you may experience the occasional broken link, visual oddity, and other such errors. 

If you notice anything any particular that's broken or have any suggestions or comments, please post them in the following thread: http://www.loverslab.com/topic/87535-new-site-questions-comments-and-suggestions/

The old site will remain accessible for the next week via the URL http://old.loverslab.com

Sign in to follow this  
Guest Donkey

useful community scripts to start mods with

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...

Share this post


Link to post

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?

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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).

Share this post


Link to post

 

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.

Share this post


Link to post

 

 

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.

Share this post


Link to post

I was actually so baffled by this issue that I forgot I meant to do something completely else. However it was good to know in advance what to expect from these tokens.

Share this post


Link to post

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

Sign in to follow this  

×