Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How to Make an Actor to Enemy Stat Conversion Script?

Hello everyone, I am making a commercial Tactical RPG similar to Final Fantasy Tactics with RPG Maker XP and I would like some help creating a script which takes the values of a specified Actor's stats, after adding stats from equipment, and applies the same values of stats to a specified Enemy's stats using the Event Script Command. This way, I can simulate enemies having levels and wearing equipment. For example, using the event's script command to convert Actor #5's stats to the stats of Enemy #10 in the Database, I think it would look something like this:

enemy[10].maxhp = actor[5].maxhp
enemy[10].maxsp = actor[5].maxsp
enemy[10].hp = actor[5].sp
enemy[10].sp = actor[5].sp
enemy[10].str = actor[5].str
enemy[10].dex = actor[5].dex
enemy[10].agi = actor[5].agi
enemy[10].int = actor[5].int
enemy[10].atk = actor[5].atk
enemy[10].pdef = actor[5].pdef
enemy[10].mdef = actor[5].mdef
enemy[10].eva = actor[5].eva

But I know that's not going to work because it doesn't use the correct script codes. However, I'm hoping it will be about as simple in structure. I just need to know what the right script codes are for this... Does anyone here, who's much better at scripting, know what script codes I need to use in order to pull this off? Please let me know, I'd GREATLY appreciate it! And thanks a ton in advance!
 
To set an enemy's stats to an actor's, I assume you would use
$data_enemies[<id>].maxhp = $data_actors[<id>].maxhp


The variable you're changing has to go on the left.

Note that this doesn't edit the saved data files. It'll need to be applied during runtime every time.
 
Thanks for the quick reply! I tried to use your suggestions like this:

(I had to use variable a, b, c, ect. because the script event command's lines are too short to write it exactly as you did)

a = $data_actors[41].maxhp
b = $data_actors[41].maxsp
c = $data_actors[41].str
d = $data_actors[41].dex
e = $data_actors[41].agi
$data_enemies[6].maxhp = a
$data_enemies[6].maxsp = b
$data_enemies[6].str = c
$data_enemies[6].dex = d
$data_enemies[6].agi = e

ect...

But it creates a no method error for 'maxhp', 'maxsp', 'str', and so on... What am I doing wrong? Please let me know as soon as you can. Thanks very much!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top