Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Joined: Sep 2017
R
Ranik Offline OP
apprentice
OP Offline
apprentice
R
Joined: Sep 2017
Can NPC level's be affected by buffs or scripts?

Is it possible to script a global buff that gives a chance to increase an NPC's level by 1?

EX: Houndmaster, Swordsman, 2x rangers. Each has a 25% chance to become level 4. You may rarely end up with several of them leveled up.


Joined: Jun 2013
old hand
Offline
old hand
Joined: Jun 2013
So this is possible. But depending on how you did it could be quite laborious (IE adding all enemies to specific databses or attaching scripts to all of them). There are a lot of enemies in the game as you know.


Two story editor calls can level up a character:
CharacterLevelUpTo
CharacterLevelUp


I'd probably attempt to do it something like this:
Code
IF
DB_CombatCharacters(_Character,_Combat)
AND
NOT DB_IsPlayer(_Character)
AND
NOT DB_LeveledCharacter(_Character)
THEN
DB_LeveledCharacter(_Character);
CharacterLevelUp(_Character);


When characters begin combat, they are added to the DB_CombatCharacters Database by the base scripts. This includes players however so I put in a check to make sure the character isn't one. Then I put in a check to see if the character had already been leveled before. Because if you say started a combat with a character and then fleed and that query wasn't there you'd level up the character every time you started combat with it.

The one problem with the script I posted above is it levels EVERY character. I just did it that way to make sure it works, and it does.

So you'd have to run a second statement to randomize it. There's a query called "Random" which will do just that. So if you wanted 1 in 4 you set the Parameters of the random query to be a range of 0-3, and when the random integer =='s 3 it does the level up. But if it =='s 0-2 it doesn't. Then it still adds them to the database so they don't get a second bite at the apple of leveling up.

The negative of doing it the way I showed above is you'd see the characters level up in front of you. But I think that's a small price to pay to avoid attaching scripts to every NPC or cataloging them in a DB manually beforehand.

You could also do it with a combination of character and story scripting which might be a bit more elegant, but again laborious.

You could also use this same approach to implement level scaling by checking the player character's level and upping the enemy to match.

Last edited by SniperHF; 17/09/17 06:03 PM.
Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
There's a story call that can do this. You could do this on CharacterEnteredRegion events for NPCs in regular game levels. You will probably want to check the NPCs for certain tags before doing that, such as MAGISTER, so that regular civilians don't increase levels too.

Joined: Aug 2014
old hand
Offline
old hand
Joined: Aug 2014
I'm going to release an enemy randomization mod that's hopefully a bit more interesting than just leveling some of them up. Will grant them random buffs through the Base.charScript.

Joined: Sep 2017
R
Ranik Offline OP
apprentice
OP Offline
apprentice
R
Joined: Sep 2017
Maybe one of the possible buffs could be a level up hahaha



Moderated by  Larian_KVN 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5