Jump to content

How to edit a script from a mod in CK


Recommended Posts

And you can't just add a property. Well, you can, but if the script doesn't specifically make use of that property you aren't accomplishing anything. You're basically declaring a variable and giving it a value but then never using it.

Link to comment
Share on other sites

Thx for the replies. I really wish the CK documentation was better, or even complete. I've now got the script decompiled and have made the necessary edits, but am having a real hard time trying to recompile it. Mainly over the name (I think, probably more errors). Luckily all of the associated keywords and entries seem to be there, I'm trying to split a single group containing the minutemen, RR, Institute, and BoS into individual choices. I've been reading old reddit posts from five years ago and watching random youtube tutorials, but I'm not finding exactly what I need. The best thing to help me would probably be recommendation for good tutorials on scripting and the CK. If anyone has any links to good, up to date, guides I would really appreciate it. Thx.

Link to comment
Share on other sites

One of my major issues I'm having is the naming convention of the script. The .psc file is different from the .pex. The .pex adds a title with a set of " : ", and you can't add a colon in a normal file name. "expecting a different name" error message. Ok, got that figured out with the CK name groups. Now it won't compile because there is already a file with that name. Ok, remove the old script(from the associated quest), cleaned MO2 overwrite>script of any mention, now CK cannot see the altered .psc file in the gameplay>papyrus manager, which it could before. I've double-checked that the correct .psc file is in the MO2>mod folder, no other versions of the mod are activated. (I extracted the ba2 containing the scripts and am running the mod on loose files to test). I'm really not sure what I'm doing wrong here. Any help would be appreciated.

 

To recap: 1. I've added the appropriate global variables (three entries using a -1 value that can be altered through MCM. These are identical in format to other existing entries in the mod)

2. I've altered the MCM config file to work with the above variables, the menu itself seems to be working, but the specific functions involved in this script are not functional, as expected

3. I've decompiled the one script I want to alter, made alterations (all four faction entries were consolidated into a single variable, altered to add individual options exactly following other entries formatting, with correct labels), and removed the old entries.

4. I've created a file with a. the altered MCM file b. the ba2 extracted to be loose meshes and scripts folders c. the .esp with the added global variables d. included the altered .psc file in the loose "scripts" folder e. and put this in the MO2 MODs folder and activated it.

5. I've tried to compile the altered script, but cannot compile it by itself (it is referencing other entries in the mod, I believe), so I think I have to use the CK to compile.

 

Is there an obvious mistake here, or any suggestions? Also, why is the .psc file only sometimes showing up in the CK Papyrus manger? Thanks.

 

The script I altered:

ScriptName ZombieWalkers:ZW_Quest_Replacements_Check extends Quest

;-- Properties --------------------------------------
Group Aliases
RefCollectionAlias Property CheckReplacementList Auto Const mandatory
RefCollectionAlias Property NeedsReplacementList Auto Const mandatory
EndGroup
Group Keywords
Keyword Property ZW_ReplacementNeeded Auto Const mandatory
Keyword Property ZW_ReplacementSkipped Auto Const mandatory
EndGroup
Group Misc
Actor Property PlayerRef Auto Const mandatory
Container Property ZW_DuffleBag Auto Const mandatory
GlobalVariable Property ZW_Quest_Replacements_LastCount Auto Const mandatory
EndGroup
Group Replace_Animals
GlobalVariable Property ZW_Config_Replace_Animals Auto Const mandatory
Keyword Property ActorTypeAnimal Auto Const mandatory
EndGroup
Group Replace_Bugs
GlobalVariable Property ZW_Config_Replace_Bugs Auto Const mandatory
Keyword Property ActorTypeBug Auto Const mandatory
EndGroup
Group Replace_Creatures
GlobalVariable Property ZW_Config_Replace_Creatures Auto Const mandatory
Keyword Property ActorTypeCreature Auto Const mandatory
EndGroup
Group Replace_HeavyKnockers
GlobalVariable Property ZW_Config_Replace_HeavyKnockers Auto Const mandatory
Keyword Property HeavyKnocker Auto Const mandatory
EndGroup
Group Replace_Humans
GlobalVariable Property ZW_Config_Replace_Humans Auto Const mandatory
Race[] Property ZW_Config_Replace_Humans_Races Auto Const mandatory
EndGroup
Group Replace_Faction_CoA
Faction Property ChildrenOfAtomFaction Auto Const mandatory
Faction Property GlowingSeaChildrenFaction Auto Const mandatory
GlobalVariable Property ZW_Config_Replace_Faction_CoA Auto Const mandatory
EndGroup
Group Replace_Faction_Gunners
Faction Property GunnerFaction Auto Const mandatory
GlobalVariable Property ZW_Config_Replace_Faction_Gunners Auto Const mandatory
EndGroup
Group Replace_Faction_BrotherhoodofSteel Added line
Faction Property BrotherhoodofSteel Auto Const mandatory Here's my error, left out "Faction"
GlobalVariable Property ZW_Config_Replace_Faction_BoS Auto Const mandatory One of the GLOB I created
EndGroup
Group Replace_Faction_Institute same
Faction Property InstituteFaction Auto Const mandatory
GlobalVariable Property ZW_Config_Replace_Faction_Institute Auto Const mandatory
EndGroup
Group Replace_Faction_Minutemen same
Faction Property MinutemenFaction Auto Const mandatory
GlobalVariable Property ZW_Config_Replace_Faction_Minutemen Auto Const mandatory
EndGroup
Group Replace_Faction_Railroad same
Faction Property RailroadFaction Auto Const mandatory
GlobalVariable Property ZW_Config_Replace_Faction_Railroad Auto Const mandatory
EndGroup
Group Replace_Faction_Raiders
Faction Property RaiderFaction Auto Const mandatory
Faction Property TheForgedFaction Auto Const mandatory
Faction Property TriggermanFaction Auto Const mandatory
GlobalVariable Property ZW_Config_Replace_Faction_Raiders Auto Const mandatory
EndGroup
Group Replace_Faction_Settlements
Faction Property CrimeDiamondCity Auto Const mandatory
Faction Property CrimeGoodneighbor Auto Const mandatory
Faction Property SettlementBunkerHill Auto Const mandatory
GlobalVariable Property ZW_Config_Replace_Faction_Settlements Auto Const mandatory
EndGroup
Group Replace_Faction_Workshop
Faction Property WorkshopNPCFaction Auto Const mandatory
GlobalVariable Property ZW_Config_Replace_Faction_Workshop Auto Const mandatory
EndGroup
Group Replace_Other
GlobalVariable Property ZW_Config_Replace_Other Auto Const mandatory
EndGroup
Group Replace_Robots
GlobalVariable Property ZW_Config_Replace_Robots Auto Const mandatory
Keyword Property ActorTypeRobot Auto Const mandatory
EndGroup
Group Replace_SuperMutants
GlobalVariable Property ZW_Config_Replace_SuperMutants Auto Const mandatory
Keyword Property ActorTypeSuperMutant Auto Const mandatory
EndGroup
Group Replace_Synths
GlobalVariable Property ZW_Config_Replace_Synths Auto Const mandatory
Keyword Property ActorTypeSynth Auto Const mandatory
EndGroup
Group Replace_Turrets
GlobalVariable Property ZW_Config_Replace_Turrets Auto Const mandatory
Keyword Property ActorTypeTurret Auto Const mandatory
EndGroup
Group Replaceable_Flags
GlobalVariable Property ZW_Config_Replaceable_Companions Auto Const mandatory
GlobalVariable Property ZW_Config_Replaceable_Essential Auto Const mandatory
GlobalVariable Property ZW_Config_Replaceable_NonHostile Auto Const mandatory
GlobalVariable Property ZW_Config_Replaceable_Protected Auto Const mandatory
Faction Property CurrentCompanionFaction Auto Const mandatory
Faction Property HasBeenCompanionFaction Auto Const mandatory
Faction Property PotentialCompanionFaction Auto Const mandatory
Race Property FeralGhoulRace Auto Const mandatory
EndGroup
;-- Variables ---------------------------------------
;-- Functions ---------------------------------------
bool Function CheckReplacement(Actor NonZombieActor)
If (Self.IsReplaceable(NonZombieActor))
If (Self.IsHuman(NonZombieActor))
return Self.ProcessHumanReplacement(NonZombieActor)
ElseIf (NonZombieActor.HasKeyword(ActorTypeTurret))
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_Turrets)
ElseIf (NonZombieActor.HasKeyword(ActorTypeSuperMutant))
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_SuperMutants)
ElseIf (NonZombieActor.HasKeyword(ActorTypeSynth))
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_Synths)
ElseIf (NonZombieActor.HasKeyword(ActorTypeRobot))
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_Robots)
ElseIf (NonZombieActor.HasKeyword(HeavyKnocker))
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_HeavyKnockers)
ElseIf (NonZombieActor.HasKeyword(ActorTypeAnimal))
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_Animals)
ElseIf (NonZombieActor.HasKeyword(ActorTypeBug))
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_Bugs)
ElseIf (NonZombieActor.HasKeyword(ActorTypeCreature))
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_Creatures)
Else
return Self.RollForReplacement(NonZombieActor, ZW_Config_Replace_Other)
EndIf
EndIf
EndFunction
bool Function IsHuman(Actor target)
bool matchesOneRace = False
int I = 0
While (I < ZW_Config_Replace_Humans_Races.length)
If (target.GetRace() == ZW_Config_Replace_Humans_Races)
matchesOneRace = True
I = ZW_Config_Replace_Humans_Races.length
EndIf
I += 1
EndWhile
return matchesOneRace
EndFunction
bool Function HasAnyKeyword(Actor target, Keyword[] Keywords)
bool matchesOneKeyword = False
If (Keywords as bool && Keywords.length > 0)
int I = 0
While (I < Keywords.length)
If (target.HasKeyword(Keywords))
matchesOneKeyword = True
I = Keywords.length
EndIf
I += 1
EndWhile
EndIf
return matchesOneKeyword
EndFunction
bool Function IsReplaceable(Actor target)
bool retval = True
ActorBase targetBase = target.GetLeveledActorBase()
If (target.GetRace() == FeralGhoulRace)
retval = False
ElseIf (ZW_Config_Replaceable_Essential.GetValue() == 0 as float && target.IsEssential())
retval = False
ElseIf (ZW_Config_Replaceable_Protected.GetValue() == 0 as float && targetBase.IsProtected())
retval = False
ElseIf (ZW_Config_Replaceable_Companions.GetValue() == 0 as float && (target.GetFactionRank(CurrentCompanionFaction) >= -1 || target.GetFactionRank(HasBeenCompanionFaction) >= -1 || target.GetFactionRank(PotentialCompanionFaction) >= -1))
retval = False
ElseIf (ZW_Config_Replaceable_NonHostile.GetValue() == 0 as float && !target.IsHostileToActor(PlayerRef) && !target.CastAs("MasterAmbushActorScript"))
retval = False
EndIf
return retval
EndFunction
bool Function RollForReplacement(Actor target, GlobalVariable replaceChance)
bool replace = False
int value = replaceChance.GetValueInt()
If (value == 100 || Utility.RandomInt(0, 100) <= value)
replace = True
target.AddKeyword(ZW_ReplacementNeeded)
target.Disable(False)
ObjectReference bag = target.PlaceAtMe(ZW_DuffleBag as Form, 1, True, False, True)
bag.MoveTo(target as ObjectReference, 0, 0, 0, True)
bag.WaitFor3DLoad()
target.RemoveAllItems(bag, False)
If (!target.IsDisabled())
target.Kill(None)
target.BlockActivation(True, False)
target.Delete()
EndIf
Else
replace = False
target.AddKeyword(ZW_ReplacementSkipped)
EndIf
return replace
EndFunction
Function Run()
int count = CheckReplacementList.GetCount()
ZW_Quest_Replacements_LastCount.SetValue(count as float)
int I = 0
While (I < count)
Actor NonZombieActor = CheckReplacementList.GetAt(I) as Actor
If (NonZombieActor)
If (Self.CheckReplacement(NonZombieActor))
NeedsReplacementList.AddRef(NonZombieActor as ObjectReference)
EndIf
EndIf
I += 1
EndWhile
EndFunction
bool Function ProcessHumanReplacement(Actor NonZombieActor)
GlobalVariable replaceChance = ZW_Config_Replace_Humans
If (NonZombieActor.IsInFaction(RaiderFaction) || NonZombieActor.IsInFaction(TheForgedFaction) || NonZombieActor.IsInFaction(TriggermanFaction))
If (ZW_Config_Replace_Faction_Raiders.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_Raiders
EndIf
ElseIf (NonZombieActor.IsInFaction(GunnerFaction))
If (ZW_Config_Replace_Faction_Gunners.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_Gunners
EndIf
ElseIf (NonZombieActor.IsInFaction(ChildrenOfAtomFaction) || NonZombieActor.IsInFaction(GlowingSeaChildrenFaction))
If (ZW_Config_Replace_Faction_CoA.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_CoA
EndIf
ElseIf (NonZombieActor.IsInFaction(BrotherhoodofSteelFaction)) These were the combined entries, split them following "Gunners" format above
If (Zw_Config_Replace_Faction_BoS.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_BoS
EndIf
ElseIf (NonZombieActor.IsInFaction(InstituteFaction))
If (ZW_Config_Replace_Faction_Institute.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_Institute
EndIf
ElseIf (NonZombieActor.IsInFaction(MinutemenFaction))
If (ZW_Config_Replace_Faction_Minutemen.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_Minutemen
EndIf
ElseIf (NonZombieActor.IsInFaction(RailroadFaction))
If (ZW_Config_Replace_Faction_Railroad.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_Railroad
EndIf
ElseIf (NonZombieActor.IsInFaction(CrimeDiamondCity) || NonZombieActor.IsInFaction(CrimeGoodneighbor) || NonZombieActor.IsInFaction(SettlementBunkerHill))
If (ZW_Config_Replace_Faction_Settlements.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_Settlements
EndIf
ElseIf (NonZombieActor.IsInFaction(WorkshopNPCFaction))
If (ZW_Config_Replace_Faction_Workshop.GetValue() != (-1) as float)
replaceChance = ZW_Config_Replace_Faction_Workshop
EndIf
EndIf
return Self.RollForReplacement(NonZombieActor, replaceChance)
EndFunction

 

UPDATE:

I decided to decompile the other three scripts associated with the one I was having issues with, then when recompiling them three of the four failed. So yeah, that's where I'm at.

 

The error message:

 

 

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright © ZeniMax Media. All rights reserved.
Starting 4 compile threads for 4 files...
Compiling "ZombieWalkers\ZW_Quest_Replacements.psc"...
Compiling "ZombieWalkers\ZW_Quest_Replacements_Check.psc"...
Compiling "ZombieWalkers\ZW_Quest_Replacements_Spawn.psc"...
Compiling "ZombieWalkers\ZW_Quest_Replacements_Static.psc"...
E:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\ZombieWalkers\ZW_Quest_Replacements_Static.psc(41,32): unknown type zombiewalkers:zw_util
E:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\ZombieWalkers\ZW_Quest_Replacements_Spawn.psc(29,32): unknown type zombiewalkers:zw_util
E:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\ZombieWalkers\ZW_Quest_Replacements_Static.psc(93,25): zombiewalkers:zw_util is not a known user-defined script type
E:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\ZombieWalkers\ZW_Quest_Replacements_Static.psc(93, :cool:: type mismatch while assigning to a actor (cast missing or types unrelated)
No output generated for ZombieWalkers\ZW_Quest_Replacements_Static.psc, compilation failed.
E:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\ZombieWalkers\ZW_Quest_Replacements_Spawn.psc(59,25): zombiewalkers:zw_util is not a known user-defined script type
E:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\ZombieWalkers\ZW_Quest_Replacements_Spawn.psc(59, :cool:: type mismatch while assigning to a actor (cast missing or types unrelated)
No output generated for ZombieWalkers\ZW_Quest_Replacements_Spawn.psc, compilation failed.
E:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\ZombieWalkers\ZW_Quest_Replacements_Check.psc(258,36): variable BrotherhoodofSteelFaction is undefined
No output generated for ZombieWalkers\ZW_Quest_Replacements_Check.psc, compilation failed.
Compilation succeeded.
Batch compile of 4 files finished. 1 succeeded, 3 failed.
Failed on ZombieWalkers\ZW_Quest_Replacements_Static.psc
Failed on ZombieWalkers\ZW_Quest_Replacements_Spawn.psc
Failed on ZombieWalkers\ZW_Quest_Replacements_Check.psc

Another UPDATE:
So I added every script (.psc version) in the mod to the steam data\scripts\etc folder and now none of them work. Again, because they are looking for files with the "name group" added. Is there a fix for this or should I just rewrite the entire mod to follow a better naming system?
Edited by nexusclod
Link to comment
Share on other sites

Because the Papyrus Manager is cranky.

 

If you changed the script you are better off saving it with a new name, then changing whatever uses that script to use the new name.

 

Now: unknown type zombiewalkers:zw_util

 

The scripts you are compiling reference zw_util. That script has a variable, zombiewalkers, with a type not recognized by the compiler. This is likely because zw_util uses a type from something else, like F4SE. If you don't have the sources for F4SE (or whatever it is) then the compiler can't figure out what zw_util is doing with zombiewalkers, and it all comes tumbling down.

 

Now Zombie Walkers doesn't look like it has any requirements... did you decompile zw_util? You need that source code too. Yeah, you have the compiled version, but my experience has been if you don't have the source of the entire chain then the script won't compile. I can't compile anything for Skyrim because the dependencies have dependencies which have dependencies and it is impossible to get the script development environment set up properly.

Link to comment
Share on other sites

Thanks for reply, I think I have it figured out. Just like you said, everything comes back to the sourcing. Just got it to compile, checked/set properties, and checked in fo4edit. I was over complicating things. My script sourcing was mixing between MO2 overwrite and the steam file script/source/user. I got that all straightened out, actually putting the .psc file in the right steam folder helps (user). Also I learned not to trust the refresh button in the Papyrus manager. Resetting the CK between every change made a difference. I was messing with too much, I just needed the one file. Also I found an error in my coding. Still, learned a lot about scripting, cheers.

Link to comment
Share on other sites

Oh, yeah, if you want a change in Papyrus Manager you have to restart the CK. It's annoying at times, like if you have a source file in the wrong folder and move it you have to restart CK before the compiler can find it.

 

Glad you got it sorted.

Link to comment
Share on other sites

  • 3 years later...

Not the right place to ask this but I am out of ideas.

I finally got the Creation Kit fully working???? and am getting scripts to compile, HOWEVER.

I have created a quest whch runs on startup. I have called Start(), I have fill all properties (whatever that does), but SetStage(0) is not starting the quest and my inventary related commands are not working either. I other words the quest is not running, or not connecting with the game. In Skyrin there was a RegisterForUpdate(...,...) command, I know why that was needed for a quest to do function. It's not available for Fallout4. So now, I.m out of ideas. Any ideas about what I am missing??????

Link to comment
Share on other sites

  • Recently Browsing   0 members

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