Arael54 Posted July 31, 2021 Share Posted July 31, 2021 (edited) Hello, I have 2 questions about using scripts in Fallout 4 with the CK. I'll begin by saying I'm a real novice about scripting, I already tried to use a script years ago for another mod I was creating and it worked (but I can't remember if it was on Skyrim or fallout 4, even if it works roughly the same). So: 1/ My \steamapps\common\Fallout 4\Data\Scripts doesn"t contain any .pex file, unless I create a script myself with the CK. Shouldn't there be a lot of .pex files in there ? steamapps\common\Fallout 4\Data\Scripts\Source\Base contain the psc files however. 2/ I can't seem to make the simplest script running. I just want to add a perk to my character at launch. I create a quest, I go to the "Scripts" tab, I create a new script, I extend "quest", I close the window, I open it again, I go to "Edit source", I create my script like this: Scriptname NameOfMyScript extends Quest Actor Property PlayerRef AutoPerk Property NameOfMyPerk Auto Event OnInit() PlayerRef.AddPerk(NameOfMyPerk)Debug.Notification("Perk added.") EndEvent I compile, i save and i close the windows, I open the "properties" windows, I autofill PlayerRef and Perk, I save everything, I activate the .esp, I start the game and ... Nothing happens. I tried to attach the script to the player and extend ReferenceAlias but it doesn't work either. I can add my custom perk via console command, so the mod is active, but the script won't launch.I'm sure I forget something really basic, but I don't know what. Could someone tell me what it is ? Thanks. Edit: Resolved. I reinstalled Fallout 4 and MO2, and I hade to add : [Archive]bInvalidateOlderFiles=1sResourceDataDirsFinal= Edited July 31, 2021 by Arael54 Link to comment Share on other sites More sharing options...
Zorkaz Posted July 31, 2021 Share Posted July 31, 2021 1. No it's fine as the scripts are in a ba2 archive by default2. Use OnQuestInit() that works better. It should only work however after exiting Vault111 Link to comment Share on other sites More sharing options...
Arael54 Posted August 1, 2021 Author Share Posted August 1, 2021 Thanks. Could you tell me why OnQuestInit() works better than OnInit() ? Link to comment Share on other sites More sharing options...
Zorkaz Posted August 2, 2021 Share Posted August 2, 2021 I'm sure there are more reasons but 1. OnInit sometimes seems to fire way too early and is just in my experience too unreliable2. When adding items (Maybe perks too) before exiting the Vault, they get deleted3. I remember using Oninit() for something else (I think RegisterForWait... and then execute something) and it messed the Vault111 experience up too. Again the quests and perks will fire after the exit (Or while having a game where you already exited the Vault) so it's just better practice to leave the intro scenes as they should be Link to comment Share on other sites More sharing options...
Recommended Posts