Jump to content

Problem with basic scripts


Recommended Posts

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 Auto

Perk 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=1
sResourceDataDirsFinal=

Edited by Arael54
Link to comment
Share on other sites

I'm sure there are more reasons but

 

1. OnInit sometimes seems to fire way too early and is just in my experience too unreliable

2. When adding items (Maybe perks too) before exiting the Vault, they get deleted

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

  • Recently Browsing   0 members

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