[XP] Script new skill system

Started by YeahBrown, January 06, 2011, 08:58:50 pm

Previous topic - Next topic

YeahBrown

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.....

By yeahbrown08 at 2010-12-19

Starrodkirby86

Can't this be done with some Common Events? oxo Perhaps my line of thought isn't very optimized, but it might work... xD

Spoiler: ShowHide

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:

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




The Niche

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.
Level me down, I'm trying to become the anti-blizz!
Quote from: winkio on June 15, 2011, 07:30:23 pm
Ah, excellent.  You liked my amusing sideshow, yes?  I'm just a simple fool, my wit entertains the wise, and my wisdom fools the fools.



I'm like the bible, widely hated and beautifully quotable.

Dropbox is this way, not any other way!

ForeverZer0

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 
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

YeahBrown

January 07, 2011, 04:22:11 pm #4 Last Edit: January 07, 2011, 04:24:01 pm by YeahBrown
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

Spoiler: ShowHide


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!!

By yeahbrown08 at 2010-12-19

ForeverZer0

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.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

YeahBrown

January 07, 2011, 11:01:56 pm #6 Last Edit: January 09, 2011, 11:31:51 am by YeahBrown
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.....

By yeahbrown08 at 2010-12-19