Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Magic Weapon Add-on, Automatic weapon skills
Kread-EX
post Feb 16 2010, 03:55 AM
Post #1


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




Magic Weapon Add-on


At leongon's request, I post this script here. It's a very simple and small add-on which allows to perform a certain skill in place of a normal attack when a certain weapon is equipped.

Create a new script section (must be under Scene_Battle) and paste this little code:

CODE
#==============================================================================
# Simple Magic Weapons Script
#------------------------------------------------------------------------------
# Author: Kread-EX
#==============================================================================

#The constant below is the only thing you need to configure.

#The first number is the ID of the weapon. The second, the ID of the skill.
#The third is the probability (should be 0-100).

MAGIC_WEAPONS = {1 => [59, 75], 2 => [60, 50]}
#In this example, the first weapon in the database has 75% chance of casting Fire, and the second 50% of casting Fire 2.

# If GTBS not detected
unless defined?(Scene_Battle_TBS)

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # Changes to execute_action
  #--------------------------------------------------------------------------
  alias_method :krx_mw_execute_action, :execute_action
  def execute_action
    if @active_battler.is_a?(Game_Actor) && MAGIC_WEAPONS.keys.include?(@active_battler.weapon_id) &&
     @active_battler.action.attack? && (rand(101) >= (100 - MAGIC_WEAPONS[@active_battler.weapon_id][1]))
     @active_battler.action.set_skill(MAGIC_WEAPONS[@active_battler.weapon_id][0])
   end
   krx_mw_execute_action
  end
end

# Support for GTBS
else
  
#==============================================================================
# Scene_Battle_TBS
#==============================================================================

class Scene_Battle_TBS < Scene_Base
  #----------------------------------------------------------------------------
  # Determine if Magic Weapon is active
  #----------------------------------------------------------------------------
  #----------------------------------------------------------------------------
  # Process Actions (Attack/Skill/Item)
  #----------------------------------------------------------------------------
  alias_method :krx_mw_gtbs_phase_9, :tbs_phase_9
  def tbs_phase_9
    if @active_battler.is_a?(Game_Actor) && MAGIC_WEAPONS.keys.include?(@active_battler.weapon_id) &&
      (rand(101) >= (100 - MAGIC_WEAPONS[@active_battler.weapon_id][1])) &&
      @active_battler.current_action.kind == 0 && @active_battler.current_action.basic == 0
      @active_battler.current_action.kind = 1
      @active_battler.current_action.skill_id = MAGIC_WEAPONS[@active_battler.weapon_id][0]
      @animation2 = $data_skills[@active_battler.current_action.skill_id].animation_id
    end
    krx_mw_gtbs_phase_9
  end
end

end


Side notes: -Compatible with Tankentai SBS.
-Compatible with GubiD's TBS.
-Unless when using GubiD's TBS, the MP are consumed when the skill is cast. If you don't want it, you'll have to create another skill with 0 MP cost.


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
Dan Blazing
post Feb 16 2010, 04:54 AM
Post #2


Level 7
Group Icon

Group: Revolutionary
Posts: 102
Type: Developer
RM Skill: Beginner




hey that´s nice biggrin.gif, i will try it later, thanks for making this, if it works, this will be really useful. Thanks again.


__________________________
*insert badass signature here*
Go to the top of the page
 
+Quote Post
   
Rastanatsta
post Feb 16 2010, 01:49 PM
Post #3


Level 4
Group Icon

Group: Member
Posts: 54
Type: Writer
RM Skill: Beginner




This is the script you created that I need the other day! Awesome. smile.gif

I have another request if you don't mind...

Are you familiar with the: Modern algebra's Quest Journal?

I've encountered an error but nobody has replied yet... sad.gif

If you could spare the time I'd be really grateful if you knew what my error was.

The link is here I post is the last one as far as I know of. :S

Thank you for your time.


__________________________


Current Project = Last Order
Go to the top of the page
 
+Quote Post
   
Meteor64
post Mar 31 2010, 01:44 AM
Post #4


Level 2
Group Icon

Group: Member
Posts: 19
Type: None
RM Skill: Beginner




Hey tongue.gif
I tried using this script with Gubids Tactical battle system, but it said there was an error in Line 26. D'you maybe know what the problem is, cos I dont have the foggiest. Cos im a noob tongue.gif
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Mar 31 2010, 11:07 AM
Post #5


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




Hmm... I'm not sure this script is compatible with GubiD's TBS. I'm not familiar with the VX version of his script, but I'll check it out to be sure.


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
Meteor64
post Apr 1 2010, 12:50 AM
Post #6


Level 2
Group Icon

Group: Member
Posts: 19
Type: None
RM Skill: Beginner




Well, do you reckon I could alter it in any way to make it compatible with GTBS? Or would I have to completely reassemble it if I tried? Cause I really need a script that does this sort of thing, as I'm trying to make some of my weapons as spells, and this was is the only thing I've found so far.
And thanks for looking into it happy.gif
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Apr 2 2010, 01:54 AM
Post #7


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




Okay, I made it compatible with GubiD's TBS (edited my first post).
By the way, there wasn't any error on line 26.


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
Meteor64
post Apr 3 2010, 01:31 AM
Post #8


Level 2
Group Icon

Group: Member
Posts: 19
Type: None
RM Skill: Beginner




Well, im not getting the error on line 26 anymore (I have no idea what that was then , i probably fudged it up) but now when use the weapon, it doesnt call up the skill, despite being set to a 100% chance. I've even gone and set the range up on the skill and the weapon to be identical. I know the skill works, because if I use the skill from the skill menu, it...works. But when I use the weapon, theres no animation, and it does zero damage (which is what it would do without the skill).
Any ideas? And thanks for actually writing a new version of it, I actually didn't expect that smile.gif
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Apr 3 2010, 10:51 AM
Post #9


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




That's weird. I tested several times and it worked...
What version of GTBS are you using ?


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
Meteor64
post Apr 3 2010, 11:37 AM
Post #10


Level 2
Group Icon

Group: Member
Posts: 19
Type: None
RM Skill: Beginner




I just checked... I could have swore I had 1.4 VX, but it says its v1.0... I'll try and get v1.4 and see if i can get it working :/
Edit- I just read the post on the site i got it from saying it says its 1.0 in game but its really 1.4 :/

This post has been edited by Meteor64: Apr 3 2010, 11:39 AM
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Apr 4 2010, 04:26 AM
Post #11


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




I tested it with the version 1.0 but I don't think the 1.4 is that different... Just for checking: you pasted the script under the TBS, didn't you ?


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
Meteor64
post Apr 5 2010, 07:36 AM
Post #12


Level 2
Group Icon

Group: Member
Posts: 19
Type: None
RM Skill: Beginner




Umm..umm...ummm...
...I'm a moron. I put it under Materials but above the TBS. I am a fool. Slap my hand.
Now its under there, and it works! happy.gif
T'ankee ever so much! biggrin.gif
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th June 2013 - 07:27 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker