Jump to content

Halt Level Up While Condition Met


clockmon

Recommended Posts

I am trying to halt leveling up if certain conditions are met (like the game does if in combat), then allow leveling up once the conditions no longer exist. My conditions are Player.IsSpellTarget (multiple conditions). This is needed to prevent a bug in a mod I'm working on. If I can't fix this, it will just be listed as a known issue. Thanks for any help.

Edited by clockmon
Link to comment
Share on other sites

It is a limb healing spell for 1 hp for 100 seconds. If you have a new perk in the mod, the effect changes to 2 points for 50 secs for the same overall effect in half the time.

 

Assume you're healing at 1 for 100 secs and have finished 50 secs for 50 points. At that time you level up and take the new perk. Because of that, the duration changes from 100 to 50, and the healing stops since the duration limit has been reached. Instead of 100 points you got only 50.

 

As you can see, this would rarely happen, and I'm just trying to handle this possibility. I couldn't find any function in the GECK that tests for leveling up or know what script or variable, if any, can be used to postpone leveling up. It does this for IsInCombat - is that script accessible or hard-coded into the game engine?

 

There is a way for the player to manually add the perk, and I fixed that by simply not granting the perk until any healing effects are done.

 

The general Actor Effect is

Restorelimb[limb] 1 for 100 sec on [limbcondition], COND HasPerk [perk] == 0

Restorelimb[limb] 2 for 50 sec on [limbcondition], COND HasPerk [perk] == 1

 

I could add another condition that compares the Player.GetLevel value when the effect started to the current Player.GetLevel. If not the same, use the 1 for 100. I would prefer finding a way to halt level-up instead, which is the desired behavior.

 

Thanks in advance for any assistance.

Edited by clockmon
Link to comment
Share on other sites

Thanks. I took your advice and started tinkering with the Actor Effects.

 

I also found GetLevel after searching GECK commands and thought it may work. However, if you level up and had the same perk, it should continue as planned.

 

Instead, the real key is the specific perk when starting treatment through the menu. I set a global perk status to set the actor effect (full or half time) until the effect is done. That way, if you level up and take the next higher perk, no change. That is because the only way to change the variable is to treat the limb again, which can only be done if healing has finished and it is still injured.

 

So far it looks promising, but because of the all the dependencies on various quests and scripts, something is amiss - it thinks a spell is still active even though the logic and primary feedback says it's done. I confirmed it through the game clock, even though the "spell ending" messages all appeared at the right time. There's a secondary message that keeps popping up when it shouldn't. I'll keep debugging after my head clears a bit.

 

This may be too much effort for a situation that very rarely occurs (the unique conditions have never occurred during my extensive play).

 

Still haven't found a way to halt the leveling as it does while in combat. Must be hard-coded.

Edited by clockmon
Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the advice. After some trial-and-error I decided to save the current healing rate (determined by the perks or lack thereof) in a variable when the spell starts, which locks in the healing rate when the spell is cast for the duration of the Actor Effect. If the player gains one of the perks that affects the healing rate during the effect, the healing rate won't change. And then I added some conditions to fix the problem I discovered earlier. What a learning experience! The new solution works like a champ! The mod should be coming out soon after installation/upgrade/uninstall instruction testing.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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