- Joined
- Mar 15, 2020
- Messages
- 13
- Reaction score
- 3
- First Language
- English
- Primarily Uses
- RMMV
I'm using DreamX's [Capture Enemies] plugin and I would like to make it that if the player has already captured a specific creature and then captures that type of creature again I'd like to give the player the impression that the previous creature is replaced by the newly captured one. For my needs all that's really important is to change the creature's actor level. I have the new creature's level and I have the corresponding actor object.
DreamX's code simply increments the level of the existing captured creature by 1 regardless of the target creatures stats so I've commented out that code. I made two attempts at explicitly setting the actor's level. Attempt 1 seems to work but then the game almost immediately sets the level back to what is was before. Attempt 2 throws an exception saying "change_level is not a function". Would I need to calculate experience and use actor.changeExp()? If so how would I do that? Any help is greatly appreciated.
JavaScript:
DreamX.CaptureEnemy.levelUpDuplicateActors = function (actorId, target) {
for (var i = 0; i < $gameParty.allMembers().length; i++) {
var actor = $gameParty.allMembers()[i];
if (actor.actorId() === actorId || actor.baseActorId() === actorId) {
//var newExp = actor.currentExp() + actor.nextRequiredExp();
//actor.changeExp(newExp, paramDefaultLevelUpMsg);
actor._level = target.level; // OpenTangent attempt 1
actor.change_level(target.level, false); // OpenTangent attempt 2
}
}
};


