[RMVXACE]HOW DO I MAKE AN ITEM THAT IS USED BY A PLAYER/CHARACTER DO A RANDOM CLASS CHANGE?
Posts
Sorry, I haven't been paying too much attention to this thread. From what I can tell, though...
...this, right here, is your problem. You're defining functions in the Common Event, which might be fine. However, you're not using said functions! What I think you could do in this case is insert another script-window where you type...
...that.
Also, yes, it should be possible for my class-change function to return the same class that a character was before. The likelihood of that occurring would depend on the number of classes you have in the database. Of course, putting in code to check to see if the class has changed shouldn't be that bad. Probably.
*Edit: Yeah, I guess the pieces of code could be combined as karin's example shows.
*Edit2: So, I did a bit of revising and testing of this. The function I have now looks like...
...that. This should now ensure that the class of the character that the Cube is used on on will change. Meanwhile, the Common Event has been reduced to the Script of "change_class".
author=Kargan3033
...this, right here, is your problem. You're defining functions in the Common Event, which might be fine. However, you're not using said functions! What I think you could do in this case is insert another script-window where you type...
num = get_user change_class(num)
...that.
Also, yes, it should be possible for my class-change function to return the same class that a character was before. The likelihood of that occurring would depend on the number of classes you have in the database. Of course, putting in code to check to see if the class has changed shouldn't be that bad. Probably.
*Edit: Yeah, I guess the pieces of code could be combined as karin's example shows.
*Edit2: So, I did a bit of revising and testing of this. The function I have now looks like...
def change_class actor = $game_party.target_actor.id before_class = $game_actors[actor].class_id after_class = before_class min = 1 max = $data_classes.size while before_class == before_class after_class = rand(max - min) + min end $game_actors[actor].change_class(after_class) end
...that. This should now ensure that the class of the character that the Cube is used on on will change. Meanwhile, the Common Event has been reduced to the Script of "change_class".
Ok Marrend I'll give this a spin and see how it works, thank you for your hard work.
I tried what you said and got this error when I used the cube.

I tried what you said and got this error when I used the cube.

If you're getting that error, I largely suspect that the script-calls your Common Event might look like...
...that, or something like this. If this is the case, you should be able to change it to...
...that, and be okay. Though, personally, I would prefer to have the function definition in the main script window, but, as long as it works, that's the main thing!
Actually, let's re-upload the screenshots to exemplify what things should look like, as far as I'm concerned. Note that you may need to force a refresh of your internet browser to see the updated images properly.
Item definition
Common Event definition
Scripts
def change_class actor = $game_party.target_actor.id before_class = $game_actors[actor].class_id after_class = before_class min = 1 max = $data_classes.size while before_class == before_class after_class = rand(max - min) + min end $game_actors[actor].change_class(after_class) end num = get_user change_class(num)
...that, or something like this. If this is the case, you should be able to change it to...
def change_class actor = $game_party.target_actor.id before_class = $game_actors[actor].class_id after_class = before_class min = 1 max = $data_classes.size while before_class == before_class after_class = rand(max - min) + min end $game_actors[actor].change_class(after_class) end change_class
...that, and be okay. Though, personally, I would prefer to have the function definition in the main script window, but, as long as it works, that's the main thing!
Actually, let's re-upload the screenshots to exemplify what things should look like, as far as I'm concerned. Note that you may need to force a refresh of your internet browser to see the updated images properly.
Item definition
Common Event definition
Scripts
Well Marrend I tried the new scipt you post and made the changes to the common event like you said and the game locked up when I was running a play test so instead of waste any more time on this I'll do a work around that should make the game more intresting.
LOL I don't blame you for wondering what the hell is going on but for what it is worth thank you for your help, say have you posted any games you have made here, I'd like to try them out if you have.















