Jump to content

I need help with a script.


Dragonfire12

Recommended Posts

I wrote a mod to remodel Alva's House in Morthal. My intent was to make it into a Vampire Home with follower usable beds for night feeding (please excuse the length of the post).

 

To do so I placed two Xmarkers on the floor that are initially disabled. I named them, LaidtoRest and LaidtoRestV (for vampire).

The things I wanted to replace in Alva's House I set to Enable Parent Opposite and the replacement and additional items I set to Enable Parent.

I attached a script to the LaidtoRest Xmarker that is supposed to run when you enter the house. It checks to see if the quest, "Laid to Rest" is complete and if so it enables the LaidtoRest Xmarker which toggles the items in the house, what I want removed it disabled and what I want installed is enabled. Second it checks to see if you are a vampire and if so it enables the LaidtoRestV Xmarker which places a standing Player Coffin in Alva's Cellar against the back wall. If the Player is cured of vampirism the Player Coffin will disappear.

 

Nothing happens until you Kill the Master Vampire Movarth and report his death to the Jarl, completing the quest, "laid to Rest". Then on entering the house the script makes the changes to the house that I wanted and adds Alva's House Faction to the Player. Until the quest, "Laid to Rest" is complete no changes are made to Alva's House.

 

At first glance it appears that everything works fine. However, I have started to have trouble with game bloat, crash on load and annoying game pauses that I can't explain. So, I ran the program PDTWrapper on my save and found that the script is replicating itself out of control, I can't even count how many instances of it are running in my save game.

 

Here is the script. I am hoping that someone could tell me what I did wrong that is causing it to run out of control like this and suggest changes to the script. I suspect that the command, "Event OnCellAttach()" (suggested in the Creation Kit Wiki), is the culprit here and hopefully someone here knows what the correct command would be to execute the script without replication.

 

 

 

 

Scriptname MS14ProgressScript extends ObjectReference
Quest property pMS14 auto
Actor property pPlayerRef auto
Faction property pMS14AlvaAndHroggar auto
ObjectReference property pLaidtoRest auto
ObjectReference property pLaidtoRestV auto
Keyword Property pVampire Auto
Event OnCellAttach()
If pMS14.GetStageDone(200) == 1
pLaidtoRest.Enable()
pPlayerRef.AddToFaction(pMS14AlvaAndHroggar)
Endif
If pMS14.GetStageDone(200) == 1 && Game.GetPlayer().HasKeyword(pVampire)
pLaidtoRestV.Enable()
else
pLaidtoRestV.Disable()
Endif
EndEvent

A note on the properties. I had to add a p to the property name in order to get the script to compile. I have no idea why, I even asked Altmoor (USLEEP) who kindly replied by scratching his head. I believe it is because I downloaded the Steam Wars update for Creation Kit which may have included changes to papyrus intended for Fallout 4. In short I haven't found anyone who can explain why the p is necessary as old scripts that I used before will no longer compile unless I add the p to the properties and source scripts from existing mods won't compile either. I discovered this (the p thing), by examining core game scripts contained in Scripts.rar. It works this way, compiles, properties auto assign, etc., it just goes viral.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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