Hi! how you going?, I need a script to report using a text box when a character learns a skill, and it does not matter if you learn the skill on a map or in battle, that always display a text box when a character learns a skill, and that the text box is automatically remove.....
The RPG Maker XP dont bring this option, and it is really necessary....
Well, if any scripter can make this script I would really appreciate it...
Thanks in advance.....
Can't this be done with some Common Events? oxo Perhaps my line of thought isn't very optimized, but it might work... xD
(http://img403.imageshack.us/img403/721/81046112.png)
A switch can be launched at the beginning to trigger this common event's parallel nature. It'll check if the actor has a certain skill, and if the actor lacks that skill, it'll check if actor player is at the right level to learn it.
...Now that I think about it, I should have put Erase Event at the end of the Common Event... xDD
Anyway, it can support multiple actors too, since all you really need to do is use that level variable again in another instance (Or use another one). Then at the end of the event you can just erase the common event, so it won't loop...At least I think it works like that. ._.
I haven't tested this and I forgot some of the specific things RPG Maker XP can do, so forgive me if this is a little wrong. But the concept should be pretty straightforward that way. xD
A trade-off here would be that it will only appear on the map. You'll also have to not let the actor learn any skills through the Database's Class thing, unless the skill was learned right off the bat.
If you're still bent on scripting, it shouldn't be too challenging, to think...x_X Should just be a new window/bitmap right? :huh:
Alternative-ish.
Common event: Skill message Parallel process switch: Message on.
Conditional branch: Actor[1] has skill [1] learned
Conditional branch: Variable: Actor [1]'s skills == 0
Show text: Actor[1] learnt skill [1]!
Control variables: Actor [1]'s skills = 1
Else
Branch end
Else
Branch end
Now, for the second skill, il est comme ca: (Same comment event, remember)
Conditional branch: Actor[1] has skill [2] learned
Conditional branch: Variable: Actor [1]'s skills == 1
Show text: Actor[1] learnt skill [2]!
Control variables: Actor [1]'s skills = 2
Else
Branch end
Else
Branch end
For skills that aren't learnt via the levelling system, use a switch instead of a variable.
Here, try this. I wrote it just now and didn't test it a whole lot, so let me know if there are any bugs.
class Game_Actor
LEARN_SE = ['055-Right01', 80, 100]
# Filename of SE to play when skill is learned. Set to nil to disable.
# File must be located in the Audio/SE directory.
ALERT_DURATION = 80
# Define the number of frames that the window will be on the screen.
WINDOW = [160, 208, 320, 64]
# Define X, Y, WIDTH, and HEIGHT of the window that will be displayed.
DISABLE_INPUT = true
# Define if you would like to disable input during the alert.
SCENES = [Scene_Map, Scene_Battle, Scene_Menu]
# Define the Scenes that the alert can be used in.
alias learned_skill_alert learn_skill
def learn_skill(skill_id)
# Call normal method to learn a skill.
learned_skill_alert(skill_id)
# Create a window real quick.
if SCENES.include?($scene.class)
window = Window_Base.new(*WINDOW)
window.back_opacity = 160
window.contents = Bitmap.new(WINDOW[2]-32, WINDOW[3]-32)
text = "#{@name} learned #{$data_skills[skill_id].name}!"
window.contents.draw_text(0, 0, WINDOW[2]-32, 32, text, 1)
# Play SE if it is defined.
if LEARN_SE != nil
$game_system.se_play(RPG::AudioFile.new(*LEARN_SE))
end
# Loop for defined number of frames.
ALERT_DURATION.times {
Graphics.update
$scene.update
Input.update unless DISABLE_INPUT
}
# Dispose window, then resume game.
window.dispose
end
end
end
Well, thanks for interesting, that engine its good, and I had already thought it, but it really heavy make it for all characters, thats why I need an script....
For ForeverZer0: I tried the script and it gave this error
(http://img543.imageshack.us/img543/7937/errorrpg.jpg)
It kinda works, because when a character learn a skill, a text box and the SE is display, but, when the text box is display, it waits a few seconds and then gives the error.....
I hope you can fix it, this scripts its very good!!
Hmmmm.
I wasn't getting that error. I imagine that the scene that is calling the learn_skill method is still calling it on the next update. Since processing is still in the loop in the learn_skill method, it is a recursive, which Ruby cannot do.
It could be something different, but how are you having the skill leaned? I tested with a script call, but not with a normal after battle or level gain sequence.
Well, I tried learning the skill with an event, with the comand "change skill", I did not tried learning the skill gaining level, but I need the characters learn skills by events, and also by levels.....