Auto-States for Weapons

Started by AresWarrior, April 27, 2010, 10:27:59 pm

Previous topic - Next topic

AresWarrior

April 27, 2010, 10:27:59 pm Last Edit: April 27, 2010, 11:03:09 pm by AresWarrior
In RPG Maker XP, there is no option to add an Auto-State to weapons. Well with this little script, you can.
(An Auto-State is a state that affects the user of the weapon.)

In the Scene_Battle 2 script, under @phase = 1, add this:

    # Weapon Auto-State
    if $game_party.actors.size >= 1
    if $game_party.actors[0].weapon_id == WEAPON_ID
      $game_party.actors[0].add_state(STATE_ID)
    end
    end
    if $game_party.actors.size >= 2
    if $game_party.actors[1].weapon_id == WEAPON_ID
      $game_party.actors[1].add_state(STATE_ID)
    end
    end
    if $game_party.actors.size >= 3
    if $game_party.actors[2].weapon_id == WEAPON_ID
      $game_party.actors[2].add_state(STATE_ID)
    end
    end
    if $game_party.actors.size == 4
    if $game_party.actors[3].weapon_id == WEAPON_ID
      $game_party.actors[3].add_state(STATE_ID)
    end
    end

^^Change WEAPON_ID to the weapon that gives the state. Change STATE_ID to the state that the weapon gives. For each of the $game_party.actors, the IDs have to be the same if you want it to work. So if I wanted to make weapon #44 inflict state #55 then it would look like:
    # Weapon Auto-State
    if $game_party.actors.size >= 1
    if $game_party.actors[0].weapon_id == 44
      $game_party.actors[0].add_state(55)
    end
    end
    if $game_party.actors.size >= 2
    if $game_party.actors[1].weapon_id == 44
      $game_party.actors[1].add_state(55)
    end
    end
    if $game_party.actors.size >= 3
    if $game_party.actors[2].weapon_id == 44
      $game_party.actors[2].add_state(55)
    end
    end
    if $game_party.actors.size == 4
    if $game_party.actors[3].weapon_id == 44
      $game_party.actors[3].add_state(55)
    end
    end


I know this script isn't much, but it can help a lot if you want weapons with special effects. (ie. Sharp Claw: Gives the user Sharpness.)
or if you simply want an animation to appear while wearing a certain weapon. (ie. a Gold Sword would show glowing animation)

Side Note: I know the script looks messy. I don't know how to make it look nice like "case blahblahblah when 1 then 2" etc.

G_G

There is a much easier way of doing this. And it'll be easier to configure. In fact if you don't mind I'm gonna make a small script real quick.

AresWarrior

i dont mind. i'd want to see a better looking script than mine cuz its too much work to insert the same id numbers for each battler.