The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: Ryu009 on January 27, 2008, 09:50:26 PM

Title: [REQUEST] Create Magic weapon
Post by: Ryu009 on January 27, 2008, 09:50:26 PM
I want to create a sword that can also be used as an item, and what happens when you use it as an item is a magic fire spell is cast.  Only problem is how do i do this and by default when you use an item it disappears after use, how can i resolve this issue?
Thanks for your help,
~Ryu
Title: Re: Create Magic weapon [RMXP]
Post by: modern algebra on January 27, 2008, 10:08:34 PM
You will need to have some kind of script for that. And, the other question was answered in your other topic but you set consumable to NO

EDIT::
Also, it would be possible to do the first through events - BUT, anybody could use the item :/ Which doesn't make any sense unless your guys are cocnstantly throwing each other a flaming sword.
Title: Re: Create Magic weapon [RMXP]
Post by: Ryu009 on January 27, 2008, 10:28:55 PM
I'm a noob at scripting, I just started to read the help file from rmxp about scripting so I'm still in the process of learning how to script.  Could someone please write this script for me or tell me where i can find such a script which will allow a weapon to be used as an item that casts a fire spell.
Title: Re: Create Magic weapon [RMXP]
Post by: modern algebra on January 27, 2008, 10:46:21 PM
Are you sure you want it to show up as an item? Why not a skill?
Title: Re: Create Magic weapon [RMXP]
Post by: Falcon on January 27, 2008, 10:47:14 PM
Moved to script requests, please adhere to the script request forum rules within 24 hours.
Title: Re: Create Magic weapon [RMXP]
Post by: Ryu009 on January 28, 2008, 12:38:36 AM
<Create Magic Weapon>
<11/27/2008>




Summary
<<What this script will do is temporarily make a skill available for use only when a certain weapon is equipped.  So when the user unequips the item the skill will no longer be visible in the list of skills during combat.>>

Features Desired

Mockups
<<no visual aspect>>

Games its been in




Did you search?
<<yes, i searched>>

Where did you search?

What did you search for?

P.S. Falcon, is this what u meant by "please adhere to the script request forum rules within 24 hours."
Please disregard anything i said in the previous posts, I only want it to appear as a weapon and i no longer want the weapon to be used as an item effect.  This might sound confusing so please just tell me if it is and I'll try to explain it better.
Title: Re: [AVAILABLE] Create Magic weapon
Post by: modern algebra on January 28, 2008, 01:21:49 AM
Try this:


#==============================================================================
#  Skill Teaching Weapons
#  Version 1.0
#  Author: modern algebra (rmrk.net)
#  Date: January 27, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#     Insert this script just above Main. To configure your database, see the
#     Configuration Section at line 23
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ** RPG::Weapon
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Adds an additional stat, skill id, to the weapon object
#==============================================================================

class RPG::Weapon
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Skill ID
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def skill_id
    learn_skill = 0
    case @id
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * CONFIGURATION
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #  It is very easy to configure the database. All that you need to do
    #  is write:
    #
    #     when <weapon ID>
    #       learn_skill = <skill_id>
    #
    #  For every weapon that you want to teach skills. To discover what the
    #  ID of a weapon or a skill, look at the number directly to the left
    #  of their names in the Database. There are two examples below. Feel
    #  free to delete them once you understand what you need to do.
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    when 1 # Bronze Sword
      learn_skill = 1 # Heal
    when 2 # Iron Sword
      learn_skill = 69 # Poison Edge
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * END CONFIGURATION
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    end
    return learn_skill
  end
end

#==============================================================================
# ** Game_Actor (addition for skill teaching weapons)
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Change Equipment
  #     equip_type : type of equipment
  #     id    : weapon or armor ID (If 0, remove equipment)
  #--------------------------------------------------------------------------
  alias ma_skill_teaching_weapons_change_equipment equip
  def equip (equip_type, id)
    # Forget the skill from the previously equipped weapon
    forget_skill ($data_weapons[@weapon_id].skill_id) if equip_type == 0 && @weapon_id != 0
    # Run original method
    ma_skill_teaching_weapons_change_equipment (equip_type, id)
    # Learn the skill from the weapon just equipped
    learn_skill ($data_weapons[@weapon_id].skill_id) if equip_type == 0 && @weapon_id != 0
  end
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  alias ma_skill_teaching_weapons_actor_setup setup
  def setup(actor_id)
    # Run original method
    ma_skill_teaching_weapons_actor_setup (actor_id)
    # If there is a skill attached to weapon, learn it
    learn_skill ($data_weapons[@weapon_id].skill_id) if @weapon_id != 0
  end
end


I think I will put that in my scriptlets too :<

EDIT:: Tell me if anything goes wrong :O)
Title: Re: [AVAILABLE] Create Magic weapon
Post by: Falcon on January 28, 2008, 01:30:05 AM
Well done modern!

If Modern's doesn't work, I believe Sepiroth Spawn made one like that.
Title: Re: [AVAILABLE] Create Magic weapon
Post by: modern algebra on January 28, 2008, 01:52:05 AM
Thanks  :D


There's one problem with it right now ryuu, and that is that unequipping the weapon will always make the actor forget the skill, even if he had the skill through natural means (i.e. got it from something besides the weapon). Is that going to be a problem for you? If it is, the problem is fixed by this other version:

http://rmrk.net/index.php/topic,24405.0.html
Title: Re: [AVAILABLE] Create Magic weapon
Post by: Ryu009 on January 31, 2008, 02:31:25 PM
Thanks modern for your help and ill check out the other version your talking about and see how it goes.
Title: Re: [REQUEST] Create Magic weapon
Post by: Ryu009 on January 31, 2008, 03:04:54 PM
Modern your scripting skills are awesome. :) Thanks for your script it works perfectly.
Title: Re: [REQUEST] Create Magic weapon
Post by: modern algebra on January 31, 2008, 04:02:02 PM
No problem. I'm glad you like it