Gigadragon78

Veteran
Veteran
Joined
Feb 2, 2019
Messages
55
Reaction score
17
First Language
Spanish
Primarily Uses
RMMV
Sorry to bother yourselves,i have a problem with this plugin. It works nearly perfect in MZ (with the DK compatibility patch). I want to set the enemy level to vary between 1 and 5 so i used this formula in the enemy tag:
<enemy level: var numbers = [1, 5] /> and it does not worked (it says level undefined).
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,339
Reaction score
8,076
First Language
German
Primarily Uses
RMMV
can you give a link to the plugin?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,339
Reaction score
8,076
First Language
German
Primarily Uses
RMMV
<enemy level: var numbers = [1, 5] />
this is not a valid formula.

the plugin instruction states:
<enemy level: FORMULA />
Where the formula is any valid javascript formula that evaluates to a number.

which means whatever formula you use, it has to be javascript AND it has to result in a numeric value.
your formula neither returns a value, not does it contain any randomizer function.

I don't know if the following solution would work as it can result in a float number:
Math.random() * (max - min) + min

or
<enemy level: Math.random() * (5 - 1) + 1 />
 

Gigadragon78

Veteran
Veteran
Joined
Feb 2, 2019
Messages
55
Reaction score
17
First Language
Spanish
Primarily Uses
RMMV
It does not worked,but thanks you very much for the intention. Finally i give up and decided to use a common variable and an parallell event that changes the levels randomly. The only problem is that the enemies with the same variable appears with the same level,for example 3 goblins with a level of 9. They are no randomized but is beggining.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
679
Reaction score
357
First Language
English
Primarily Uses
RMMV
I don't know if the following solution would work as it can result in a float number:
Math.random() * (max - min) + min

or
<enemy level: Math.random() * (5 - 1) + 1 />
Doesn't floor truncate to integer?
Math.floor(Math.random() * 5 ) + 1
 
Last edited:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,956
Reaction score
5,577
First Language
English
Primarily Uses
RMVXA
Yeah, based on the documentation I would think that a notetag like

<enemy level: Math.floor(Math.random() * 5) + 1 />

would work for getting a Level between 1 and 5. If that doesn't work, a couple things you can try:
  • Removing the space before the />
  • If you have an older version of this plugin, removing the / character. This is an escape code that Hime uses so that it knows you're not trying to use the > as part of the formula (such as "if (5 > 3)" ), and I think it's something that was added into later releases of the script rather than present in the first few versions.
 

Gigadragon78

Veteran
Veteran
Joined
Feb 2, 2019
Messages
55
Reaction score
17
First Language
Spanish
Primarily Uses
RMMV
Thanks you very much friends. The last one worked perfecty. Excuse me for the late reply,i feel a little sick lately.
 

Latest Threads

Latest Posts

Latest Profile Posts

Time to wear a new face again...

Should keep things interesting huh? @EpicFILE :p
unknown.png

Been feeling that my characters spent too much time exploring caves, so I figured it was time to explore abandoned keeps instead.
Did you had some minor hitches with RMMZ? Come report to my topic where I did the same! [Just another rant from a RM veteran + Suggestions and Solutions] All opinions are welcome!
Squashing some bugs before releasing plugin :LZScool:The testing phase is taking more time than what I expected...

Forum statistics

Threads
110,329
Messages
1,052,382
Members
143,368
Latest member
indecisivesidekick
Top