Submit Your Article Guild Wars 2 Forum RPG Maker VX.com
 
RPG Maker
 

 Username:
 Password:
   Not a member? Register!



Home > Tutorials > RPG Maker XP > Add Auto-States to Weapons

Add Auto-States to Weapons


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:

THIS IS AN EXAMPLE!!! DO NOT COPY AND PASTE THIS!!!

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

Tutorial by AresWarrior / RedRaptor10. :) 
Details
Tutorial: Add Auto-States to Weapons
Date Listed: Wed, 02 Jun 2010 22:11:43 -0400
Author: AresWarrior
Total Hits: 2055


Embed
Short URL:

HTML:

BB Code:



RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

RPG RPG Revolution is an Privacy Policy and Legal