Jump to content

[LE] CalculateEncounterLevel()...how does it work?


cumbrianlad

Recommended Posts

I'm making a series of dart traps that will 'poison' the player's health stamina and magicka.

 

The traps are based on the vanilla items with a set of 6 levelled darts with 6 corresponding levelled enchantments.

 

I can handle the trap, ammunition, enchantment, magic effect and the alterations I need to do to the scripts TrapBase and DartTrap. I've even got a nice excel spread sheet that graphs the change in the relevant attribute from the hit until the taper wears off.

 

My only problem is assigning the magnitude of the spell to suit my dungeon because I can't figure out what value is generated by CalculateEncounterLevel(TrapLevel) in the script DartTrap. After that the rest of the script is pretty easy to understand. I nned a pretty good idea of this because these poisons are pretty severe. I'm trying to design them so that the player is certain to need one potion of ultimate healing/stamina/magicka but probably not two. They'll need to take it inside 10 seconds, especially for the health effect or else they die. I can't work this out unless I know this value. I'd just be guessing...not good.

 

The property TrapLevel is assigned in TrapBase and is 1 (medium) by default (I may change it to 2). My dungeon encounter zone is 50 and never resets. The player's level is self-explanatory So I think that CalculateEncounterLevel(TrapLevel) does a calculation based on those three values, but what's the calculation? Creationkit.com doesn't seem to say.

 

Edit: Okay, I've had an alternative idea but it depends on my scripting, which is not the best to say the least.

 

I could forget CalculateEncounterLevel because the trap level is mainly being determined by my poison effects on the dart ammo. If I take the highest value of the encounter level and player level and use that to choose the dart weapon (and poison magnitude), then I get a trap that is aimed at players of a minimum level 50 but scales with them above that.

 

Would this work?

 

int DamageLevel

 

if Game.GetPlayer().GetLevel() < 50

DamageLevel = 50

else

DamageLevel = Game.GetPlayer().GetLevel()

endIf

 

I could then use DamageLevel to sort the trap selection in the way it is used in the original script. I'm not really happy about using 50 because I'd rather not have something I'd forget about if I decide to alter the encounter zone. If there was some function to get the encounter zone level it would be better but looking through the functions on the creation kit website I can't see anything like GetEncounterZone() listed as a function.

Link to comment
Share on other sites

I've had another thought, which should suit me fine, especially for the health poison, which has the potential of being a bit of a game breaker. If it works it nicely gets around the difficulty of making the traps ridiculously easy or damn near impossible.

 

int DamageLevel

int PlayerHealth = game.GetPlayer().GetBaseActorValue("health") as int ; get the player's base health

int PlayerHealthNow = game.GetPlayer().GetActorValue("health") as int ; get the player's current health including buffs

 

; use maximum health value to choose dart weapon difficulty

if PlayerHealth < PlayerHealthNow

DamageLevel = PlayerHealthNow

else

DamageLevel = PlayerHealth

endIf

 

If they've blundered into the trap half-dead so that their current health is lower than their base health...well, the expression 'look before you leap' comes to mind.

 

I then sort my trap using this so that they poison the player between a known percentage range of their health, say 150% to 180% . Of course this does require the player to have added a certain amount of health by levelling up in order to select my weakest poison effect but since my encounter zone is 50, I wouldn't expect a player to have less than 300 health by this stage, whatever their character build. If they have and they don't have enough potions then it's 'hasta la vista, baby'... re-load and get some more potions. At least it makes the traps a nasty surprise, rather than something to basically ignore.

 

I could do something similar for my ravage magicka and ravage stamina poisons on the other two sets of dart traps.

 

What do you think? Is my script gibberish or does it make sense?

 

Edit: It works perfectly! I tested it with my level 66 character and he needed one potion of ultimate healing to survive. I then COC'd into the tomb from the main menu and used the console to boost health up to just below the threshold for the level 2 dart weapon. He also needed one potion of ultimate healing. As predicted, when repeating the test with the basic level 1 character, I didn't react fast enough to apply a healing potion and he died. All three tests had the health damage in line with what the excel spread sheet predicted. I'm really pleased because this is the first bit of proper scripting I've done, except for a couple of message boxes on activators. I can now fire ahead and add the scripts for the magicka and stamina poisons.

Link to comment
Share on other sites

Thanks Red Dragon. That information is useful.

 

You can add scriptname TrapHitBase extends TrapBase too.

 

I may have been unclear about what I've done with these scripts and the objects themselves. I've not touched the vanilla items at all. I've duplicated each part of the chain and given the duplicates new ids and names. I've then edited these new objects and scripts. So I still have TrapBase and DartTrap in my skyrim folder. I also have KetilTrapBase and KetilDartTrap in my scripts folder. KetilTrapBase was made for my new spear traps along with KetilTrapHitBase. I was hoping to avoid making any new scripts for the dart traps and I would have done if I could have figured out just what calculation is used in CalculateEncounterLevel(). Mind you, I'm very happy with my way of levelling the poison effect with the player. It pretty much guarantees that everybody levelled enough for the level 50 encounter zone will struggle equally with the traps, at least until they're over level 100.

 

Believe me, if I could avoid modifying or writing scripts I would do, because I'm so slow at it. LOL. I'm just glad I'll not have to do a set of dart traps again...18 new dart weapons, 18 new dart enchantments, 3 new dart traps and 1 new magic effect plus a new version of DartTrap...

 

And all because I'm bored with the feeble things in the vanilla game that might as well be left out once a player's beyond level 10.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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