(Sorry if this isn't the right place for this- I wasn't quite sure since it's using both events and scripts, but in this case since it's the script specifically that's causing me problems...)
So, I'm trying to have an event check to see what type of weapon the user has equipped- ie, whether it's a sword, an ax, or any other type- and proceed from there according to the type equipped. The problem is that the conditional branch menu only can check for *specific* weapons, not types, and I'm going to have way too many weapons to try to check them one by one.
I figured I'd just use the script option in event commands. In the class Game_Actor, I found the method wtype_equipped?(wtype_id). Copying it down real quick...:
#--------------------------------------------------------------------------
# * Determine if Specific Type of Weapon Is Equipped
#--------------------------------------------------------------------------
def wtype_equipped?(wtype_id)
weapons.any? {|weapon| weapon.wtype_id == wtype_id }
end
It sounds like it's just what I need. Problem is, I don't know what class to use with it. I've tried different things, and I'm currently at:
if $game_actors[0].wtype_equipped?(1)
$game_variables.[]=(2, 1)
else
$game_variables.[]=(2, 0)
end
In the script box for that event. So, right now I'm just trying to get it to check and see if you have any of the axes equipped, and if so, change variable2 to 1; if you don't have an ax equipped, change variable2 to 0. However, $game_actors[0] isn't working for the script, and I don't know what I should have in its place. Any ideas?
Checking Equipped Weapon's Type
Started by pinkies, May 23 2012 09:11 PM
equipped equip weapon type event script
1 reply to this topic
#1
Posted 23 May 2012 - 09:11 PM
#2
Posted 08 June 2012 - 03:57 PM
The if-statement itself seems to be correct so far except that you should not check for $game_actors[0] since this usually will be nil.
Maybe it's far better to use $game_party.members[n] instead of $game_actors[n].
But you use $game_variables a bit wrong.
This will set variable 2 to value 1:
If you want to check for any party member equipped with type 1 this may help
Hope I could help
Maybe it's far better to use $game_party.members[n] instead of $game_actors[n].
But you use $game_variables a bit wrong.
This will set variable 2 to value 1:
$game_variables[2] = 1
If you want to check for any party member equipped with type 1 this may help
if $game_party.members.any?{|actor|
actor.wtype_equipped?(1)}
$game_variables[1] = 2
endHope I could help
Also tagged with one or more of these keywords: equipped, equip, weapon, type, event, script
![]() |
Support →
RPG Maker VX Ace →
Event problem, don't know how to make npc disappearStarted by skiddo96, Yesterday, 01:55 PM |
|
|
|
Support →
RPG Maker VX →
Help meStarted by Dawson Games Inc, 22 May 2013 |
|
|
||
RPG Maker Scripting →
RGSSx Script Support →
Passive statesStarted by Rasphere, 21 May 2013 |
|
|
||
![]() |
Support →
RPG Maker VX Ace →
Setting an event to occur after a variable wait timeStarted by McTone, 21 May 2013 |
|
|
|
Support →
RPG Maker VX Ace →
Seasons and Time Controlled by ComputerStarted by Lucine, 19 May 2013 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











