Jump to content


Photo

D's Enemy Upgrade


  • Please log in to reply
36 replies to this topic

#1 Duality

Duality

    Deranged Mactel User

  • Member
  • 150 posts

Posted 23 March 2008 - 10:48 AM

File Name: D's Enemy Upgrade
File Submitter: Duality
File Submitted: 23 Mar 2008
File Updated: 7 Jun 2009
File Category: Miscellaneous Released Mods
Forum: No Information
Readme: No Information

Version 1.1 Has been uploaded. New this version are:
The "Choose Yourself" option by Icendoan and two bug fixes.
The first that you could end up with totally immune enemies.
The second that the charbase file that controls newly created characters was getting a res boost.


IMPORTANT!!!!!
If you are using "Choose Yourself" READ THE SECTION BELOW ABOUT IT OR YOU *WILL* DO SOMETHING WRONG! Especially the *THIS IS IMPORTANT* section. Duh.



Tired of wussy little enemies that die in one blow? That can't hit the broadside of a barn?
That are just so darn pathetic that they might as well roll over and die?

Do you want strong, smart, challenging enemies? Then go find another mod. If you want enemies that are just as stupid as they used to be, but at least last a little longer, then here you go.

There are four install modes: (I'd recommend against installing the third option unless you are REALLY masochistic)

Hard:
500 - 2000 EXP bonus
0 - 2 Bonus to saves
1 - 5 AC Bonus
1 - 5 THACO Bonus
1.3x - 2x HP Bonus
Resistances randomly raised by 1 - 10.



Harder:
100 - 1000 EXP bonus
4 - 4 Bonus to saves
3 - 8 AC Bonus
3 - 8 THACO Bonus
2.3x - 3x HP Bonus
Resistances randomly raised by 25 - 40.



Do you LIKE sticking sharp sticks in your eye?:
0 - 500 EXP bonus
4 - 8 Bonus to saves
5 - 10 AC Bonus
5 - 10 THACO Bonus
3x - 5x HP Bonus
Resistances randomly raised by 30 - 90.



Choose Yourself (by Icendoan)
This allows you to input what values you want. First you input the bottom of the range you want the stat to be modified by and then the top of the range.
For instance, if you want enemies AC to be modified by somewhere between 4 and 6, you would enter 4 at the "lower limit" prompt, and 6 the "upper limit" prompt.

There are a couple of things that are important about this however. The first is that all values MUST BE INTEGERS! Weidu can't handle decimals, and as such, if you input anything but an integer, the install will fail. Oh, and don't use negative numbers, I have no idea what will happen.


______________________________________________________________________
*THIS IS IMPORTANT*
The HP input is a little screwy. Due to the fact that weidu can't handle decimals, I had to make an ugly workaround.
As such, take the amount you want HP multiplied by and then multiply that by 10.

For instance, if you want all enemies HP's to increase by between 1.3 (a 30% boost) and 2 (a 100% boost) you would enter 13 and 20.

I hope that makes sense.......
______________________________________________________________________

Also, as a last note, the values that you input are recorded in the log.txt file in the enemy upgrade folder. In case you care.


Note:
This mod doesn't really address the more pressing issue that most of the BlackIsle AI scripts in the game are moronic.
But since that would be a giant pain to fix, this works.

-Duality

Click here to download this file

#2 viperdan

viperdan
  • Member
  • 20 posts

Posted 09 November 2008 - 03:23 PM

Does this mod also upgrade creatures the party can summon?Also,would it upgrade creatures such as kitthix(Black Spider Figurine)

#3 Duality

Duality

    Deranged Mactel User

  • Member
  • 150 posts

Posted 10 November 2008 - 11:48 AM

It upgrades ALL creatures, with the exception of party members, so that includes summons and Kitthix. :)

There is however, a small problem that I recently found but have yet to get around to fixing. If you choose the middle or highest difficulty level, there is the possibility that certain enemies, (primarily Adamantium Golems) can end up being immune to ALL damage. I may get around to fixing this at some point, but just so you know. Of course, playing on anything but the lowest difficulty level is freaking hard so.... :P

#4 viperdan

viperdan
  • Member
  • 20 posts

Posted 10 November 2008 - 12:19 PM

It upgrades ALL creatures, with the exception of party members, so that includes summons and Kitthix. :)

There is however, a small problem that I recently found but have yet to get around to fixing. If you choose the middle or highest difficulty level, there is the possibility that certain enemies, (primarily Adamantium Golems) can end up being immune to ALL damage. I may get around to fixing this at some point, but just so you know. Of course, playing on anything but the lowest difficulty level is freaking hard so.... :P


Thanks for the help Duality,and of course,for the mod.

Edit:Is there a way to add code to prevent certain creatures from being upgraded?

Edited by viperdan, 10 November 2008 - 12:58 PM.


#5 Duality

Duality

    Deranged Mactel User

  • Member
  • 150 posts

Posted 12 November 2008 - 09:12 AM

Unfortunately, not really. The only way to do it would be to have it exclude specific file names, which is do-able if you there's only a couple you want to exclude but if there is a bunch..... The only way I could figure out to get it to exclude join-able NPC's was to check for a bio. What exactly do you want to exclude?

#6 viperdan

viperdan
  • Member
  • 20 posts

Posted 15 November 2008 - 09:19 PM

Unfortunately, not really. The only way to do it would be to have it exclude specific file names, which is do-able if you there's only a couple you want to exclude but if there is a bunch..... The only way I could figure out to get it to exclude join-able NPC's was to check for a bio. What exactly do you want to exclude?


I originally was going to exclude a few creatures but i've changed my mind.I've already installed it and i'm happy with the changes.Thank's Duality

#7 viperdan

viperdan
  • Member
  • 20 posts

Posted 17 November 2008 - 01:10 PM

This is interesting.My newly created paladin has fire,cold,electricity...etc resistances.Was i suppose to get those?I'm certainly not complaining but i'd like to know if it was planned or a "bug"

Edit:Also if it was planned would i also get bonuses to my hit,saving throws and AC?I don't see any difference on my character sheet but i'm still wondering

Edited by viperdan, 17 November 2008 - 01:13 PM.


#8 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 17 November 2008 - 02:09 PM

I drafted up a sort of 'custom' one where it reads user input and uses that for randoms. Feel free to use it or ignore it. It is mostly your code anyway. Nice and simple, makes sure that nothing gets set above 127, like your code, but does it in a while loop, so installing may take a little while.

[codebox]
BEGIN ~Choose Yourself (Icendoan)~
SUBCOMPONENT ~Enemy Upgrade~
COPY_EXISTING_REGEXP GLOB ~.+.cre$~ ~override~
PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN //Protects against invalid files
READ_LONG 0x1CC "biography"
PATCH_IF ("%biography%" < 3) THEN BEGIN //Makes sure they aren't a NPC

READ_SHORT 0x14 "exp"
READ_SHORT 0x24 "current"
READ_SHORT 0x26 "max"
READ_SHORT 0x46 "nac"
READ_SHORT 0x48 "eac"
READ_SHORT 0x52 "thaco"
READ_SHORT 0x53 "attacks"

READ_BYTE 0x54 "saveVsDeath"
READ_BYTE 0x55 "saveVsWands"
READ_BYTE 0x56 "saveVsPoly"
READ_BYTE 0x57 "saveVsBreath"
READ_BYTE 0x58 "saveVsSpell"


PRINT ~Type the lower limit on your EXP bonus~
PRINT ~INTEGER ONLY~
PATCH_READLN lowLimitEXP
PRINT ~Type the upper limit on your EXP Bonus~
PRINT ~INTEGER ONLY~
PATCH_READLN upLimitEXP
PRINT ~Type the lower limit to your resistances~
PRINT ~INTEGER ONLY~
PATCH_READLN lowLimitRES
PRINT ~Type the upper limit to your resistances~
PRINT ~INTEGER ONLY~
PATCH_READLN upLimitRES
PRINT ~Type the lower limit on your opponents Thac0 bonus~
PRINT ~INTEGER ONLY~
PATCH_READLN lowTh0
PRINT ~Type the upper limit on your opponents Thac0 bonus~
PRINT ~INTEGER ONLY~
PATCH_READLN upTh0
PRINT ~Type the lower limit on your opponents Natural bonus~
PRINT ~INTEGER ONLY~
PATCH_READLN lowNAC
PRINT ~Type the upper limit on your opponents Natural AC bonus~
PRINT ~INTEGER ONLY~
PATCH_READLN upNAC
PRINT ~Type the lower limit on your opponents AC bonus~
PRINT ~INTEGER ONLY~
PATCH_READLN lowAC
PRINT ~Type the upper limit on your opponents AC bonus~
PRINT ~INTEGER ONLY~
PATCH_READLN upAC
PRINT ~Type the lower HP Multiplier~
PRINT ~Decimals welcome!~
PATCH_READLN lowHP
PRINT ~Type the higher HP multiplier~
PRINT ~Decimals welcome!~
PATCH_READLN upHP
<<<<<<<< enemyupgrade/-/log.txt
>>>>>>>>
INNER_ACTION
COPY enemyupgrade/-/log.txt ~enemyupgrade/log.txt~
END
APPEND_OUTER enemyupgrade/log.txt "Lower EXP: %lowLimitEXP%"
APPEND_OUTER enemyupgrade/log.txt "Higher EXP: %upLimitEXP%"
APPEND_OUTER enemyupgrade/log.txt "Lower Resisitance: %lowLimitRES%"
APPEND_OUTER enemyupgrade/log.txt "Higher Resistance: %upLimitEXP%"
APPEND_OUTER enemyupgrade/log.txt "Lower Thac0: %lowTh0%"
APPEND_OUTER enemyupgrade/log.txt "Higher Thac0:%upTh0%"
APPEND_OUTER enemyupgrade/log.txt "Lower NAC: %lowNAC%"
APPEND_OUTER enemyupgrade/log.txt "Higher NAC: %upNAC%"
APPEND_OUTER enemyupgrade/log.txt "Lower EAC: %lowAC%"
APPEND_OUTER enemyupgrade/log.txt "Higher EAC: %upAC%"
APPEND_OUTER enemyupgrade/log.txt "Lower HP: %lowHP%"
APPEND_OUTER enemyupgrade/log.txt "Higher HP: %upHP%"

WHILE %upLimitRES% > 127 BEGIN
upLimitRES = upLimitRES - 1
END
WHILE %lowLimitRES% < 0 BEGIN
lowLimitRES = lowLimitRES + 1
END

//END USER ACTIONS
WRITE_SHORT 0x14 ("%exp%" + RANDOM(%lowLimitEXP% %upLimitEXP%)) // EXP Boost

WRITE_SHORT 0x46 ("%nac%" - RANDOM(%lowNAC% %upNAC%)) //Natural AC
WRITE_SHORT 0x48 ("%eac%" - RANDOM(%lowAC% %upAC%)) //Effective AC
WRITE_SHORT 0x52 ("%thaco%" - RANDOM(%lowTh0% %lowTh0%)) //THACO

//Saves boost
WRITE_BYTE 0x54 ("%saveVsDeath%" - RANDOM(%lowSaves% %upSaves%))
WRITE_BYTE 0x55 ("%saveVsWands%" - RANDOM(%lowSaves% %upSaves%))
WRITE_BYTE 0x56 ("%saveVsPoly%" - RANDOM(%lowSaves% %upSaves%))
WRITE_BYTE 0x57 ("%saveVsBreath%" - RANDOM(%lowSaves% %upSaves%))
WRITE_BYTE 0x58 ("%saveVsSpell%" - RANDOM(%lowSaves% %upSaves%))


//Multiplies HP by random amount
SET "hp_percent" = RANDOM(%lowHP% %upHP%)

WRITE_SHORT 0x24 ("%current%" * "%hp_percent%" / 10) //Current HP's
WRITE_SHORT 0x26 ("%max%" * "%hp_percent%" / 10) //Max HP's

//Resistances, makes sure that none will be set to over 127 (since they reset to -'s if you do) ALREADY DONE!
PATCH_IF !("upLimitRES" < 127) AND (%lowLimitRES% > 0) THEN BEGIN //Double Checks
WRITE_BYTE 0x59 RANDOM("%lowLimitRES%" %upLimitRES%)
WRITE_BYTE 0x5a RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x5b RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x5c RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x5d RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x5d RANDOM("%lowLimitRES%" %upLimitRES%)
WRITE_BYTE 0x5e RANDOM("%lowLimitRES%" %upLimitRES%)
WRITE_BYTE 0x5f RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x60 RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x61 RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x62 RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x63 RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x63 RANDOM("%lowLimitRES%" %upLimitRES%)
END
END[/codebox]

As usual for me, completely untested but cool.

Icen

Edited by Icendoan, 17 November 2008 - 11:40 PM.

Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#9 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 17 November 2008 - 10:57 PM

I drafted up a sort of 'custom' one where it reads user input and uses that for randoms. Feel free to use it or ignore it. It is mostly your code anyway. Nice and simple, makes sure that nothing gets set above 127, like your code, but does it in a while loop, so installing may take a little while.

That has the same problem as the Duality's code, there is a chance that the enemy is totally immune to every kind of damage in the game... perhaps the crushing damage can be set at 90% maximum? It's for the golems.

~Decimals welcome!~

And the max hit points, is it period(x.y) or comma(x,y) ? An example could be nice,.

Deactivated account. The user today is known as The Imp.


#10 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 17 November 2008 - 11:32 PM

It is multiplied by *X, so something like 2.5 is fine. 2,5 will get errors. And I forgot a bit in my code, so recheck it.

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#11 Duality

Duality

    Deranged Mactel User

  • Member
  • 150 posts

Posted 18 November 2008 - 02:12 PM

Hmm.... That's a nicer setup, when I originally wrote that I was too lazy to make it user input, I might go ahead and add that though. It should be a fairly simple check to make sure that there is at least one type of damage that isn't above 100%, and since it's primarily for golems, just setting crushing to 90% for any monster that has 100+ in all res should be easy.... I might get around to fixing that tonight if I'm not lazy. (which means not likely :P)

Anyway, thanks for the post Icen :)

#12 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 18 November 2008 - 02:25 PM

It ignores previous resistances, and simply sets it randomly, so extra checks should be added. It is made that no value (upLimitRES) can be above 127, and it RANDOM()s between 0 and 127, max.

And, like I said, you did most of the work here! All I need is my name in the component name. :P

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#13 viperdan

viperdan
  • Member
  • 20 posts

Posted 18 November 2008 - 03:11 PM

Obviously no one saw my post so i'll repost it:

This is interesting.My newly created paladin has fire,cold,electricity...etc resistances.Was i suppose to get those?I'm certainly not complaining but i'd like to know if it was planned or a "bug"

Edit:Also if it was planned would i also get bonuses to my hit,saving throws and AC?I don't see any difference on my character sheet but i'm still wondering

#14 Duality

Duality

    Deranged Mactel User

  • Member
  • 150 posts

Posted 18 November 2008 - 03:50 PM

Heh, I did miss your post viper, sorry about that.
Er.... Crap. No, that shouldn't be happening, but it is, and yes, you also get the other bonuses apparently. Note that this doesn't apply if you create a character and export it (say using the MP pre-gen function) THEN install the enemy upgrade.


Hmmm.... Is there a .cre file that acts as a template for newly created characters... or... something? It doesn't seem like there would be any other way for a newly created char to end up with the upgrades.... wth. Is there a way to search and see which .cre file has the exact same stat setup?

Grr.... Alright, I'll look into this since I'm bored at the moment and see if I can't figure out what the problem is.


[EDIT] Nevermind, found it. charbase.cre. I guess that should have been self-explanatory. I'll fix this little issue and add in Icen's code so you can choose either the presets or make up your own and upload it later. Thanks guys :) Er.... At least once I figure out how to exclude a specific file name from a patch_if statement. It's apparently been too freaking long since I used weidu....

Edited by Duality, 18 November 2008 - 04:57 PM.


#15 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 18 November 2008 - 11:50 PM

I answered your question in the other topic. It isn't all that hard. Repeat with OR with as many as you like.

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#16 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 19 November 2008 - 12:03 AM

[codebox]
BACKUP ~enemyupgrade/backup~
AUTHOR ~Duality (dualities.shadow@gmail.com~



BEGIN ~Wuss Mode~
SUBCOMPONENT ~Enemy Upgrade~

RANDOM_SEED %seeded%

COPY_EXISTING_REGEXP GLOB ~.+.cre$~ ~override~
PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN //Protects against invalid files
READ_LONG 0x1CC "biography"
PATCH_IF ("%biography%" < 3) THEN BEGIN //Makes sure they aren't a NPC
PATCH_IF %SOURCE_REZ% !STRING_COMPARE ~charbase~ BEGIN

READ_SHORT 0x14 "exp"
READ_SHORT 0x24 "current"
READ_SHORT 0x26 "max"
READ_SHORT 0x46 "nac"
READ_SHORT 0x48 "eac"
READ_SHORT 0x52 "thaco"
READ_SHORT 0x53 "attacks"

READ_BYTE 0x54 "saveVsDeath"
READ_BYTE 0x55 "saveVsWands"
READ_BYTE 0x56 "saveVsPoly"
READ_BYTE 0x57 "saveVsBreath"
READ_BYTE 0x58 "saveVsSpell"
READ_BYTE 0x59 "fire"
READ_BYTE 0x5a "cold"
READ_BYTE 0x5b "elec"
READ_BYTE 0x5c "acid"
READ_BYTE 0x5d "magic"
READ_BYTE 0x5e "magicFire"
READ_BYTE 0x5f "magicCold"
READ_BYTE 0x60 "slashing"
READ_BYTE 0x61 "crushing"
READ_BYTE 0x62 "piercing"
READ_BYTE 0x63 "missle"

WRITE_SHORT 0x14 ("%exp%" + RANDOM(500 2000)) // EXP Boost

WRITE_SHORT 0x46 ("%nac%" - RANDOM(1 5)) //Natural AC
WRITE_SHORT 0x48 ("%eac%" - RANDOM(1 5)) //Effective AC
WRITE_SHORT 0x52 ("%thaco%" - RANDOM(1 5)) //THACO

//Saves boost
WRITE_BYTE 0x54 ("%saveVsDeath%" - RANDOM(0 2))
WRITE_BYTE 0x55 ("%saveVsWands%" - RANDOM(0 2))
WRITE_BYTE 0x56 ("%saveVsPoly%" - RANDOM(0 2))
WRITE_BYTE 0x57 ("%saveVsBreath%" - RANDOM(0 2))
WRITE_BYTE 0x58 ("%saveVsSpell%" - RANDOM(0 2))


//Multiplies HP by between 1.3 and 2
SET "hp_percent" = RANDOM(13 20)

WRITE_SHORT 0x24 ("%current%" * "%hp_percent%" / 10) //Current HP's
WRITE_SHORT 0x26 ("%max%" * "%hp_percent%" / 10) //Max HP's

//Resistances, makes sure that none will be set to over 127 (since they reset to -'s if you do)
//If you change the upper limit, which in this case is 10, you MUST change the 117 to 127 - whatever the upper limit you set
//For example:
// If you want the range to be 1 to 50 you would set all the 117's to 87
PATCH_IF("%fire%" < 117) THEN BEGIN
WRITE_BYTE 0x59 ("%fire%" + RANDOM(1 10))
END

PATCH_IF("%cold%" < 117) THEN BEGIN
WRITE_BYTE 0x5a ("%cold%" + RANDOM(1 10))
END

PATCH_IF("%elec%" < 117) THEN BEGIN
WRITE_BYTE 0x5b ("%elec%" + RANDOM(1 10))
END

PATCH_IF("%acid%" < 117) THEN BEGIN
WRITE_BYTE 0x5c ("%acid%" + RANDOM(1 10))
END

PATCH_IF("%magic%" < 117) THEN BEGIN
WRITE_BYTE 0x5d ("%magic%" + RANDOM(1 10))
END

PATCH_IF("%magicFire%" < 117) THEN BEGIN
WRITE_BYTE 0x5e ("%magicFire%" + RANDOM(1 10))
END

PATCH_IF("%magicCold%" < 117) THEN BEGIN
WRITE_BYTE 0x5f ("%magicCold%" + RANDOM(1 10))
END

PATCH_IF("%slashing%" < 117) THEN BEGIN
WRITE_BYTE 0x60 ("%slashing%" + RANDOM(1 10))
END

PATCH_IF("%crushing%" < 117) THEN BEGIN
WRITE_BYTE 0x61 ("%crushing%" + RANDOM(1 10))
END

PATCH_IF("%piercing%" < 117) THEN BEGIN
WRITE_BYTE 0x62 ("%piercing%" + RANDOM(1 10))
END

PATCH_IF("%missle%" < 117) THEN BEGIN
WRITE_BYTE 0x63 ("%missle%" + RANDOM(1 10))
END

END
END
END

BEGIN ~Getting there!~
SUBCOMPONENT ~Enemy Upgrade~

RANDOM_SEED %seeded%

COPY_EXISTING_REGEXP GLOB ~.+.cre$~ ~override~
PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN //Protects against invalid files
READ_LONG 0x1CC "biography"
PATCH_IF ("%biography%" < 3) THEN BEGIN //Makes sure they aren't a NPC
PATCH_IF %SOURCE_REZ% !STRING_COMPARE ~charbase~ BEGIN

READ_SHORT 0x14 "exp"
READ_SHORT 0x24 "current"
READ_SHORT 0x26 "max"
READ_SHORT 0x46 "nac"
READ_SHORT 0x48 "eac"
READ_SHORT 0x52 "thaco"
READ_SHORT 0x53 "attacks"

READ_BYTE 0x54 "saveVsDeath"
READ_BYTE 0x55 "saveVsWands"
READ_BYTE 0x56 "saveVsPoly"
READ_BYTE 0x57 "saveVsBreath"
READ_BYTE 0x58 "saveVsSpell"
READ_BYTE 0x59 "fire"
READ_BYTE 0x5a "cold"
READ_BYTE 0x5b "elec"
READ_BYTE 0x5c "acid"
READ_BYTE 0x5d "magic"
READ_BYTE 0x5e "magicFire"
READ_BYTE 0x5f "magicCold"
READ_BYTE 0x60 "slashing"
READ_BYTE 0x61 "crushing"
READ_BYTE 0x62 "piercing"
READ_BYTE 0x63 "missle"

WRITE_SHORT 0x14 ("%exp%" + RANDOM(100 1000)) // EXP Boost

WRITE_SHORT 0x46 ("%nac%" - RANDOM(3 8)) //Natural AC
WRITE_SHORT 0x48 ("%eac%" - RANDOM(3 8)) //Effective AC
WRITE_SHORT 0x52 ("%thaco%" - RANDOM(3 8)) //THACO

//Saves boost
WRITE_BYTE 0x54 ("%saveVsDeath%" - RANDOM(2 4))
WRITE_BYTE 0x55 ("%saveVsWands%" - RANDOM(2 4))
WRITE_BYTE 0x56 ("%saveVsPoly%" - RANDOM(2 4))
WRITE_BYTE 0x57 ("%saveVsBreath%" - RANDOM(2 4))
WRITE_BYTE 0x58 ("%saveVsSpell%" - RANDOM(2 4))


//Multiplies HP by between 2.3 and 3
SET "hp_percent" = RANDOM(23 30)

WRITE_SHORT 0x24 ("%current%" * "%hp_percent%" / 10) //Current HP's
WRITE_SHORT 0x26 ("%max%" * "%hp_percent%" / 10) //Max HP's

//Resistances, makes sure that none will be set to over 127 (since they reset to -'s if you do)
PATCH_IF("%fire%" < 87) THEN BEGIN
WRITE_BYTE 0x59 ("%fire%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%fire%"
WRITE_BYTE 0x59 ("%fire%" + RANDOM(1 "%resBoost%"))
END

PATCH_IF("%cold%" < 87) THEN BEGIN
WRITE_BYTE 0x5a ("%cold%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%cold%"
WRITE_BYTE 0x5a ("%cold%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%elec%" < 87) THEN BEGIN
WRITE_BYTE 0x5b ("%elec%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%elec%"
WRITE_BYTE 0x5b ("%elec%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%acid%" < 87) THEN BEGIN
WRITE_BYTE 0x5c ("%acid%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%acid%"
WRITE_BYTE 0x5c ("%acid%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%magic%" < 87) THEN BEGIN
WRITE_BYTE 0x5d ("%magic%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%magic%"
WRITE_BYTE 0x5d ("%magic%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%magicFire%" < 87) THEN BEGIN
WRITE_BYTE 0x5e ("%magicFire%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%magicFire%"
WRITE_BYTE 0x5e ("%magicFire%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%magicCold%" < 87) THEN BEGIN
WRITE_BYTE 0x5f ("%magicCold%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%magicCold%"
WRITE_BYTE 0x5f ("%magicCold%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%slashing%" < 87) THEN BEGIN
WRITE_BYTE 0x60 ("%slashing%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%slashing%"
WRITE_BYTE 0x60 ("%slashing%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%crushing%" < 87) THEN BEGIN
WRITE_BYTE 0x61 ("%crushing%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%crushing%"
WRITE_BYTE 0x61 ("%crushing%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%piercing%" < 87) THEN BEGIN
WRITE_BYTE 0x62 ("%piercing%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%piercing%"
WRITE_BYTE 0x62 ("%piercing%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%missle%" < 87) THEN BEGIN
WRITE_BYTE 0x63 ("%missle%" + RANDOM(25 40))
END ELSE BEGIN
SET "resBoost" = 127 - "%missle%"
WRITE_BYTE 0x63 ("%missle%" + RANDOM(1 "%resBoost%"))
END

END
END
END

BEGIN ~Ouch.~
SUBCOMPONENT ~Enemy Upgrade~

RANDOM_SEED %seeded%

COPY_EXISTING_REGEXP GLOB ~.+.cre$~ ~override~
PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN //Protects against invalid files
READ_LONG 0x1CC "biography"
PATCH_IF ("%biography%" < 3) THEN BEGIN //Makes sure they aren't a NPC
PATCH_IF %SOURCE_RES% !STRING_COMPARE "charbase" BEGIN //Makes sure they aren't a PC

READ_SHORT 0x14 "exp"
READ_SHORT 0x24 "current"
READ_SHORT 0x26 "max"
READ_SHORT 0x46 "nac"
READ_SHORT 0x48 "eac"
READ_SHORT 0x52 "thaco"
READ_SHORT 0x53 "attacks"

READ_BYTE 0x54 "saveVsDeath"
READ_BYTE 0x55 "saveVsWands"
READ_BYTE 0x56 "saveVsPoly"
READ_BYTE 0x57 "saveVsBreath"
READ_BYTE 0x58 "saveVsSpell"
READ_BYTE 0x59 "fire"
READ_BYTE 0x5a "cold"
READ_BYTE 0x5b "elec"
READ_BYTE 0x5c "acid"
READ_BYTE 0x5d "magic"
READ_BYTE 0x5e "magicFire"
READ_BYTE 0x5f "magicCold"
READ_BYTE 0x60 "slashing"
READ_BYTE 0x61 "crushing"
READ_BYTE 0x62 "piercing"
READ_BYTE 0x63 "missle"

WRITE_SHORT 0x14 ("%exp%" + RANDOM(0 500)) // EXP Boost

WRITE_SHORT 0x46 ("%nac%" - RANDOM(5 10)) //Natural AC
WRITE_SHORT 0x48 ("%eac%" - RANDOM(5 10)) //Effective AC
WRITE_SHORT 0x52 ("%thaco%" - RANDOM(5 10)) //THACO

//Saves boost
WRITE_BYTE 0x54 ("%saveVsDeath%" - RANDOM(4 8))
WRITE_BYTE 0x55 ("%saveVsWands%" - RANDOM(4 8))
WRITE_BYTE 0x56 ("%saveVsPoly%" - RANDOM(4 8))
WRITE_BYTE 0x57 ("%saveVsBreath%" - RANDOM(4 8))
WRITE_BYTE 0x58 ("%saveVsSpell%" - RANDOM(4 8))


//Multiplies HP by between 3 and 5
SET "hp_percent" = RANDOM(30 50)

WRITE_SHORT 0x24 ("%current%" * "%hp_percent%" / 10) //Current HP's
WRITE_SHORT 0x26 ("%max%" * "%hp_percent%" / 10) //Max HP's

//Resistances, makes sure that none will be set to over 127 (since they reset to -'s if you do)
PATCH_IF("%fire%" < 37) THEN BEGIN
WRITE_BYTE 0x59 ("%fire%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%fire%"
WRITE_BYTE 0x59 ("%fire%" + RANDOM(1 "%resBoost%"))
END

PATCH_IF("%cold%" < 37) THEN BEGIN
WRITE_BYTE 0x5a ("%cold%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%cold%"
WRITE_BYTE 0x5a ("%cold%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%elec%" < 37) THEN BEGIN
WRITE_BYTE 0x5b ("%elec%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%elec%"
WRITE_BYTE 0x5b ("%elec%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%acid%" < 37) THEN BEGIN
WRITE_BYTE 0x5c ("%acid%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%acid%"
WRITE_BYTE 0x5c ("%acid%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%magic%" < 37) THEN BEGIN
WRITE_BYTE 0x5d ("%magic%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%magic%"
WRITE_BYTE 0x5d ("%magic%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%magicFire%" < 37) THEN BEGIN
WRITE_BYTE 0x5e ("%magicFire%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%magicFire%"
WRITE_BYTE 0x5e ("%magicFire%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%magicCold%" < 37) THEN BEGIN
WRITE_BYTE 0x5f ("%magicCold%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%magicCold%"
WRITE_BYTE 0x5f ("%magicCold%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%slashing%" < 37) THEN BEGIN
WRITE_BYTE 0x60 ("%slashing%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%slashing%"
WRITE_BYTE 0x60 ("%slashing%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%crushing%" < 37) THEN BEGIN
WRITE_BYTE 0x61 ("%crushing%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%crushing%"
WRITE_BYTE 0x61 ("%crushing%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%piercing%" < 37) THEN BEGIN
WRITE_BYTE 0x62 ("%piercing%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%piercing%"
WRITE_BYTE 0x62 ("%piercing%" + RANDOM(1 "%resBoost%"))
END


PATCH_IF("%missle%" < 37) THEN BEGIN
WRITE_BYTE 0x63 ("%missle%" + RANDOM(30 90))
END ELSE BEGIN
SET "resBoost" = 127 - "%missle%"
WRITE_BYTE 0x63 ("%missle%" + RANDOM(1 "%resBoost%"))
END

END
END
END

BEGIN ~Choose Yourself (Icendoan)~
SUBCOMPONENT ~Enemy Upgrade~
COPY_EXISTING_REGEXP GLOB ~.+.cre$~ ~override~
PATCH_IF (SOURCE_SIZE > 0x2d3) THEN BEGIN //Protects against invalid files
READ_LONG 0x1CC "biography"
PATCH_IF ("%biography%" < 3) THEN BEGIN //Makes sure they aren't a NPC
PATCH_IF !STRING_COMPARE ~charbase~ BEGIN //Makes sure they aren't a PC

READ_SHORT 0x14 "exp"
READ_SHORT 0x24 "current"
READ_SHORT 0x26 "max"
READ_SHORT 0x46 "nac"
READ_SHORT 0x48 "eac"
READ_SHORT 0x52 "thaco"
READ_SHORT 0x53 "attacks"

READ_BYTE 0x54 "saveVsDeath"
READ_BYTE 0x55 "saveVsWands"
READ_BYTE 0x56 "saveVsPoly"
READ_BYTE 0x57 "saveVsBreath"
READ_BYTE 0x58 "saveVsSpell"


PATCH_PRINT ~Type the lower limit on your EXP bonus~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN lowLimitEXP
PATCH_PRINT ~Type the upper limit on your EXP Bonus~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN upLimitEXP
PATCH_PRINT ~Type the lower limit to your resistances~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN lowLimitRES
PATCH_PRINT ~Type the upper limit to your resistances~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN upLimitRES
PATCH_PRINT ~Type the lower limit on your opponents Thac0 bonus~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN lowTh0
PATCH_PRINT ~Type the upper limit on your opponents Thac0 bonus~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN upTh0
PATCH_PRINT ~Type the lower limit on your opponents Natural bonus~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN lowNAC
PATCH_PRINT ~Type the upper limit on your opponents Natural AC bonus~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN upNAC
PATCH_PRINT ~Type the lower limit on your opponents AC bonus~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN lowAC
PATCH_PRINT ~Type the upper limit on your opponents AC bonus~
PATCH_PRINT ~INTEGER ONLY~
PATCH_READLN upAC
PATCH_PRINT ~Type the lower HP Multiplier~
PATCH_PRINT ~Decimals welcome!~
PATCH_READLN lowHP
PATCH_PRINT ~Type the higher HP multiplier~
PATCH_PRINT ~Decimals welcome!~
PATCH_READLN upHP
<<<<<<<< enemyupgrade/-/log.txt
>>>>>>>>
INNER_ACTION
COPY enemyupgrade/-/log.txt ~enemyupgrade/log.txt~
END
APPEND_OUTER enemyupgrade/log.txt "Lower EXP: %lowLimitEXP%"
APPEND_OUTER enemyupgrade/log.txt "Higher EXP: %upLimitEXP%"
APPEND_OUTER enemyupgrade/log.txt "Lower Resisitance: %lowLimitRES%"
APPEND_OUTER enemyupgrade/log.txt "Higher Resistance: %upLimitEXP%"
APPEND_OUTER enemyupgrade/log.txt "Lower Thac0: %lowTh0%"
APPEND_OUTER enemyupgrade/log.txt "Higher Thac0:%upTh0%"
APPEND_OUTER enemyupgrade/log.txt "Lower NAC: %lowNAC%"
APPEND_OUTER enemyupgrade/log.txt "Higher NAC: %upNAC%"
APPEND_OUTER enemyupgrade/log.txt "Lower EAC: %lowAC%"
APPEND_OUTER enemyupgrade/log.txt "Higher EAC: %upAC%"
APPEND_OUTER enemyupgrade/log.txt "Lower HP: %lowHP%"
APPEND_OUTER enemyupgrade/log.txt "Higher HP: %upHP%"

WHILE %upLimitRES% > 127 BEGIN
upLimitRES = upLimitRES - 1
END
WHILE %lowLimitRES% < 0 BEGIN
lowLimitRES = lowLimitRES + 1
END

//END USER ACTIONS
WRITE_SHORT 0x14 ("%exp%" + RANDOM(%lowLimitEXP% %upLimitEXP%)) // EXP Boost

WRITE_SHORT 0x46 ("%nac%" - RANDOM(%lowNAC% %upNAC%)) //Natural AC
WRITE_SHORT 0x48 ("%eac%" - RANDOM(%lowAC% %upAC%)) //Effective AC
WRITE_SHORT 0x52 ("%thaco%" - RANDOM(%lowTh0% %lowTh0%)) //THACO

//Saves boost
WRITE_BYTE 0x54 ("%saveVsDeath%" - RANDOM(%lowSaves% %upSaves%))
WRITE_BYTE 0x55 ("%saveVsWands%" - RANDOM(%lowSaves% %upSaves%))
WRITE_BYTE 0x56 ("%saveVsPoly%" - RANDOM(%lowSaves% %upSaves%))
WRITE_BYTE 0x57 ("%saveVsBreath%" - RANDOM(%lowSaves% %upSaves%))
WRITE_BYTE 0x58 ("%saveVsSpell%" - RANDOM(%lowSaves% %upSaves%))


//Multiplies HP by random amount
SET "hp_percent" = RANDOM(%lowHP% %upHP%)

WRITE_SHORT 0x24 ("%current%" * "%hp_percent%" / 10) //Current HP's
WRITE_SHORT 0x26 ("%max%" * "%hp_percent%" / 10) //Max HP's

//Resistances, makes sure that none will be set to over 127 (since they reset to -'s if you do) ALREADY DONE!
PATCH_IF !("upLimitRES" < 127) AND (%lowLimitRES% > 0) THEN BEGIN //Double Checks
WRITE_BYTE 0x59 RANDOM("%lowLimitRES%" %upLimitRES%)
WRITE_BYTE 0x5a RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x5b RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x5c RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x5d RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x5d RANDOM("%lowLimitRES%" %upLimitRES%)
WRITE_BYTE 0x5e RANDOM("%lowLimitRES%" %upLimitRES%)
WRITE_BYTE 0x5f RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x60 RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x61 RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x62 RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x63 RANDOM(%lowLimitRES% %upLimitRES%)
WRITE_BYTE 0x63 RANDOM("%lowLimitRES%" %upLimitRES%)
END
END
END
[/codebox]

Is the updated TP2, assuming that my solution works.

Icen

Edited by Icendoan, 19 November 2008 - 12:11 AM.

Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#17 viperdan

viperdan
  • Member
  • 20 posts

Posted 19 November 2008 - 06:36 AM

I know i have resistances because they show up on my character sheet.However,i don't think i have a bonus to my thaco.In the tp2 i set all creatures to receive a bonus of 3-4 to thaco,but my thaco rolls in game are normal,the modifier to my roll is what it should be for my character.I also think that i haven't gotten a modifier to ac as well and perhaps even saves.Just the resistances.I'm thinking the reason is this is a new game i'm playing and my character was created after Enemy Upgrade was installed unlike other creatures whose stats were already set and were then modified by enemy upgrade.I'm not complaining,i'm pointing it out in the interest of complete knowledge of exactly what the mod does.

Ps:I love my new resistances from a roleplaying stand point.After all,i AM a half-god.They should be something that separates me from mere mortals.

Edited by viperdan, 19 November 2008 - 08:36 AM.


#18 Duality

Duality

    Deranged Mactel User

  • Member
  • 150 posts

Posted 19 November 2008 - 09:25 AM

Got it Icen, thanks again. It really has been too long since I did any of this stuff :)

New chars *may* not be getting the thaco etc bonuses, IF thaco etc are calculated upon creation and aren't based off the charbase file. I'd have to mess around with it to really make sure but I'm not sure it matters.

Well, the good news Viper is that if you want the res's, you can always edit the charbase file :)

When I get home tonight I'll upload the new version, I already have the checks in there to make sure that any creature that starts out with all res's over 100 doesn't get modified and that any creature that ends up with all res's over 100 gets crushing set to 90%. (stupid golems anyway)

Edited by Duality, 19 November 2008 - 09:26 AM.


#19 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 19 November 2008 - 09:31 AM

No problem!

If you need anything else, sure, PM me.

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#20 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 20 November 2008 - 01:06 PM

We have a tp2 pm-ed back and forth, so it should all be good.

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo