How to add a variable with Yanfly Skill Core Lunatic Mode?

Luminous

Veteran
Veteran
Joined
May 24, 2012
Messages
122
Reaction score
43
Hello,


I tried to add value of a variable +1 for every actor who cast a skill.


So I try to use this notetag code on Yanfly Skill Core


<Custom Execution>


$gameVariables.setValue(1, +1);


</Custom Execution>


The problem is, it's look like my variable still stack at 1 value and never increase to 2, 3, 4, 5,... each he cast a skill.


How can I add a value each time he cast a skill with this lunatic mode notetag?


Thanks verymuch.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
245
Reaction score
82
First Language
German
That won't work.


To add 1 to the value of your $gameVariables, use this


var variableValue = $gameVariables.value(1); // get the current value with that
$gameVariables.setValue(1, variableValue + 1); // and here add 1 to the value


or the shorter version

Code:
$gameVariables.setValue(1, $gameVariables.value(1) + 1);
 
Last edited by a moderator:

Luminous

Veteran
Veteran
Joined
May 24, 2012
Messages
122
Reaction score
43
That won't work.


To add 1 to the value of your $gameVariables, use this



var variableValue = $gameVariables.value(1); // get the current value with that
$gameVariables.setValue(1, variableValue + 1); // and here add 1 to the value


or the shorter version



$gameVariables.setValue(1, $gameVariables.value(1) + 1);


Wow it's work, so that's how the script call work.


Thanks very much.


Last Question. Is that possible with this cript call we do a random variable value?


Like set variable random to 1-100?
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
245
Reaction score
82
First Language
German
Last Question. Is that possible with this cript call we do a random variable value?


Like set variable random to 1-100?


There is a way to produce random numbers. For a number between 1 and 100, you can use this:


var randomValue = Math.floor(Math.random()*100) + 1;


Math.random() gets you a number between 0 (inclusive) and 1 (exclusive).


This value gets multiplied by the max value you want to have.


Math.floor() rounds that number to the nearest integer less than or equal to the given number.


At the end, it will be counted up by 1. This is necessary to avoid 0 and to get your max value (100).


A few sample calculations how it works. I'll use numbers with 4 decimals for this.


The numbers you can get with Math.random() can have more or less decimals.


1. for the highest number


var randomValue = Math.floor(0.9999 * 100) + 1;
var randomValue = Math.floor(99.99) + 1;
var randomValue = 99 + 1;
var randomValue = 100;


2. for the lowest number


var randomValue = Math.floor(0.0021 * 100) + 1;
var randomValue = Math.floor(0.21) + 1;
var randomValue = 0 + 1;
var randomValue = 1;




3. for any number in between

Code:
var randomValue = Math.floor(0.1349 * 100) + 1;
var randomValue = Math.floor(13.49) + 1;
var randomValue = 13 + 1;
var randomValue = 14;
 

Luminous

Veteran
Veteran
Joined
May 24, 2012
Messages
122
Reaction score
43
Thankyou very much, Now I will try to learn this one. I want to implement this one for a random effect a casted skills. I can't wait for study more about script call on this plugin.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top