Fallout 3 quest scripts

From Nexus Mods Wiki
Jump to: navigation, search

Introduction

So if you are new to scripting you should know a few things first:

- there is a website about FO3 scripting right here

- there is a FOSE-documentation on the web:link

- you should check those websites for functions you could use in your script first, BEFORE you start scripting the actual script (this step often saves you a lot of time)

- even if your script seems to be pretty good, the game-engine will most likely cause some problems, it is not the smartest


The Quest scripts

- if you want a script to run while the player is doing something else, or the player should not be bothered to do something for the script to start, the Quest-Script is your friend

- first you have to create a new quest in the GECK (watch a different tutorial for that)

- create your script (make sure you save it as quest-script, default is object!!!)

- open up your new quest again and set your script as the new questscript

- now there are some fields that are mandatory for your script-running-behaviour:

  • if the priority field is left empty, your quest-script most likely will not run at all, you should set this to 50 or 60 for a normal execution
  • if your script is not required to run really often, you should leave the script-delay alone, otherwise you need to try it out, what's best for you


- there are now a few things you should NOT do in a quest-script:

  • you should not show a message every time the script processes, this will cause serious problems since you are rowing up dozens of messages (this is even worse if you use message boxes)
  • the game-engine seems to have problems if you disable/enable things in the same script-run (most likely the object will not be en-/disabled correctly)


So here is how you do it

use a condition for your showmessage line, like

if sDoOnce == 1
--showmessage blabla (the -- are only for better reading this article, do NOT copy them into your script, 
the same for this text in brackets)
--set sDoOnce to 0
endif


- only enable/disable the same object once during the script, like

if sState == 1
--enable myREF
--set sState to 2
elseif sState == 2
--disable myREF
endif

(the "ELSEif" part here is important, if it only would be "if" myREF would get disabled in the same script-process and everything would be messed up)

- and for God's sake use sensible names for your variables!

- another important issue is that you cannot stop QuestA in its own script, so you have to create another script (e.g. an object script bind to a token (armor without biped slots))


So it should look like this:


QuestAscript:

begin GameMode
--player.additem QuestAstopToken 1 0 
the "1" is the number added, the "0" disables the add-message, the ";" marks the rest of  the  line as comment
end


QuestAstopTokenScript:

begin OnAdd Player
--stopQuest QuestA
--player.removeitem QuestAstopToken 1 0 ;you should remove the item after it has stopped the quest to ensure proper working
end


other useful sites:

http://www.cipscis.com/fallout/utilities/validator.aspx

http://www.cipscis.com/fallout/tutorials/loops.aspx