Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
Hi guys, trying to figure out whats wrong with my event using this plugin:View attachment DreamX_RandomizeCharacterForSkurge.js


It's designed to to randomize an event's graphic and it's an amazing plugin, however for particular events I'm requiring the event's graphic to change into a certain catagory. I.E cars.


I've been told this script command would enable the event given the ID and race would randomize it within that catagory: $gameMap.event(x).randomizeEventRace();


In turn- I have created this for an event: $gameMap.event(6).randomizeEventRace(Car);


However the test crashes with this error: Reference error: Car is not defined


I am at loss here.
 
Last edited by a moderator:

GoodSelf

Zhu Li! Do the thing!
Veteran
Joined
Jul 23, 2016
Messages
598
Reaction score
1,134
First Language
English
Primarily Uses
RMMV
I don't know much about scripting, but what is it defined as in the script?
Did you set up your different categories by name, or number?
I know that scripts are finicky and require exact inputs. Perhaps it's "car" instead of "Car".
Unfortunately, that's all the help I can offer (don't know much about this stuff XD).
 

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,419
Reaction score
5,120
First Language
English
Primarily Uses
RMMZ
I admit I have not looked at the plugin - I am neck-deep in my own code at the moment... but are you certain that randomizeEventRace needs anything passed into it at all? If it is indeed a string that needs to be passed in, you will need to enclose it in quotes. However, given that you are already specifying an event, I think nothing needs to go in the randomizeEventRace function.


tl;dr: try using  $gameMap.event(6).randomizeEventRace();
 

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
446
Reaction score
209
First Language
English
Primarily Uses
RMMV
The RandomizeEventRace() code, judging from how it's built, doesn't allow a variable to be passed through as an argument.  The code needs to be modified to allow this, or you may need to create a new script specifically for cars.
 

Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
I don't know much about scripting, but what is it defined as in the script?
Did you set up your different categories by name, or number?
I know that scripts are finicky and require exact inputs. Perhaps it's "car" instead of "Car".
Unfortunately, that's all the help I can offer (don't know much about this stuff XD).

Sadly I wish it was that simple- I actually tried to see if it was a caps-lock issue or a typo of some kind but that does not appear to be the case.

I admit I have not looked at the plugin - I am neck-deep in my own code at the moment... but are you certain that randomizeEventRace needs anything passed into it at all? If it is indeed a string that needs to be passed in, you will need to enclose it in quotes. However, given that you are already specifying an event, I think nothing needs to go in the randomizeEventRace function.


tl;dr: try using  $gameMap.event(6).randomizeEventRace();

I understand you might want to keep your mind focused on the script you are working with currently- I'm certain I'm doing this correctly given the guidelines and having been pretty successful until now. Quotations seem to make the project run without crashing- but no actual change is made graphic wise when the script is met. Having $gameMap.event(6).randomizeEventRace(); does change the graphic- but only with the 4 listed in the parameter which I can't add car into because random graphic predestrians will eventually have cars walking around as if they were people.


Sorry If i have not elaborated enough but hopefully this can explain further and/or if you read the plugin provided when capable.


With the plugin i've been supplied with- in parameters you can insert races and number of sheets that have the graphics intended for the plugins use.


For my project I have the following races and number of sheets for each type I.E Car1-Car8. Cars are not included because they are not to be randomized on pedestrian spawned events but for map created events and thus only show on streets with there autonomous movement paths. However that script command is meant for exceptions that can grab sheets not recorded in the parameters such as demonstrated below.


Race: Human Elydian Voltor Arachin


Sheet max: 8


I do appreciate the support here :)
 

Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
The RandomizeEventRace() code, judging from how it's built, doesn't allow a variable to be passed through as an argument.  The code needs to be modified to allow this, or you may need to create a new script specifically for cars.

Sorry I didn't get a page update when you posted this:


Not sure if your referring to the typical variables we use everyday in the RPG program> But there a no variables used to activate this.


You do however mention a good point about a new script entirely for this, if I were to say duplicate this plugin and modify it say for example a different plugin name-and give it a single parameter of the cars would that work still do you think?
 

shockra

Slightly Crazy Programmer
Veteran
Joined
Feb 16, 2016
Messages
446
Reaction score
209
First Language
English
Primarily Uses
RMMV
What I meant was that the empty parentheses at the end of that bit of code doesn't allow for arguments to be passed through into the function.  I don't think you need an entirely new plugin for this, but you'll likely need to add a new function to it.  Try copying the code in the RandomizeEventRace() function, and tweaking the copy to make a car-specific one.  Or if you're not sure if you can, find the guy who made the plugin and ask them to add the function.
 

Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
Sadly I don't understand java a whole lot :/ I have also mailed this question to the creator but it has been several weeks since I last heard.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,079
Reaction score
7,986
First Language
German
Primarily Uses
RMMV
One simple question: did you rename the js file?


The js file in your original link is named a bit strange with the "forskurge" at the end - and a lot of plugins cannot function if the filename is wrong.


It has to do something with the function hierarchy, because the plugin filename becomes part of the function call - and the function call for their parts is needed by a lot of plugins.
 

Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
I did rename the file, I had no idea the file name itself had any effect with the content.


I modifed the file again and added 'car' at the end of the file name, and inside the file itself added car to the end of any reference to the file name. Seems it cannot work like this, I think I got it wrong somehow.

View attachment DreamX_RandomizeCharacterForSkurgecar.js
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,079
Reaction score
7,986
First Language
German
Primarily Uses
RMMV
I wasn't talking about adding something - you need the exact filename that was made by the plugin programmer, nothing else will work. any single wrong letter from that original filename will destroy all functionality.


So go back to the website where you got it and check the name that it has there.


Most likely you have to remove the "ForSkurge" part as well as the car part from that file.


And please give a link to the original website you got it from instead of uploading it here.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,079
Reaction score
7,986
First Language
German
Primarily Uses
RMMV
Even a quick check indicates that this plugin has to be called DreamX_RandomizeCharacter.js (unless the plugin writer got really tricky farther down in the code), you can see that by comparing the very first lines after the header. It might even be RandomizeCharacter.js alone, but I don't think it will ever work with that "forskurge" at the end.


So as I suggested above, remove the "ForSkurge" from the filename, and if that does not work then remove even the header DreamX_
 

Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
Hm I'm having difficulty with this, either I'm missing something or the way I edit this has no effect or crashes it?


Does editing this in notepad effect this? I have javascript software to work with either.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,168
Reaction score
14,211
First Language
English
Primarily Uses
RMMV
I haven't read through all of the posts, but I suggest you pass in a string.  "Car" instead of Car, as it thinks Car is a class or a variable, and it throws an error when it can't find where it's defined.


If you have Car in the list of Races in the parameters, and 8 in Sheet Max, $gameMap.event(6).randomizeEventRace("Car") should randomise between Car1 and Car8
 
Last edited by a moderator:

Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
I haven't read through all of the posts, but I suggest you pass in a string.  "Car" instead of Car, as it thinks Car is a class or a variable, and it throws an error when it can't find where it's defined.


If you have Car in the list of Races in the parameters, and 8 in Sheet Max, $gameMap.event(6).randomizeEventRace("Car") should randomise between Car1 and Car8

I have addressed this however, if the race Car is randomized, the car graphic will appear for all random graphic calling events where as the specific event should change it's graphic but only within the car graphic randomize like presented in the first post.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,168
Reaction score
14,211
First Language
English
Primarily Uses
RMMV
Are you using exactly that script call?  Or have you just provided it as an example but that's not exactly how you're doing it?  Could you show a screenshot of the event that contains this script call?  And if the whole script call isn't visible within that event window, open up the command and grab a screenshot of that as well.


If you are using exactly that call, it should affect only that event.


Actually, a screenshot of the plugin parameters might be helpful, too.


Did you say you were changing the plugin?  What is the latest and greatest code?  I have the version from here:

I was given this plugin exclusively through PM- this is the latest version.


View attachment 56697



and it also doesn't look like it would cause this problem.
 
Last edited by a moderator:

Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
Here are the parameters: The races listed are for the predestrians which have there graphic randomized when entering map.


Note that " Car" is not listed because the pedestrians would on circumstances choose a vehicle graphic.


BUG.png


This is the test event's commands, highlighted is the script call Dreamx told me to use for this specific event, when called- the event should use a graphic out of the 8 car sheets available. And when looped it shall call it again to simulate that the vehicle is a different one on the map.


BUG2.png


The plugin works fine, it's just the script command is not working as intended.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,168
Reaction score
14,211
First Language
English
Primarily Uses
RMMV
Sorry - that script call doesn't do what you think it's doing.  The call DreamX gave you did not include a race as a parameter.  What that will do is simply re-randomize the event's image, but still select from the list in the parameters.  It seems there's been a miscommunication - either in what he thought you were asking for, or what you thought he was telling you to do.


randomizeEventRace doesn't accept an argument, so whatever you pass through to it is being ignored.  When you call it, it will randomise between what you've got listed as races in the plugin parameter.  That is not what you want to do, if your goal is to give it a completely different random image, that isn't one of the races listed in the parameter.


If you just want to choose a random image for the event, without having to list it as a race, do this if you only have 1 car spritesheet and it's called Car:


$gameMap.event(6)._randomlyChosenCharacterName = "Car";
$gameMap.event(6)._randomlyChosenCharacterIndex = Math.floor(Math.random() * 8);
$gameMap.event(6).setImage($gameMap.event(6)._randomlyChosenCharacterName, $gameMap.event(6)._randomlyChosenCharacterIndex);


If you have, say, 3 Car spritesheets and they're called Car1, Car2 and Car3, do this instead:


$gameMap.event(6)._randomlyChosenCharacterName = "Car" + (Math.floor(Math.random() * 3) + 1);
$gameMap.event(6)._randomlyChosenCharacterIndex = Math.floor(Math.random() * 8);
$gameMap.event(6).setImage($gameMap.event(6)._randomlyChosenCharacterName, $gameMap.event(6)._randomlyChosenCharacterIndex);




In both cases, the 8 assumes you have 8 different cars on the spritesheet.  If you only have 5, change the 8 to a 5 instead.


I don't know why all the other events are being randomized - I suspect it's not this script call that's doing it.  What's on page 2 of that event?
 
Last edited by a moderator:

Skurge

Archtross Dev
Veteran
Joined
Jul 12, 2015
Messages
1,216
Reaction score
277
First Language
English
Primarily Uses
N/A
I think there was a miscommunication- I felt I made myself clear but things aren't always what they seem.


I will give these script calls a go and see what I can muster. Thank you all for still trying to help me :)

In both cases, the 8 assumes you have 8 different cars on the spritesheet.  If you only have 5, change the 8 to a 5 instead.


I don't know why all the other events are being randomized - I suspect it's not this script call that's doing it.  What's on page 2 of that event?



Well my current set up is to have 8 sheets per race, that including the car graphic so I have 'Car1-Car8'


At the end of page A it switches a self switch to page B, in turn B switches itself off reverting back to page A thus ensuring the event's activities are looped.
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

Studying more game mechanics and game design... If someone have some tips, I would be happy to read!
I finally caved and bought myself a Switch.
I'm having some trouble finding an established sub-genre to classify our current project. Effervesce Fallacy™ is loosely based on chaos theory . . . does anyone know what this sub-genre is called?
I figured I should start off with a game this (I think at least)would be easier to program. Demonstrating Card drawing for Black Jack

I'm playing Pokémon Yellow to celebrate National Pokémon Day. :smile: What Pokémon games is everyone else playing?

IMAGES/SCREENSHOTS

Forum statistics

Threads
108,898
Messages
1,040,415
Members
141,341
Latest member
ForbiddenDonut
Top