Is there a way to check if EnemyBook or ItemBook is complete?

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
Hello everyone,


I'm making my game with multiple endings based upon what the player has collected, and one of those endings requires the EnemyBook and ItemBook (both made by sensei Yoji Ojima which I've gotten as part of the MV package) to be completed 100%.


Unfortunately, I can't find a clear way to make a conditional branch where the condition is the EnemyBook/ItemBook is fully written.


I suppose there's a way to do this with a variable and probably lots of editing on all my monsters, but if anyone already knows, please share the info. ;_;


I haven't found a plugin that does this, then again I haven't looked at any other bestiaries and such...
 

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
452
Reaction score
158
First Language
Not English
Primarily Uses
N/A
This is for EnemyBook


make event with script


var complete = 0;


for (i=1; i<=$dataEnemies.length+1; i++){


if ($gameSystem.isInEnemyBook($dataEnemies)){





complete +=1}





};





if (complete==$dataEnemies.length-1){





$gameSwitches.setValue(x,true)};





 





then make conditional event if switch(x) true





 





PS.. Don't forget change x to any number you like, and delete any empty enemy you have in database.





 





 
 

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
@mrcopra Apples!


Also, I tried it out and it didn't seem to work for me.


Do I need to change anything else, such as "var complete = 0"?


I don't have any experience in JavaScript... :p


This is what I put in, Switch 20 is "Bestiary Complete":


EnemyBook.png
 
Last edited by a moderator:

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
452
Reaction score
158
First Language
Not English
Primarily Uses
N/A
var complete=0;


for (i=1; i<$dataEnemies.length; i++){


if ($gameSystem.isInEnemyBook($dataEnemies)||$dataEnemies.name.length==0){





complete +=1}





};





if (complete==$dataEnemies.length-1){





$gameSwitches.setValue(x,true)};





 





try this, 
 

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
Still doesn't work, except this time I got the error message:


TypeError


Cannot read property 'length' of undefined
 

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
452
Reaction score
158
First Language
Not English
Primarily Uses
N/A
It worked for me, can you give me screenshot for the event?!

check.jpg
 

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
452
Reaction score
158
First Language
Not English
Primarily Uses
N/A
By the way you forgot


In first one


Just copy and paste then change x to any number
 
Last edited by a moderator:

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
Comparing mine with yours, apparently two of the ""s were missing in the third line, so I replaced it with:


if ($gameSystem.isInEnemyBook($dataEnemies)||$dataEnemies.name.length==0){


And it seemed to work! :D


On a minor note, could you make it compatible with the "<book: no>" function, which makes enemies with that notetag not appear in the enemy book?


Or even add something that subtracts a certain amount of enemies from the total needed (say I don't want 5 enemies in the book).


By default, your script also adds enemies that don't appear in the enemy book to the amount needed.


Thanks so much thus far, and would you like to be credited in my RPG game?


Edit: I just realized putting in [-i-] into this thread makes the post italic!


That probably explains my issues.


Double edit: Replacing "$dataEnemies" with "$dataItems" as well as replacing "isInEnemyBook" with "isInItemBook" makes the script work the exact same way, except with items and the item book!


Hurrah for compatibility! :D
 
Last edited by a moderator:

Dacuna

Veteran
Veteran
Joined
Feb 19, 2013
Messages
143
Reaction score
10
First Language
English
Primarily Uses
It does exactly what I need it to, thanks a lot!


Did you want to be in the credits of my RPG game as a script/plugin creator?
 

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
452
Reaction score
158
First Language
Not English
Primarily Uses
N/A
I don't mind ;)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top