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
> Want to add Auto-States to Weapons?, Take a look here!
AresWarrior
post Apr 27 2010, 06:03 PM
Post #1


Level 5
Group Icon

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




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:

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

This post has been edited by AresWarrior: Apr 27 2010, 07:02 PM
Go to the top of the page
 
+Quote Post
   
Legacy
post Apr 27 2010, 06:06 PM
Post #2


B★RS Coding Ninja
Group Icon

Group: Global Mod
Posts: 1,414
Type: Scripter
RM Skill: Advanced
Rev Points: 15




This is actually a very useful snippet, and im sure that it will help allot of people out there, nicely done. keep the good work coming happy.gif


__________________________
Freelance Programmer (C#, C++, Ruby)
#onegameamonth


Have you seen the new Unity3D sections?..
Unity 3D Discussion
Unity Script Development
Unity Projects
Go to the top of the page
 
+Quote Post
   
NOWAYLARRY
post May 1 2010, 10:44 PM
Post #3


Level 5
Group Icon

Group: Member
Posts: 61
Type: Developer
RM Skill: Intermediate




wow, I've really wanted to be able to do just that. This is really great! Kudos!
Go to the top of the page
 
+Quote Post
   
Mataris
post May 10 2010, 06:41 PM
Post #4


Level 5
Group Icon

Group: Member
Posts: 73
Type: None
RM Skill: Intermediate




So if I put vemon state on a weapon would it poision me or make it so that when i attacked it poisioned my enemy?
Go to the top of the page
 
+Quote Post
   
Kread-EX
post May 10 2010, 11:57 PM
Post #5


(=___=)/
Group Icon

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




It would poison you, duh. If you need to poison the enemy, you just have to check poison in the state infliction box.


__________________________
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
   
Locke
post May 15 2010, 06:13 PM
Post #6


Level 10
Group Icon

Group: Revolutionary
Posts: 151
Type: Mapper
RM Skill: Intermediate




Fairly easy not hard Great! thumbsup.gif


__________________________
We are one (Really i,m not joking)



I've seen many things when mankind rule the land


Which Final Fantasy Character Are You?
Go to the top of the page
 
+Quote Post
   
DragonMaxter
post Jun 21 2010, 03:23 PM
Post #7


Level 2
Group Icon

Group: Member
Posts: 27
Type: Artist
RM Skill: Intermediate




Awesome. Where do i put this code at?

Edit: Sorry for the stupid question, i'm a total dunce when it comes to scripting..

This post has been edited by DragonMaxter: Jun 21 2010, 03:26 PM
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Jun 22 2010, 12:19 AM
Post #8


(=___=)/
Group Icon

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




QUOTE (AresWarrior @ Apr 28 2010, 04:03 AM) *
In the Scene_Battle 2 script, under @phase = 1

Just here.


__________________________
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
   
DragonMaxter
post Jun 22 2010, 07:41 PM
Post #9


Level 2
Group Icon

Group: Member
Posts: 27
Type: Artist
RM Skill: Intermediate




QUOTE (Kread-EX @ Jun 22 2010, 01:19 AM) *
QUOTE (AresWarrior @ Apr 28 2010, 04:03 AM) *
In the Scene_Battle 2 script, under @phase = 1

Just here.

Oh, thank you. I must have missed that. i feel dumb

Can i double layer this? just restarting at " # Weapon Auto-State" for multiple weapons, changing the values?

This post has been edited by DragonMaxter: Jun 22 2010, 07:44 PM
Go to the top of the page
 
+Quote Post
   
Kread-EX
post Jun 23 2010, 12:39 AM
Post #10


(=___=)/
Group Icon

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




Yes, you have an example of this in the OP post.


__________________________
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
   
AresWarrior
post Jun 23 2010, 08:34 AM
Post #11


Level 5
Group Icon

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




the script is really bad and messy sad.gif . I'm sure someone else can make a cleaner version
Go to the top of the page
 
+Quote Post
   
Hakusprite
post Aug 1 2010, 06:25 PM
Post #12



Group Icon

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




QUOTE (AresWarrior @ Jun 23 2010, 12:34 PM) *
the script is really bad and messy sad.gif . I'm sure someone else can make a cleaner version


He said it was messy dry.gif and besides it's actually really useful.
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: 21st May 2013 - 08:07 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker