RPG Maker MV

RPG Maker MV

Zetawilk Jul 16, 2020 @ 9:50am
Doppelganger Enemies
Is it possible to make an enemy whose level and skill sets are based on a specified actor? The trouble I've had in researching this so far is either no search results popping up, or else search results for side view sprites for enemies.

Ideally I imagine people would like to create enemies that are based on any actor at whatever point in the game, utilizing all learned skills, levels and parameters, and equipment, which that actor possesses. Preferably without using any sorts of workarounds.

I hope this isn't too confusing.
< >
Showing 1-7 of 7 comments
MartyrmanX Jul 16, 2020 @ 3:11pm 
Control Variables: #005 Party Leader = Actor Id of Party Member #1

Script Command:
$dataEnemies[1].params[0] = $gameActors.actor($gameVariables.value(5)).mhp
$dataEnemies[1].params[1] = $gameActors.actor($gameVariables.value(5)).mmp
$dataEnemies[1].params[2] = $gameActors.actor($gameVariables.value(5)).atk
$dataEnemies[1].params[3] = $gameActors.actor($gameVariables.value(5)).def
$dataEnemies[1].params[4] = $gameActors.actor($gameVariables.value(5)).mat
$dataEnemies[1].params[5] = $gameActors.actor($gameVariables.value(5)).mdf
$dataEnemies[1].params[6] = $gameActors.actor($gameVariables.value(5)).agi
$dataEnemies[1].params[7] = $gameActors.actor($gameVariables.value(5)).luk
$dataEnemies[1].name = $gameActors.actor($gameVariables.value(5))._name
$dataEnemies[1].battlerName = "Actor1_3_Doppleganger"

Enemy Recover All: Entire Troop

----------------------------------------------------------------------------------------------------------------

Execute the above in an Battle Event on Turn 0. This will get you started on your pursuit of a Doppleganger. This will make Enemy #001 of the database replicate party Leader's stats.

The 2nd last line of the Script Command gives the enemy the Actor Leader's name.

The last line of the script command is what changes the enemy battler sprite (this is case sensitive. If the new name does not match any file names in the Battler Sprite folder, the game crashes). The "Enemy Recover All" command fills the enemy HP after a change in it's max HP.

If you were hoping for a Skill based command, this is where my experience ends.

You may further investigate and research the javascript of this game by pressing F8 during a playtest.
Last edited by MartyrmanX; Jul 16, 2020 @ 3:19pm
Zetawilk Jul 26, 2020 @ 3:28pm 
When you say "Skill based command", do you mean a skill that allows its user to mirror a target's appearance and stats?

I'm still curious about copying an actor's known skill set, but this is an excellent start. Thank you so much for this information.
MartyrmanX Oct 20, 2020 @ 12:21am 
Hey, I'm back. I got a script-based skill that allows Actors to "learn/copy" Enemy Skills. Since I was unable to tap into enemy skill data, I typed some up in the Note field of enemies.


HERE IS THE SKILL

A Skill damage formula that should only be used in Battle and by Actors only:

var A = a.actorId();var P = b.enemyId();var X = $dataEnemies

.note;var Y = X.split(",").map(Number);var i; for (i = 0; i < X.length; i++) {$gameActors.actor(A).learnSkill(Y)}



REQUIRED
Type in enemy Note boxes numbers that correspond to enemy skills. Do not insert any other words.



Example: 2,3
2 = Guard
3 = Dual Attack

----------------------------------------------------------------------------------------------------------------------------------

Explanation [Do not need to read]:
This monster of a damage formula loads data from an enemy's Note field. Inside each enemy Note, I put in numbers that represent skill indexes. Example:

Note
4,8
(4 representing skill 004. 8 representing skill 008)

Whenever an actor uses this skill, they acquire all skills possessed by the enemy.



a.actorID() ....calls the ID of the actor using the skill.

b.enemyId() ....calls the ID of the targeted enemy.

$dataEnemies

.note ....calls a specific enemy from the data base and notes associated with it.

X.split(",") .... calls upon the array "X" then divides it up whenever it sees a comma.

...map(Number) .... calls the array and converts the strings ("words") into numbers.

var i; for (i = 0; i < X.length; i++) {.....} .... this is a loop function that ends when variable "i" matches the length of array X. Each iteration of the loop adds 1 to variable i thanks to "i++". Without this, the loop would happen indefinitely.

$gameActors.actor(A).learnSkill(Y) ...while in the loop function, the actor will learn skills referenced in array Y. Variable i will reference specific numbers within array Y.

----------------------------------------------------------------------------------------------------------------------------------

Why use this?
You can have a party member that is a slime or mimic. They can consume their enemies and learn their skills. If you want this skill to damage the target, add a semicolon followed by a normal damage formula (the game calculates damage on the very last line of a formula).

Better Options Out There
There is a plugin called "VE - Enemy Skills" if you're looking for simpler alternatives.

Last edited by MartyrmanX; Oct 20, 2020 @ 12:23am
MartyrmanX Oct 24, 2020 @ 2:35am 
A head start towards making enemies learn actor skills.


++++++++++++++++++++++RISKY EXPERIMENTAL CODE++++++++++++++++++++++

var P = a.enemyId(); var X = {conditionParam1: 0, conditionParam2: 0, conditionType: 0, rating: 9, skillId: 9}; $dataEnemies

.actions.push(X)

This line of code goes into a skill damage formula meant only for enemies. When executed by an enemy type, the enemy will permanently learn the skill across future encounters within the same game. (Beware, if left unchecked, the enemy will continue to create duplicate skills causing overflow and causing later issues in the game. Modifying code is recommended (conditional branches or code that removes skills).


Potential Solution to skill overflow issue: $dataEnemies

.actions.pop()
This code removes the last object in an array. In this case, the most recently skill learned by enemy. You may also give lowest priority to the enemy skill and give highest priority to the newest skill via "rating = 9".




----------------------------------------------------------------------------------------------------------------------------------
Code Explanation
The top code forces a new skill upon a specific enemy type (I don't know how to give individual enemies skills, sorry).


a.enemyId() .... calls upon the identity of the enemy using the skill.

var X = {conditionParam1 .....} .... declares the existence of an object (the enemy skill) similar to preexisting ones associated with the enemy type.

$dataEnemies

.actions.push(X) ....the code comes together in the final line. It calls upon the enemy that used the skill, then forces a new skill into it's arsenal which can then be interpreted by the game's engine.

skillId ... refers to a specific skill in the database. Example: skillId =1 refers to the Attack skill.
----------------------------------------------------------------------------------------------------------------------------------






++++++++++++++++++++++SAFER CODE++++++++++++++++++++++

Alternatively, you can use an enemy burner skill that can be modified via the following code. This changes an enemy skill into whichever one you desire.

var P = a.enemyId(); $dataEnemies

.actions[0].conditionParam1 = 0;$dataEnemies

.actions[0].conditionParam2 = 0;$dataEnemies

.actions[0].conditionType = 0;$dataEnemies[1].actions[0].rating = 9;$dataEnemies

.actions[0].skillId = 2

Explained: This above code for damage formula changes the enemy's first skill into "Guard".


$dataEnemies[1].actions[0].conditionParam1 = 0
$dataEnemies[1].actions[0].conditionParam2 = 0
$dataEnemies[1].actions[0].conditionType = 0
$dataEnemies[1].actions[0].rating = 9
$dataEnemies[1].actions[0].skillId = 1



Explanation
actions[0] is the first skill an anemy possesses.

Last edited by MartyrmanX; Oct 24, 2020 @ 2:46am
Zetawilk Oct 24, 2020 @ 5:36am 
I think the original idea was that the enemy wouldn't need a skill to learn; the known skills would be determined when the battle begins based upon which actor is being doppelganged and which skills that particular actor knows.
MartyrmanX Oct 24, 2020 @ 6:35pm 
Alright. Here it is.

----------------------------------------------------------------------------------------------------------------------------------

Put all this into a Battle Event for a Troop. Triggers on Turn 0 with Span: Battle. Make sure the Dopplganger enemy has no skills at all (it will intherit the skills of an actor after all)



Control Variables : #005 Party Leader = 1
If : Script : $dataEnemies[1].actions.length > 0

Script Command:
var i; for (i = -2; i < $dataEnemies[1].actions.length; i++) {$dataEnemies[1].actions.pop()}

: End


Script Command:
var Y = $gameVariables.value(5);var P = $gameActors.actor(Y)._actorId;var M = $dataEnemies[1].id;var X = $gameActors.actor(P).skills();var i; for (i = 0; i < X.length; i++) {;var B = {conditionParam1: 0, conditionParam2: 0, conditionType: 0, rating: 5, skillId: X.id};$dataEnemies[M].actions.push(B)}

$dataEnemies[1].params[0] = $gameActors.actor($gameVariables.value(5)).mhp
$dataEnemies[1].params[1] = $gameActors.actor($gameVariables.value(5)).mmp
$dataEnemies[1].params[2] = $gameActors.actor($gameVariables.value(5)).atk
$dataEnemies[1].params[3] = $gameActors.actor($gameVariables.value(5)).def
$dataEnemies[1].params[4] = $gameActors.actor($gameVariables.value(5)).mat
$dataEnemies[1].params[5] = $gameActors.actor($gameVariables.value(5)).mdf
$dataEnemies[1].params[6] = $gameActors.actor($gameVariables.value(5)).agi
$dataEnemies[1].params[7] = $gameActors.actor($gameVariables.value(5)).luk
$dataEnemies[1].name = $gameActors.actor($gameVariables.value(5))._name
$dataEnemies[1].battlerName = "Actor1_3"

----------------------------------------------------------------------------------------------------------------------------------

Explanation:

Variable #005 controls which actor will be dopplegangered (how you choose which actor is up to you). The doppleganger is Enemy #001 (referred to in the code as $dataEnemies[1]).

First Script Command removes all enemy skills before the battle begins if the enemy has more than zero skills.

The Second Script Command gives the enemy the basic stats of an Actor. It also assumes the name of the actor.

The last hurtle to overcome is deciding how you'll get actor Battler Image names (these are case sensitive. No typos or you'll get an error).

If : Script : $dataEnemies[1].actions.length > 0 ... is Event Command Conditional Branch "Script". Typed within the Script Condition."$dataEnemies[1].actions.length > 0".



Troubleshooting:
I have not fully tested this code. To check results of the code during battle, press F8 to open the Debug screen. In the Debug screen console, type in:

$dataEnemies[1].actions

This will reveal the skills an enemy possesses. Watch for duplicate skills (Example: skillId = 3... skillId =3).

Best of luck with your development. See ya.
Last edited by MartyrmanX; Oct 25, 2020 @ 12:46pm
MartyrmanX Nov 4, 2020 @ 5:04pm 
Did it work?
< >
Showing 1-7 of 7 comments
Per page: 1530 50

Date Posted: Jul 16, 2020 @ 9:50am
Posts: 7