Jump to content

General Questions about Scripting


Rigger1209

Recommended Posts

This particular script you want to run once, when the user picks up the item. So it should use an "activate" block, not a "gamemode" block.

 

I agree with you that modders should make an effort to be efficient and prevent scripts from running all the time. You can see comments in the base game scripts where they have gone back afterwards and made changes to improve this, which can only be because they found this was a problem. However, many modders have told me that there is no reason to be concerned about this because modern machines are fast enough to do all this. So, YMMV.

 

Don't cut corners. Put the code in the appropriate block type, as there's no reason to put the additional strain on the machine, even if it's tiny.

 

Ok so here the trick is more knowing about the correct blocktypes. I figured as much. Thank you!

 

 

Will all questscripts in the game that use this blocktype be evaluated every five seconds? Wouldn´t this be rather demanding regarding ressources? Or am I missing something?

 

It looks to me like the question is if I change this in one script will this change the evaluation time in every other script that uses this type of evaluation? That should be a no it does not if that is what you are asking. Each script is uniquely named and is a stand alone script. That being said one script can be assigned to multiple objects and in that particular area yes any other object that calls on that one particular script will use the new evaluation time that you edited in.

 

The work around for that is simply rename your custom script with its own unique name and then assign it to your object/s and then only those objects you specifically assign your script to will be under the influence of your custom script.

 

Hey thanks for taking your time to answer, but actually I didn´t mean if this will be changed by any script I make. It was just about if these blocktypes are really evaluated every few seconds from the engine.

 

Definitley getting a better grasp about it step by step here. Also I do have another question:

 

If you make a more complex questscript, how would you go about it? Making a single powerfull questscript wich controls the quest, or would you go for a startscript and then attach any necessary controlfunctions via Queststages and Quest Stage Items and their resultscripts?

 

Also: is it possible to write scripts that then can be used as a function in other scripts?

 

Thanks for your patience and time!

Link to comment
Share on other sites

Viewed as a programming environment, the FNV scripting language is not very powerful. There is no way to write subroutines, for example. Nor is there a way to perform search/replace, etc. It may be worthwhile to think about mods where the programming part is very simple; in my experience, trying a complex programming task involves a lot of pain. Having multiple quests including "helper" quests, and multiple stages, is one good way to separate script steps. Edited by davidlallen
Link to comment
Share on other sites

Hey again I seem to get the hang of it thank you very much.

 

Maybe anyone can help me with this rather specific thing some more:

 

I made a book, put it on a dead NPC and wrote a script for the book.

 

The bookitself will increase a skill. Then it is "consumed". And that´s when the script should put a note into the players note inventory instead.

 

The script looks like this:

 

scn 01EPHoeBeScript

begin OnEquip

AddNote 01EPHoeBeBuchNote 

end

 

I read in the WiKi that any OnEuip blocks in Bookscripts should be triggered, but ingame no note gets added. So I´m kinda puzzled here.

 

Any help or suggestions would be highly appreciated.

 

Thanks

Link to comment
Share on other sites

Please don't create items or scripts whose name starts with a number. This will often cause syntax errors. It is a bad habit.

 

I assume you are referring to the ID? Just wanna make sure. But will do! No more numbers up front from here on out then.

 

You may want to try "player.addnote" instead of "addnote".

 

As I understood it this should not be necessary? Or is this a way to make it more reliable?

 

Thanks for the clarification.

Link to comment
Share on other sites

Hi again,

 

so I replaced all references with names not starting with numbers but still when I use the Book in my inventory screen, I get my skill raise and the book vanishes but the note isn´t added.

 

The script of the book looks like this now:

 

scn EP01HoeBeScript

begin OnEquip

player.AddNote EP01HoeBeBuchNote 

end

 

What coul I be missing now?

 

Thanks!

Link to comment
Share on other sites

Hi again,

 

so I replaced all references with names not starting with numbers but still when I use the Book in my inventory screen, I get my skill raise and the book vanishes but the note isn´t added.

 

The script of the book looks like this now:

 

scn EP01HoeBeScript

begin OnEquip

player.AddNote EP01HoeBeBuchNote 

end

 

What coul I be missing now?

 

Thanks!

i don't think you can 'equip' a book.

so maybe it'd work better in an onActivate or onAdd block (depending on what kind of item your book actually is)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...