Search the Community
Showing results for tags 'extend'.
-
So, I'm trying to add a lot of functionality into DLC1NPCMentalModel, the quest that handles Serana's behavior and opinion of the player. To do so, I first created a script extending DLC1_NPCMentalModelScript and added it to the DLC1NPCMentalModel quest. I then removed the original script, since I would have access to all of its functions and properties anyway in the child script. I got to work on adding some new functions that I felt would be useful into the extended script, and quickly found that I would need to recreate the variables of the parent in the child as they cannot be seen by the child. This fixed compilation issues I had been running into when trying to copy/paste parent functions into the child script with the intention of modifying them there. However, I've noticed some problems... When entering sqv DLC1NPCMentalModel, two of every variable is shown. I assume that it is something along the lines of both the old parent variable and the child variable being called up, but I am not sure.Also when entering that same thing into the console, all the variables are still shown as having the value defined in the parent (DLC1_NPCMentalModelScript). For instance, I wanted to expand the axes min/max to -5/5 rather than -3/3, and make the assessments go from -5.0/5.0 rather than 0.0/10.0, and so I set them as that in the child. But pulling up the quest in the console still reads "__axisMin = -3, __axisMax=3, __assessmentMin = 0.0, __assessmentMax = 10.0". Note that each of these is repeated twice as mentioned above, using the parent value of -3/3 0.0/10.0 each time. Even if it is printing both the parent and child, only the parent variable's value is getting through.At least one function doesn't want to work when overridden in the child script. The function "Setup()" does not seem to run when I create a slightly modified version of it in the child script, and on game start all properties that SHOULD be given values (for example, AxisGuardedToOpen should start at -1) are just 0. Also, the boolean "__isSetup" is still False, so clearly it never ran the override function OR the parent one. If I rename the overriding function to SetupBlah() just to get it back to using Setup() from the parent, it runs that function fine, but there's still the duplication and parent values being shown...I decided to test a possible explanation to this by adding a prefix to all the child variables and making overriding functions consistent with those new prefixed variables, to see if it changed the output. It did - all the prefixed variables were set to the right values by Setup() and the changes I made to the minimums and maximums were there, too. The parent variables, no longer touched by Setup(), were just set to either 0, empty or whatever was present in the parent script itself. This is frustrating - do I really have to just create an entire parallel structure to get around this? It may just be that sqv is at fault, and the underlying structure is as I intend it to be. But if that's not the case, I don't think allowing the possibility for parent variable values to be used instead of the updated child ones is acceptable... and if the only solution to that is to create a whole new renamed set, it would mean I have to override every function to ensure only the new variables are dealt with, while the parent ones get left alone. Seems like it defeats some of the purpose of extending a script in the first place. Edit: To further complicate things, I believe I might have to even create parallel versions of some properties... if I understand the wiki correctly, I cannot override things that a property does in a child, unlike a function. If so, since the get/set functions of the parent for some properties call on variables only in the parent, these wouldn't be consistent with stuff done in the child script and thus I'd need to make new properties entirely under different names to serve the same purpose, but instead interact with the child variables instead. This also means any checks using the affected variables in certain topics would need to be changed to used the new, prefixed properties... there's got to be an alternative here. I'd rather not touch the vanilla script, but if the only way to avoid that is all this renaming, then it's a pretty rough choice.
-
I'm currently trying to do exactly what the title says. I hate the engine rule that everything you previously killed gives you xp after re-spawning when killed by someone/thing else. After 200 hours *Ka-Chinggg* of gameplay there's hardly *Ka-Chinggg* any place you haven't *Ka-Chinggg* *Ka-Chinggg* *Ka-Chinggg* visited before. :smile: Coming right from Unity3D with its simple and transparent "add script to object and change variables in the inspector" structure + instant play testing, scripting with the Creation Kit feels extremely difficult and cumbersome in comparison. Respect to anyone who learned to handle this tool! That said, this is what my "Unity" brain tells me to do in order to solve the problem: ----------------------------------------- 1. Grab event that gives xp 2. Get current amount of player kills 3. If kill count the same, block xp event OR if event can't be blocked 2. Cache current amount of player xp 3. If kill count the same, revert xp back to cached value ----------------------------------------- Now, here's what I learned while going for the solution above: - The Player object can be accessed globally by playerREF (fastest) and Game.GetPlayer() - Actor Values do not allow access to current amount of xp or the remaining amount of xp to the next level - There is no xp event - There is no global update function which would help monitoring values permanently if need be - I'm unable to google the correct terms to find out what my script needs to extend (Actor?) or if I need to create a dummy quest for this kind of modification and last but not least, what object to attach the script to The most helpful bit of code I found on creationkit.com was this: Float Function GetExperienceRemaining() ; returns the amount of experience remaining for the current level. Return Game.GetExperienceForLevel(Game.GetPlayer().GetLevel()) - Game.GetPlayerExperience() EndFunction But this requires the Fallout 4 Script Extender which, as far as I know, doesn't work flawlessly with FO4VR or not at all. To be honest after 2 hours of research I gave up because there are simply no precedents for "Block unearned xp", only requests for "Disable exp gain completely" which is obviously not what I want. May be it's because my search terms always include "exp" but I don't know what else to look for. Is what I ask for even possible? I'd really appreciate any help. Anything that brings me a bit closer to a solution is very welcome!
