Niko097

Villager
Member
Joined
Apr 4, 2021
Messages
12
Reaction score
4
First Language
español
Primarily Uses
RMMV
Hello, I am working on a script, within a common event I have managed to save the values of max HP, max MP, ATK, DEF etc. of an enemy in battle, however I don't know how to do this with the player's stats

below the script:
let nxtTrgt=$gameTroop.aliveMembers()[0]; $gameVariables.setValue(1,[nxtTrgt.mhp,nxtTrgt.mmp,nxtTrgt.atk,nxtTrgt.def,nxtTrgt.mat,nxtTrgt.mdf,nxtTrgt.agi]) let prota=$gameParty.members(0); <<<NOT WORK $gameVariables.setValue(2,[prota.mhp,prota.mmp,prota.atk,prota.def,prota.mat,prota.mdf,prota.agi]) <<<NOT WORK

I'm just getting started with scripting, so I'm not sure if "gameParty.members" is fine.
Thanks!!
 

Niko097

Villager
Member
Joined
Apr 4, 2021
Messages
12
Reaction score
4
First Language
español
Primarily Uses
RMMV
you need to use: $gameParty.members()[0]
THANKS!!
And do you have any idea how is the code to replace those values?
for example and tried with $gameParty.members()[0].setValue(agi,100);
but it does not work
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,631
Reaction score
1,364
First Language
Dutch
Primarily Uses
RMMV
.setValue agi,100 wont wont, but I dont know how to do that.
.name, and .level does work, but don't know about variables.

it has a different aproach, but I dont know how, still learning JS
on my own, but nothing battle related atm or that kind of things.
 

Niko097

Villager
Member
Joined
Apr 4, 2021
Messages
12
Reaction score
4
First Language
español
Primarily Uses
RMMV
I have managed to do what I wanted with the following script:

let nxtTrgt=$gameTroop.aliveMembers()[0]; let prota=$gameParty.members()[0] $gameVariables.setValue(1,[nxtTrgt.mhp,nxtTrgt.mmp,nxtTrgt.atk,nxtTrgt.def,nxtTrgt.mat,nxtTrgt.mdf,nxtTrgt.agi]) $gameVariables.setValue(2,[prota.mhp,prota.mmp,prota.atk,prota.def,prota.mat,prota.mdf,prota.agi]) $gameActors.actor(0001).addParam(0, nxtTrgt.mhp-(prota.mhp)); $gameActors.actor(0001).addParam(1, nxtTrgt.mmp-(prota.mmp)); $gameActors.actor(0001).addParam(2, nxtTrgt.atk-(prota.atk)); $gameActors.actor(0001).addParam(3, nxtTrgt.def-(prota.def)); $gameActors.actor(0001).addParam(4, nxtTrgt.mat-(prota.mat)); $gameActors.actor(0001).addParam(5, nxtTrgt.mdf-(prota.mdf)); $gameActors.actor(0001).addParam(6, nxtTrgt.agi-(prota.agi));
 

Latest Threads

Latest Posts

Latest Profile Posts

A good way to practice writing is to write "flash fiction"; very short stories. Link
[CM]
5VaUMjAFpz1I6fSsgDrfJc.jpg

Title is star.
Dam, does the night get to me, I sound and look like a monster. Its 3:54 am right now...I need sleep...or...coffee.
It has nothing to do with my project, but I'm in love with voxels

Forum statistics

Threads
110,485
Messages
1,053,644
Members
143,578
Latest member
YukinoYaiba
Top