Status
Not open for further replies.

TKLF

Villager
Member
Joined
May 12, 2013
Messages
8
Reaction score
0
Primarily Uses
Back here again...

Is there a way to determine the weapon type (Axe, Sword, Bow, Staff) that an actor currently has equipped?

[...]

CHECKING AVAILABILITY

$game_actors[X].equips.include?($data_weapons[Y]) - Checks if the actor #X has weapon #Y equipped

[...]
CHECKING FOR NAME/ID OF EQUIPMENT

$game_actors[X].equips[Y].id unless $game_actors[X].equips[Y] == nil - Returns the ID of the equipment on actor #X, equipped in slot #Y

$game_actors[X].equips[Y].name unless $game_actors[X].equips[Y] == nil - Returns the name of the equipment on actor #X equipped in slot #Y

NOTE: If using any scripts that give or take equipment slots, the #Y is the number of the character's slot, not the slot's number in the script. I.E. using Yanfly Equip Menu script - if your character has equipment slots 6,7,8,15,15,32,75 available then $game_actors[1].equips[0].id would return the ID of the item equipped in the slot defined as slot 6 in Yanfly script because it's the 1st equipment slot for the specific character.

[...]
I'd assume it's something similar to this, but these just pull the name and ID, not the weapon type itself - and I'm not sure if weapon types are actually bound to the weapon, and not just a string that is checked when the player equips a weapon/armor...

Alternatively, I supposed I could just manually loop through and check if each ID is equipped to determine the type, but that sounds like a lot of work I'd like to avoid. :headshake:

EDIT: $game_actors[X].equips.include?($data_weapons[Y..Z]) - Would this also work in checking a range between Y and Z (assuming they're all the same type)? Or is this sort of thing limited to hashes and not arrays, haha. I guess I may have to do a  loop in the end.
 
Last edited by a moderator:

Selchar

Veteran
Veteran
Joined
Dec 28, 2012
Messages
299
Reaction score
82
First Language
English
Primarily Uses
Should be...

$game_actors[X].equips[Y].wtype_id unless $game_actors[X].equips[Y] == nil
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,744
Reaction score
15,879
First Language
English
Primarily Uses
RMMV
Or (I'm doing this without any scripts in front of me, so I'm assuming Selchar's syntax is correct):

$game_actors[x].equips[y].wtype_id if $game_actors[x].equips[y]if xxx
is the same as


unless xxx == nil
 

TKLF

Villager
Member
Joined
May 12, 2013
Messages
8
Reaction score
0
Primarily Uses
$game_actors[X].equips[Y].wtype_id unless $game_actors[X].equips[Y] == nil

$game_actors[x].equips[y].wtype_id if $game_actors[x].equips[y]if xxxis the same as

unless xxx == nil
Thanks both!

EDIT // just to be safe instead of making a new post:

Is there a call for an actor's base stats/parameters, without those added on by weapons, equipment, states, and the like?

Or perhaps a roundabout method: some way to access the parameters added on by equipment so I can substract it from the stat total itself?
 
Last edited by a moderator:

ratlinggun

Villager
Member
Joined
Jan 26, 2014
Messages
15
Reaction score
12
Primarily Uses
EDIT // just to be safe instead of making a new post:

Is there a call for an actor's base stats/parameters, without those added on by weapons, equipment, states, and the like?

Or perhaps a roundabout method: some way to access the parameters added on by equipment so I can substract it from the stat total itself?
I don't know if you can get only the basic ones. You can try getting the total and reduce the sum of all equipment bonuses.

$game_actors[X].str

$game_actors[X].equips[Y].str unless $game_actors[X].equips[Y] == nil

I'm not certain if these formulas would work out of my head and I'm going to bed now so I might check them tomorrow. If anyone can confirm them or write in correct ones it would also be nice.
 

TKLF

Villager
Member
Joined
May 12, 2013
Messages
8
Reaction score
0
Primarily Uses
I tried that at first too, but it just gave me NoMethodErrors.

After tinkering around, I figured it out:

$game_actors[A].equips[Z].params[Y]

-or-

$data_weapons[X].params[Y]

A = Actor ID

X = Weapon ID

Y = Accepts value from 0 to 7, which are representative of the parameters themselves.

MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK, in that order.

ie ATK would be [2], AGI would be [6].

Z = Equip slot.

Unfortunately for me, a script is interfering with me pulling the ID of the character's equipped item, so I need to figure that out next.

EDIT: Forgot to add the previous call, which just checks the slot, thank goodness that's avoided.
 
Last edited by a moderator:

Jory4001

Veteran
Veteran
Joined
Feb 16, 2014
Messages
80
Reaction score
20
First Language
English
I am looking for the Script equivalent of this conditional event command:

@> Conditional Branch [Player] is [skill Name] Learned

    @>

Else

    @>

End Branch

I require it to be in script so I can identify the Actor by Actor_Id, where the event command you have to choose a specific actor.

Example:

@> Conditional Branch $game_actors[X] is [skill Name] Learned

    @>

Else

    @>

End Branch

Where X is the actor's ID.

Searched the forums and google and found nothing, any help would be awesome and save a ton of repeat events Thanks!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,744
Reaction score
15,879
First Language
English
Primarily Uses
RMMV
I have moved your post into the Script Call Equivalent of Events thread.


You'd be after something like this:

$game_actors[actorid].skill_learn?($data_skills[skillid])where actorid and skillid are the ids from the database of the actor and skill you're interested in.
It will return true if they have that skill, and false if they don't.
 

Caustic

Hopped Up on Goofballs
Member
Joined
Jan 6, 2014
Messages
182
Reaction score
39
First Language
Engrish
Primarily Uses
Derpish question here:

What's the call to add wait frames in Eventing scripts, if there is one? (like the "Wait: 'x' frame(s)" event command, but scripted instead of a command)

I swear I saw it before but can't seem to find it now ~.~
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
348
Primarily Uses
If you're calling it from within the interpretor (aka the script command on the third page), it's just

Code:
wait(x)
with x being the number of frames. From a move route or something like that, you'd need the following
Code:
SceneManager.scene.wait(x)
The following should work as well from anywhere?
Code:
x.times { Fiber.yield }
 

Caustic

Hopped Up on Goofballs
Member
Joined
Jan 6, 2014
Messages
182
Reaction score
39
First Language
Engrish
Primarily Uses
.....

I totally knew that! Or should have, anyhow  :dizzy:

Thank you ^^;
 

ratlinggun

Villager
Member
Joined
Jan 26, 2014
Messages
15
Reaction score
12
Primarily Uses
Hmmm... I don't think anybody asked this, so is there any script call or maybe a short combination of codes that would determine the region at X:Y coordinates?

Is there a script call that can change a region on X:Y coordinates of the map?

Edit: Thanks FiXato :)
 
Last edited by a moderator:

FiXato

Villager
Member
Joined
Apr 1, 2013
Messages
5
Reaction score
0
Primarily Uses
Hmmm... I don't think anybody asked this, so is there any script call or maybe a short combination of codes that would determine the region at X:Y coordinates?

Is there a script call that can change a region on X:Y coordinates of the map?
You can get the region_id for given coordinates with:

$game_map.region_id(x, y)As for changing the region id... not sure. This topic didn't have an answer either.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,744
Reaction score
15,879
First Language
English
Primarily Uses
RMMV
You would be able to make a script call to change the region on a map tile, but it would only stick until you left the map. When you reloaded it, it would revert to the original region. You would have to have a script written that would give you an easy way to change regions, save them with the player's save data, and then load them again on loading a map.
 

Chaos17

Dreamer
Veteran
Joined
Mar 13, 2012
Messages
1,318
Reaction score
492
First Language
French
Hi,

Is there a script call to be able to load a specific save, please ?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,744
Reaction score
15,879
First Language
English
Primarily Uses
RMMV
DataManager.load_game(index)


where index is the save file number you're after. I'm not sure if index=0 means save1 or save0, but it wouldn't take much to test.
 

Petite Elite

Veteran
Veteran
Joined
Jan 1, 2013
Messages
128
Reaction score
93
First Language
English
Primarily Uses
How would you check the ID of equipment in slot Y equipped to character X, then store it in a variable? 

I'm guessing it would be something similar to what was mentioned on page 13.

Also, is there a way to draw the name of said equipment in a dialogue box?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,744
Reaction score
15,879
First Language
English
Primarily Uses
RMMV
$game_variables[3] = @actor.equips[4].idwould store the id of whatever is in slot 4 into variable 3.Remember though, that could be either a weapon OR armor - especially if it's in slot 2.

If you go to Window_Base and find the convert_escape_characters method, you can add a few lines that will then let you print out the name of equipment:

def convert_escape_characters(text) result = text.to_s.clone result.gsub!(/\\/) { "\e" } result.gsub!(/\e\e/) { "\\" } result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] } result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] } # added lines below result.gsub!(/\eA\[(\d+)\]/i) { $data_armors[$1.to_i].name } result.gsub!(/\eW\[(\d+)\]/i) { $data_weapons[$1.to_i].name } # added lines above result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) } result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) } result.gsub!(/\eG/i) { Vocab::currency_unit } result endYou can then put this sort of thing in your message boxes:

\A[5] - to display the name of armor 5

\W[8] - to display the name of weapon 8

\W[\V[15]] - to display the name of the weapon whose id is in variable 15
 

Petite Elite

Veteran
Veteran
Joined
Jan 1, 2013
Messages
128
Reaction score
93
First Language
English
Primarily Uses
Thanks, Shaz, however...

$game_variables[x] = @actor.equips[y].id

Is giving me an error. Apparently "equips" is an undefined method. 

Also, how would I get the ID of equipment from other actors?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,744
Reaction score
15,879
First Language
English
Primarily Uses
RMMV
When you report an error, you really need to give the EXACT error message. Is it equips that's undefined (I know it's not, because equips IS a method on an actor), or is @actor undefined? Are you writing it in the script call EXACTLY as it is above? You're not meant to - you're meant to put in the variable number instead of x, the slot number instead of y, and whatever it is you're using to define what actor you're talking about instead of @actor.
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Map025.png

The second settlement you'll visit in my newest game. The small village of Teytal.
sketch 4 an opening cinematic in my gameeee >:]
Untitled_Artwork_16.jpg
oh god how do I add pictures on here it keeps saying i need a link <--( suddenly forgot how technology works )
avery wip.png

"i have to work in like 5 hours ... let's start the main character's face set"
--me, an adult for the past 20 years

Forum statistics

Threads
123,161
Messages
1,154,495
Members
161,516
Latest member
rehnstillnight
Top