Jump to content

My script is not being ran by SSE


TheWhispers

Recommended Posts

I successfully compiled my script and slipped it into my data/scripts folder of my game where all the other .pex files are and where mod .pex are too.

I even ran some Debug.trace() functions OnInit() and OnPlayerLoadGame(). My logging is turned on and nothing prints to the log files regarding this script. There is absolutely no evidence my script is being ran.

Is there something I'm missing?

For example, as a test I wrote this real quick:

scriptname TheWhispersTest extends Actor
import Debug
Event OnPlayerLoadGame()
Debug.MessageBox("TheWhispersTest - This works! Nice save load lol")
Debug.Trace("TheWhispersTest - This works! Nice save load lol")
EndEvent
Compiled just fine and loaded the game up, does absolutely nothing to my logs, nor does the MessageBox show up.
Edited by TheWhispers
Link to comment
Share on other sites

Did you attach the script to an object?

 

Also, OnPlayerLoadGame only works when attached to the player. Modifying the player record for a script is a "bad idea". It is a very good way to have conflicts with other mods that do need to edit the player record for very specific reasons. You should create a start game enabled quest, create an alias record on that quest which points to the player reference. Add the script to the alias and have it extend ReferenceAlias instead of Actor.

Link to comment
Share on other sites

Did you attach the script to an object?

 

Also, OnPlayerLoadGame only works when attached to the player. Modifying the player record for a script is a "bad idea". It is a very good way to have conflicts with other mods that do need to edit the player record for very specific reasons. You should create a start game enabled quest, create an alias record on that quest which points to the player reference. Add the script to the alias and have it extend ReferenceAlias instead of Actor.

 

Yes the script was attached to the player in CK. Both my mod and my test script. Neither do anything at all.

 

It definitely seems like I'll have to do as you said. Extending Actor for a player-based script only seemed the most intuitive thing to do for my use-case, but the last thing I'd want is to conflict with mods, especially considering the fact this mod is completely original and doesn't rely on specific content to be in the game.

 

My mod use-case is that I'm monitoring animationevents on the player, and then applying different active effects based off specific conditionals. It's quite intensive for it to work smoothly, so it'll only support the player. The only thing I need the player record for is OnAnimationEvent and OnPlayerLoadGame events. The script itself is strictly associated the player and the properties/variables directly associated to them as an actor. Although the script does run logic and act based on the ObjectReference(s) of the characters surroundings every time they fire the Animation Event, but the context never leaves the player at all.

 

Using a start-game enabled quest seems like a hacky way to pull off what I'm trying to do, but I'll look into it more. Thanks for your help, you'll probably be seeing me around here a lot more.

 

My game has close to 100 mods on it, and I'm running SKSE, would that have anything to do with it? You said what I am doing can easily cause conflicts so maybe that's why.

Edited by TheWhispers
Link to comment
Share on other sites

By attaching the script to an alias on a quest that is either start game enabled or you will start in some other way ensures that your script will run. Attaching it to the player directly prevents the script from running unless starting a new game. A game in progress has no clue about the script as the player record has already been loaded. This was most likely the reason why it did nothing for you.

Link to comment
Share on other sites

By attaching the script to an alias on a quest that is either start game enabled or you will start in some other way ensures that your script will run. Attaching it to the player directly prevents the script from running unless starting a new game. A game in progress has no clue about the script as the player record has already been loaded. This was most likely the reason why it did nothing for you.

 

Ohhhhhh okay that makes perfect sense. The script needs to work at all times. Activating it on a new game start won't really help me because the script needs to be whenever the character is being played. Attaching the script to the player would require that the player start a new game when they install it, which is ridiculous.

 

I'll use this workaround. Thanks again!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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