Main Menu
  • Welcome to The RPG Maker Resource Kit.

[REQUEST] Create Magic weapon

Started by Ryu009, January 27, 2008, 09:50:26 PM

0 Members and 1 Guest are viewing this topic.

Ryu009

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

modern algebra

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.

Ryu009

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.

modern algebra

Are you sure you want it to show up as an item? Why not a skill?

Falcon

Moved to script requests, please adhere to the script request forum rules within 24 hours.

Ryu009

#5
<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

  • Allow an equipped weapon to make a new skill available which hasn't yet been learned
  • The new skill is only available when the item IS EQUIPPED

Mockups
<<no visual aspect>>

Games its been in

  • Final Fantasy 9
  • Final Fantasy 7




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

Where did you search?

What did you search for?

  • Magic Weapon
  • Battle scripts
  • Skill scripts

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.

modern algebra

#6
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)

Falcon

Well done modern!

If Modern's doesn't work, I believe Sepiroth Spawn made one like that.

modern algebra

#8
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

Ryu009

Thanks modern for your help and ill check out the other version your talking about and see how it goes.

Ryu009

Modern your scripting skills are awesome. :) Thanks for your script it works perfectly.

modern algebra