- Joined
- Dec 12, 2018
- Messages
- 44
- Reaction score
- 10
- First Language
- English
- Primarily Uses
- RMMV
So, I think MV uses JavaScript, which I have little idea how to write in, and I don't know how to call stuffs from rpgmaker as well ($game functions).
Basically, I want to save myself hours found this in event language as it's very cluttered, so a script should compact it:
Can someone translate that into RMMV script language? I can give the Plugin Commands and Link Page if necessary, but I think the looping function is the important but here.
If someone could at least reference some JavaScript/RMMV coding reference that would be appreciated too.
---------------
FINAL: I got the code working with all the functions I wanted, so here's my code with comments:
Basically, I want to save myself hours found this in event language as it's very cluttered, so a script should compact it:
Code:
var actor = 7; \\my actors start in seven as the six first are templates
\\Loop
for (i=actor, i<30, i++)
array friends[];
switch i
case 7: friends=[8,9,14]; break;
case 8: friends=[7,9]; break;
case 9: friends=[7,8]; break;
case 14: friends=[7]; break;
\\then I want to use those as variables in a plugin call, specifically from Moogle's Actor Friendship System.
for (j = (each element from friends[]))\\no idea how to do that
\\main plugin command is structured as Plugin Command (a) (b) 10, where a and b are actors
Plugin Command (i) (j) 10
\\optional (I think I can do this eventually)
If ((Plugin Command Getter i j)>20)
Add state to i, id
Add state to j, id
(Another plugin command i, id2)
\\this will add 10 friend points between actors i and j, and because the plugin is based on One Sided Friendship, I have to do both 'friend i leader j' and 'friend j leader i'
If someone could at least reference some JavaScript/RMMV coding reference that would be appreciated too.
---------------
FINAL: I got the code working with all the functions I wanted, so here's my code with comments:
JavaScript:
var actor = 7; var friend = 0; var friendList = []; var i;
for ( leader = actor; leader < 30; leader++) {
switch(leader) { case 7: friendList = [10, 12, 13, 14]; break; case 10: friendList = [7, 11, 13]; break; case 11: friendList = [10]; break; case 12: friendList = [7, 13]; break; case 13: friendList = [7, 10, 12]; break; case 14: friendList = [7]; break; default: }
for (i = 0; i < friendList.length; i++) { //Setting the list of friends for each actor
friend = friendList[i]; this.ActorDistance(2, leader, friend); console.log(friend + " " + $gameVariables.value(2)); this.ActorDistance(2, leader, friend); var Gi = new Game_Interpreter(10); //saving the distance between actors, and creating a GameInterpreter to use commands
if ($gameVariables.value(2) <= 2 && $gameVariables.value(2) != 0) {
Gi.pluginCommand("AFS",["Gain", 10, "Friend", friend, "Leader", leader]); //Moogle_X's Actor Friendship System plugin, adding friendship points
Gi.pluginCommand("AFS", ["Var", 3, "Level", "Friend", friend, "Leader", leader ]); //AFS above, now saving the level between characters
$gameActors.actor(leader).addState( $gameVariables.value(3) + 50); //Adds a state depending on friendship level, starting with lvl1 as state 51
}
}
}
Last edited:



