|
journeyman
|
OP
journeyman
Joined: Dec 2014
|
I played around character levels/character stats today and I noticed that every single fight in the game has "hard coded" levels. Even if the stats are dynamic and change depending on the levels, the fights are fixed ( in the main campaign). I whipped up this simple script to adjust enemy level to the player level.
PROC
ProcAugmentLevel((CHARACTER)_Character,(INTEGER)_Level)
AND
CharacterGetLevel(_Character,_CurrentLevel)
AND
_CurrentLevel < _Level
THEN
CharacterLevelUp(_Character);
ProcAugmentLevel(_Character,_Level);
This command can be called, for example, when a character enters a trigger and enemies are spawned. Code full code ex :
//In the Init section
TriggerRegisterForPlayers(TRIGGER_MyTrigger);
DB_WolvesAttackTrigger(TRIGGER_MyTrigger);
DB_WolvesTrigger(CHARACTER_Wolf,TRIGGER_WolfSpawn,1);
//KB
IF
CharacterEnteredTrigger(_Player,_Trigger)
AND
DB_WolvesAttackTrigger(_Trigger)
AND
DB_WolvesTrigger(_Character,_SpawnTrigger,_PlayAnimation)
AND
_Player.isPlayer()
AND
CharacterGetLevel(_Player,_Level)
THEN
ProcAugmentLevel(_Character,_Level);
ProcWolfAppear(_Character,_SpawnTrigger,_PlayAnimation);
PROC
ProcAugmentLevel((CHARACTER)_Character,(INTEGER)_Level)
AND
CharacterGetLevel(_Character,_CurrentLevel)
AND
_CurrentLevel < _Level
THEN
CharacterLevelUp(_Character);
ProcAugmentLevel(_Character,_Level);
Note : This could also be applied to scale down enemies. It's easier to simply create each character at level one and let the stat engine do the hard work for us  This is useful in the mod I'm making with Bard because we do not know in which order the player will fight each group of enemies. Letting them scale up automatically let's us focus on other parts of the mod like dialogs, treasure etc... EditThe gain field from the stats script is dependent on the "Act part" property, not the character level in game ( I really wish it was the other way around...) My previous theory was busted, but I have a solution for my automatic level of enemy to follow the experience line. Every time a character dies, Osiris will catch the event and add the experience according to the level.
//INIT
//Database containing all the max EXP / LEVEL of the player
DB_LevelExp(0,0);
DB_LevelExp(1,2000);
DB_LevelExp(2,6000);
DB_LevelExp(3,12000);
DB_LevelExp(4,20000);
DB_LevelExp(5,30000);
DB_LevelExp(6,42000);
DB_LevelExp(7,56000);
DB_LevelExp(8,72000);
DB_LevelExp(9,90000);
DB_LevelExp(10,110000);
DB_LevelExp(11,132000);
DB_LevelExp(12,156000);
DB_LevelExp(13,182000);
DB_LevelExp(14,210000);
DB_LevelExp(15,240000);
DB_LevelExp(16,272000);
DB_LevelExp(17,306000);
DB_LevelExp(18,342000);
DB_LevelExp(19,380000);
DB_LevelExp(20,420000);
DB_LevelExp(21,462000);
DB_LevelExp(22,506000);
DB_LevelExp(23,552000);
DB_LevelExp(24,600000);
DB_LevelExp(25,650000);
DB_LevelExp(26,702000);
DB_LevelExp(27,756000);
DB_LevelExp(28,812000);
DB_LevelExp(29,870000);
DB_LevelExp(30,930000);
//Database containing enemies you want to apply the manual exp/level system too.
//Second parameter is a percentage. In this case, 10% of the level of the enemy
//( 11000 exp if enemy is level 10)
DB_CharacterGain(CHARACTER_Aeril_Animals_W_Black1,0.1);
//KB
IF
CharacterDied(_Character)
AND
DB_CharacterGain(_Character,_Gain)
AND
CharacterGetLevel(_Character,_Level)
AND
DB_LevelExp(_Level,_ExpForLevel)
AND
_Gain > 0
AND
Real(_ExpForLevel,_ExpForLevelAsReal)
AND
RealProduct(_ExpForLevelAsReal,_Gain,_ExpProduct)
AND
Integer(_ExpProduct,_ExpProductAsInt)
THEN
PartyAddExperience(_ExpProductAsInt);
NOT DB_CharacterGain(_Character,_Gain);
This is it, both methods are tested and works. Automatic scaling of enemies + percentage based on the level of the enemy acquired as experience! Hope this helps!
Last edited by TheMasterRat; 23/01/15 02:41 AM.
|
|
|
Moderated by Bvs, ForkTong, gbnf, Issh, Kurnster, Larian_QA, LarSeb, Lar_q, Lynn, Monodon, Raze, Stephen_Larian
|
|