Status
Not open for further replies.

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,740
Reaction score
15,876
First Language
English
Primarily Uses
RMMV
mordor3, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


It's better to just reply to the original question, instead of adding more that wasn't requested, as it just causes confusion.


To change an event's self switch from another event, you do this:

Code:
$game_self_switches[[map_id, event_id, self_switch_id]] = value
where map_id is the number of the map (no leading zeros), event_id is the id of the event whose self switch you want to change (no leading zeros), self_switch_id is one of 'A', 'B', 'C' or 'D', and value is either true or false.
 

ratlinggun

Villager
Member
Joined
Jan 26, 2014
Messages
15
Reaction score
12
Primarily Uses
I've been killing myself with this and I've been searching the net for the entire afternoon and I can't get it to work. I'm trying to get a script call that will store the number of the armor equipped in a speciffic inventory slot (number under which the item is created in the editor). The problem is that I am using Yanfly's Equip Menu and there are 40-ish custom slots there.

This works

$game_variables[10] = $game_actors[11].equips[0]

but the result is not the equipment number but some strange code.

So, can anyone help me by revealing me the script call for checking this?

Also if I'm posting in the wrong topic please excuse me.
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
348
Primarily Uses
It should work if you add .id to the end of what you have.
 

ratlinggun

Villager
Member
Joined
Jan 26, 2014
Messages
15
Reaction score
12
Primarily Uses
Thank you for the reply, Boom!. Unfortunately, I have already tried that but I get an error

Script 'Game_Interpreter' line 1409: NoMethodError occured.

undefined method `id' for nil:NilClass.
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
348
Primarily Uses
It's probably trying to check the id of someone who does not have a weapon. Try tacking on unless $game_actors[11].equips[0] == nil
 

ratlinggun

Villager
Member
Joined
Jan 26, 2014
Messages
15
Reaction score
12
Primarily Uses
Oh my God... I'm such an idiot!  :o  THANK YOU, BOOM!, THANKS SOOO MUCH!
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
348
Primarily Uses
Hey, I missed it at first too. And it's Racheal, not Boom! Boom! is an (outdated) user title.
 

ratlinggun

Villager
Member
Joined
Jan 26, 2014
Messages
15
Reaction score
12
Primarily Uses
Hahahaha! I see, didn't even notice the text... guess I'm just bound to miss things today... My appologies, Racheal.  :)
 

TKLF

Villager
Member
Joined
May 12, 2013
Messages
8
Reaction score
0
Primarily Uses
Skimmed through the thread and didn't notice this being asked:

What's the call that returns the current number of actors in the party? I was thinking $game_party.members, but that's not it.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,740
Reaction score
15,876
First Language
English
Primarily Uses
RMMV
$game_party.members.size


You can also just do this via Control Variables - it's in Game Data > Other > Party Members.


Both will return a different value depending on whether you're in battle or not. When in battle, it'll give you the number of battlers in your party. When on the map, it'll give you the total size of your party.


If you're in battle but you WANT the total size of your party (not just battlers), use $game_party.all_members.size instead.
 
Last edited by a moderator:

ratlinggun

Villager
Member
Joined
Jan 26, 2014
Messages
15
Reaction score
12
Primarily Uses
Ok, since I've been helped here I feel like contributing to the community myself. I don't know which of these have been posted but I think most still haven't, so I'm just gonna sum them up for people.

CHECKING AVAILABILITY

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

$game_actors[X].equips.include?($data_armors[Y]) - Checks if the actor #X has equipment (shield, armor, helmet or accessory) #Y equipped

$game_actors[X].skills.include?($data_skills[Y]) - Checks if the actor #X has learned skill #Y

$game_actors[X].states.include?($data_states[Y]) - Checks if the actor #X is afflicted by status effect #Y

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.

CHECKING ACTORS

$game_actors[X].name - Returns the name of the actor #X

$game_actors[X].nickname - Returns the nickname of the actor #X

$game_actors[X].class.id - Returns the ID of the actor #X class

$game_actors[X].class.name - Returns the name of the actor #X class

USING SCRIPT CALLS TO CALL SCRIPT FUNCTIONS

If you're having problem with low event script call space you can use event script call to call your own script function.

Create a new script below ▼ Materials/素材 but above ▼ Main and in the script put:

 

class Game_Interpreter      

  def custom_script()

    YOUR SCRIPT

  end

end 

 

Then you just need to call the script by typing the name of the function (the bold red text) inside the event script call. So in this case I'd just type custom_script into the event script call.

This also saves you time of repeatedly typing many long script lines into event scripts and calling them by one simple line instead. 

_____________________

 

I'm probably gonna edit and add more stuff to this post later...
 
Last edited by a moderator:

TKLF

Villager
Member
Joined
May 12, 2013
Messages
8
Reaction score
0
Primarily Uses
$game_party.members.size

You can also just do this via Control Variables - it's in Game Data > Other > Party Members.

Both will return a different value depending on whether you're in battle or not. When in battle, it'll give you the number of battlers in your party. When on the map, it'll give you the total size of your party.

If you're in battle but you WANT the total size of your party (not just battlers), use $game_party.all_members.size instead.
Thanks Shaz.

The battlers are the guys you bring into battle with you, right? And party would be the entire party, including reserve members and such?
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,740
Reaction score
15,876
First Language
English
Primarily Uses
RMMV
That's right. The battlers are the first 4, by default, unless you have a script or have changed the party script to use a different number of battlers.
 

Chaos17

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

I'm sorry if I'm in the wrong thread but I'm searching a way to display the playtime of a specific slot save on my screen through script call.

I was able to corner the playtime of a slot save, that's all I could do :(

Code:
$Tsav0 = DataManager.load_header(0)[:playtime_s]draw_text(0, 0, 12, line_height, header[:playtime_s], 0)
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,740
Reaction score
15,876
First Language
English
Primarily Uses
RMMV
Wouldn't that be

draw_text(0, 0, 12, line_height, $Tsav0)???
Where are you that you want to display the play time - IN the save/load menu? On the map?
 

Chaos17

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

I would like to display it on a map and I tried what you suggested me but I got this error :

6Ioqs.png
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,740
Reaction score
15,876
First Language
English
Primarily Uses
RMMV
Do you actually HAVE a save file 0? If it can't load it, then DataManager.load_header(0) would be nil.

So maybe something like this instead (don't use global variables if you don't need to):

Code:
header = DataManager.load_header(0)draw_text(0, 0, 12, line_height, header[:playtime_s]) if header
Though, if you're doing it from Scene_Map, or from an event on the map, I'm not sure it'd know what line_height is either, because Scene_Map doesn't inherit from the Window_Base class. You might need to hardcode 24 there instead of line_height (that's not causing THIS error, but I think it'd cause another once you got past this one).
 

Chaos17

Dreamer
Veteran
Joined
Mar 13, 2012
Messages
1,318
Reaction score
492
First Language
French
Do you actually HAVE a save file 0? If it can't load it, then DataManager.load_header(0) would be nil.
Don't worry, I tested it in a new project.

Yeah, seems it doesn't : line height.

6IOGz.png


But the

header = DataManager.load_header(0)
header = DataManager.load_header(0)draw_text(0, 0, 12, line_height, header[:playtime_s]) if header
They work, I can see the data of the playtime in the console.

So there is something with the draw text that I still don't get it, it seems.

Edit : ok, it seems line height work only with a window... so I can just shpw playtime without coding a window ?...
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,740
Reaction score
15,876
First Language
English
Primarily Uses
RMMV
I said in my previous post, if it didn't like line_height, to just put in 24 instead ;)
 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Not an RPG Maker Update but I'm happy to say that I finally passed my drivers written test. Which makes me a happy guy.
FWRu-cYXkAAAUbl
Have you ever been in such a luck streak you felt fear something was wrong?
I'm going to be adding in combat animations, revamping the UI and putting in a new cutscene this week, so this is your last chance to play the MC:RIS demo in its original form! Say you were there since the beginning! https://qos.itch.io/infinite-sadness
I added reflections and shadows. Though one of the party seems to have no reflection, is floating, with glowing eyes. I'm sure it's fine.
p7O1sjG.png
Well. *That* was an entertaining fustercluck — and that’s not meant nearly as sarcastically as it sounds. I just had to make four different versions of the same conversation:
1: Attained MacGuffin.
2: Have not attained MacGuffin, but know its location.
3: Do not know MacGuffin’s location, but have a good idea where to find it.
4: Do not know where to look for MacGuffin.
Yep, feels good to be back. ^.^

Forum statistics

Threads
123,117
Messages
1,154,090
Members
161,445
Latest member
caihong201814
Top