- Joined
- Aug 23, 2012
- Messages
- 7
- Reaction score
- 0
- First Language
- English
- Primarily Uses
Hi there.
I wasn't sure whether to post this in Learning Ruby and RGSSx, or RGSSx Script Support, so I apologise in advance if this is in the wrong place.
Here's a bit of background on the scripts I'm having trouble with:
This is the relevant code from YEM Skill Overhaul - I've omitted most of the unrelated code
Next is the custom script which I've been working on to allow the automatic re-binding. It is written in the Requiem script.
This part of the code works just fine:
This is where I get stuck. I need a "Script..." method to call from an event when the player learns the new skills.
This is the code which I've been working on, but nothing I've done has worked:
I'm not sure if it's a problem with my code, or a problem with my script call, or what.
I've tried many different approaches, such as making it a Module (which, if I recall correctly resulted in the @actor stuff not working), as its own new class or as part of Scene_Skill (both of which, I think, ended with NoMethodErrors).
If someone would be able to help me figure this out I'd be really, really thankful.
Knowing my luck, it's probably something really simple and obvious and my somewhat limited knowledge of Ruby has just continually led me in circles for the past 4 hours...
Oh well.
Thanks in advance to anyone who's able to shed some light on this.
edit:
I've put together a small demo for anyone who's willing to take a look at it
Download here: http://www.mediafire.com/download/nq0voxxqnpukdvo/AutobindDemo.zip
Thanks again for any help.
I wasn't sure whether to post this in Learning Ruby and RGSSx, or RGSSx Script Support, so I apologise in advance if this is in the wrong place.
Here's a bit of background on the scripts I'm having trouble with:
I've been working on this VX project for a long time - it uses an old action battle system called Requiem SBABS 4 by Vlad.
Part of the ABS allows you to bind spells to hotkeys from the skill menu. I combined this with the YEM Skill Overhaul script by Yanfly to make character progression involve unlocking a spell from one school of magic, and then upgrading that one spell to become more powerful.
Surprisingly, these scripts worked well together, except for one fact - you had to manually re-bind each spell whenever you purchased an upgrade (the old spell would remain bound to the key and usable despite not being in the skill window).
I decided I'd have a go at creating a system to automatically re-bind the spells when upgrades were purchased. I disabled the ability to manually choose which spell to be on each key in favour of making a simple rule of Fire on [1], Ice on [2], and Thunder on [3].
As it stands, my automatic re-binding script edit works perfectly. The one problem I have now is that I need to bind the spells to the hotkeys when they are first learned. I'd hoped this would be as simple as calling my custom script from an event when the spell is learned, but I'm getting NoMethodErrors and the like.
Part of the ABS allows you to bind spells to hotkeys from the skill menu. I combined this with the YEM Skill Overhaul script by Yanfly to make character progression involve unlocking a spell from one school of magic, and then upgrading that one spell to become more powerful.
Surprisingly, these scripts worked well together, except for one fact - you had to manually re-bind each spell whenever you purchased an upgrade (the old spell would remain bound to the key and usable despite not being in the skill window).
I decided I'd have a go at creating a system to automatically re-bind the spells when upgrades were purchased. I disabled the ability to manually choose which spell to be on each key in favour of making a simple rule of Fire on [1], Ice on [2], and Thunder on [3].
As it stands, my automatic re-binding script edit works perfectly. The one problem I have now is that I need to bind the spells to the hotkeys when they are first learned. I'd hoped this would be as simple as calling my custom script from an event when the spell is learned, but I'm getting NoMethodErrors and the like.
This is the relevant code from YEM Skill Overhaul - I've omitted most of the unrelated code
class Scene_Skill < Scene_Base def update_learn_selection @learn_window.update @learn_data.update if Input.trigger?(Input:: Sound.play_cancel @command_window.active = true @learn_window.active = false @skill_window.refresh if @skill_window != nil @passive_window.refresh if @passive_window != nil# *** omitted some unrelated code from here *** elsif Input.trigger?(Input::C) skill = @learn_window.skill if @learn_window.enabled?(skill) and !@actor.skill_learn?(skill) learn_skill(skill) autobind = skill.id # <---------------------- Set up the skill ID for autobinding autobind_skill(autobind) # <-------------- Call the autobinding function else Sound.play_buzzer end end endend
This part of the code works just fine:
class Scene_Skill < Scene_Base attr_accessor :message attr_accessor :delay # *** omitted a couple of unrelated methods here *** def autobind_skill(autobind) # FIRE SKILLS if autobind >= 59 and autobind <= 64 autobind_button = 1 end # ICE SKILLS if autobind >= 65 and autobind <=70 autobind_button = 2 end # THUNDER SKILLS if autobind >= 71 and autobind <= 76 autobind_button = 3 end # AUTOBIND if autobind_button == 1 @actor.skill_hotkeys[49] = autobind end if autobind_button == 2 @actor.skill_hotkeys[50] = autobind end if autobind_button == 3 @actor.skill_hotkeys[51] = autobind end endend
This is the code which I've been working on, but nothing I've done has worked:
class Scene_Skill #AUTO ADD def autoadd_fire @actor.skill_hotkeys[49] = 59 end def autoadd_ice @actor.skill_hotkeys[50] = 65 end def autoadd_thunder @actor.skill_hotkeys[51] = 71 endend
I've tried many different approaches, such as making it a Module (which, if I recall correctly resulted in the @actor stuff not working), as its own new class or as part of Scene_Skill (both of which, I think, ended with NoMethodErrors).
If someone would be able to help me figure this out I'd be really, really thankful.
Knowing my luck, it's probably something really simple and obvious and my somewhat limited knowledge of Ruby has just continually led me in circles for the past 4 hours...
Oh well.
Thanks in advance to anyone who's able to shed some light on this.
edit:
I've put together a small demo for anyone who's willing to take a look at it
Download here: http://www.mediafire.com/download/nq0voxxqnpukdvo/AutobindDemo.zip
Thanks again for any help.
Last edited by a moderator:


