nhguy03276 Posted October 9, 2016 Share Posted October 9, 2016 (edited) I'm working on creating a risk/reward system for some mods I like that will make these mods more interesting than they currently are. To this end I'm writing a custom perk tree so that these mods can affect the game, yet not mess with other perks (using the Merged Thievery Skills mod to open up Lockpicking for my custom tree). So in my script, I add the line when adding XP Game.AdvanceSkill("Lockpicking", 10) But I also want to be able to subtract XP, Game.AdvanceSkill("Lockpicking", -10) Doesn't seem to do anything. Is there a different code for removing XP? Of course, I'm not even sure this is a good idea due to perks and skill leveling and all, so one alternative I've been thinking about it to place a hidden Var in the MCM script, to store the "Debt XP", and subtracting the positive XP from that. This way you don't actually lose XP or Levels, but you can't advance until your "debt" is payed off. Is this likely the best way or is there a better way to handle XP lose? I know that my overall plan is going to push the limits of Papyrus, and want to keep this as optimum as possible. Thanks for any help Edited October 9, 2016 by nhguy03276 Link to comment Share on other sites More sharing options...
lofgren Posted October 9, 2016 Share Posted October 9, 2016 Sorry, why do you want to subtract XP? What is the player experience you are trying to create? Under what conditions will the PC lose XP? Link to comment Share on other sites More sharing options...
nhguy03276 Posted October 9, 2016 Author Share Posted October 9, 2016 Sorry, why do you want to subtract XP? What is the player experience you are trying to create? Under what conditions will the PC lose XP?Not for not, but I deliberately did not give this information and kept the post as vague as possible, because in over 20 years of forum usage, there is near universal truth. If you give too much information when asking a question, people get bogged down in the details, and never answer the question asked, or worse tell you not to bother and just use some canned, off the shelf, Piece of Junk premade that doesn't do what you need. Offering Alternative is fine in my book as long as the original question gets answered as well... however it often gets lost in the details In this case, the Whys really don't matter, other than I'm trying to find a way to script XP loss, as XP loss is a bigger penalty than gold/items ever would be. So my question is How? game.advskill ("Skillname", 10) adds 10 to "skillname", but game.advskill("skillname", -10) does not remove 10 skill. I've encountered similar situations like this in other programming languages, where to use a float would require game.advskill("skillname", .5f) to add a .5 to a skill, and others would require game.Removeskill("skillname",10) to subtract skill as they can't handle a negative Int. since going to jail can cause some skill loss, clearly there is a way, but since I haven't yet found that code in the mass of source scripts, I'm asking to try and avoid hrs of searching lines of code. The alternative I am considering is going to require more scripting, in a already script heavy mod, adds a var that holds the "debt" and doesn't add new XP until the "debt" is paid. I don't find this solution to be ideal, so I was again asking if there is a better way. Anyways I can't be the only one who is interested in adding XP loss to their mod. Link to comment Share on other sites More sharing options...
thorGraves Posted October 9, 2016 Share Posted October 9, 2016 No clue how the prisons work on degrading XP, but what about a negative "Buff" on learning instead of reducing XP? This should be a magic effect, kinda like the standing stones and pretty free of scripts. Link to comment Share on other sites More sharing options...
lofgren Posted October 9, 2016 Share Posted October 9, 2016 Prison XP loss is hard coded, I believe. When you are asking for help it is typically best to describe the user experience you are seeking to create, because a lot of the time in the CK you need to resort to workarounds and hacks. So the answer to your question may not be the answer to your question. In this case I don't think there is a way to erode XP directly, but there might be alternatives that would create a similar experience for the player, however there is no way we can help you with that united we know what you are trying to accomplish. Link to comment Share on other sites More sharing options...
nhguy03276 Posted October 9, 2016 Author Share Posted October 9, 2016 Prison XP loss is hard coded, I believe. When you are asking for help it is typically best to describe the user experience you are seeking to create, because a lot of the time in the CK you need to resort to workarounds and hacks. Not Always. And this thread again highlights that. I was asking a simple Syntax Question, as Papyrus syntax is a bit... challenging.. to be polite. (I've never encountered a language with as much "you can't get there from here" coding...) I have a plan for a workaround, but before starting it, I wanted to make sure I simple didn't miss a one line command that would make that workaround unnecessary. That was all I really was looking for. Prison XP loss is hard coded, I believe. In this case I don't think there is a way to erode XP directly. Thank you, this answers my question. Actually, this might have even simplified my work-around. No clue how the prisons work on degrading XP, but what about a negative "Buff" on learning instead of reducing XP? This should be a magic effect, kinda like the standing stones and pretty free of scripts. I have a plan at the moment, but I might just look into this... Link to comment Share on other sites More sharing options...
lofgren Posted October 9, 2016 Share Posted October 9, 2016 Prison XP loss is hard coded, I believe. When you are asking for help it is typically best to describe the user experience you are seeking to create, because a lot of the time in the CK you need to resort to workarounds and hacks. Not Always. And this thread again highlights that. I was asking a simple Syntax Question, as Papyrus syntax is a bit... challenging.. to be polite. (I've never encountered a language with as much "you can't get there from here" coding...) Yes, exactly, there are a lot of those types of situations, which is precisely why it is helpful to know what the end result you are looking for is. Somebody might be able to help you simulate the effect you are looking for without relying on the precise syntax you are asking for, but there is simply no way to know that if we don't know what you are trying to achieve. I find it very strange that you would simultaneously say you are asking a simple syntax question while acknowledging that solving problems in Papyrus is rarely a simple syntax issue AND expressing gratitude to somebody for offering another possible approach. Link to comment Share on other sites More sharing options...
nhguy03276 Posted October 11, 2016 Author Share Posted October 11, 2016 Well, in case someone stumbles across this thread in the future looking for a way to reduce XP for their own mods, here's what I did. As far as I can tell, there is no one line command to remove XP. I'm only a beginner, so I might still have missed something, but anything I've seen that comes close to actual XP removal looks very complicated. Not to mention, given they way XP is dealt with in skyrim, there are a bunch of possible issues that could come up when removing XP. The simplest solution seems to be a XP debt system that prevents further accrual of XP until the "debt" is paid. It might be far from Ideal, but it was far simpler than I initially thought. 1: In CK, set a new int property in your .esp file called "XPDebt" 2: in your script, set your reference to that property as normal 3: set a local Int XP 4: XP = (whatever calculations to have to assign XP, just make sure a negative XP is actually negative) XPDebt = XPDebt + XP game.AdvanceSkill("WhatEverskill", XPDebt) ; this only advances positive Ints, and ignores Negative ones. ;since you only want to store a negative XP, this clears out any positive XP it might have if XPDebt > 0 XPDebt = 0 endif Link to comment Share on other sites More sharing options...
Recommended Posts