Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
220
First Language
English
Primarily Uses
RMVXA
How do I get the Tileset ID of the current map?

I evented a time, night/day, calendar, weather system which runs as a common event. The system works perfectly fine, but I wanted an easier way to check whether or not the player is indoors. The idea is, if the current map is using the Interior or Dungeon tiles, my Indoors? switch is flipped. At the moment, I'm using an array of IDs designated as interiors(which is probably a better idea), but I'd still like to know how to do this.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,286
Reaction score
14,274
First Language
English
Primarily Uses
RMMV
$game_map.tileset.id
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
220
First Language
English
Primarily Uses
RMVXA
Perfect. Thank you.
 

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
30
First Language
English Spanish
Primarily Uses
Judging by how this

d1a8005443f934d8cf4f769c9e2433f8.png


and this

8359fc607829e3a52d0d3b416d4d2be0.png


keep returning errors, how do i set up a switch/variable directly through scripts?

I originally wanted to store a string in a variable but that didn't work so i tried to go for a common event to store the information there and make a switch that turns on when the game begins, but i just can't get it to work.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,286
Reaction score
14,274
First Language
English
Primarily Uses
RMMV
Did you read the error they were returning?


You don't have them in a class or method, which means $game_switches doesn't even exist when you're trying to do that.


To turn on switches when the game begins, people usually just add a Control Switches command in an autorun/parallel event on the first map, that then turns on a self switch and add a second page conditioned by that self switch. You don't have to resort to scripts to do that.


And if you're doing events, you don't need to use a script call to change a switch.


Start a new thread with your question (as it's not about script calls), explain what you're trying to achieve, and then show us your events as you've got them set up.
 
Last edited by a moderator:

Joronjo

Veteran
Veteran
Joined
Sep 17, 2015
Messages
155
Reaction score
30
First Language
English Spanish
Primarily Uses
Ok. I didn't think that this was worth its own thread so i refrained from starting a new one.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,305
Reaction score
11,726
First Language
English
Primarily Uses
RMVXA
Having temporarily increased the MHP of an actor, I need a script call which will remove the extra HP when the increase is removed.

What happens is that the MHP is reduced, but the extra HP the character had remains, so the status page would show something like 221/203 (or whatever, I have no way of knowing what the figures will be as it happens repeatedly throughout the game).  Once the character is damaged in battle, the extra is lost, but he goes into battle with that bonus still present.  I did think of using a variable to store the MHP before the bonus is applied, but the player might level up between then and the time for the bonus to be removed, so that won't work.

I'm not sure that description is very clear, but it's the best I can do.  Sorry if it's a bit vague.

Thanks.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,286
Reaction score
14,274
First Language
English
Primarily Uses
RMMV
How do you remove the increase?


Something like this would work:

Code:
a.hp = a.mhp if a.hp > a.mhp
or this, if the above doesn't work:
Code:
a.change_hp(a.mhp - a.hp) if a.hp > a.mhp
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,305
Reaction score
11,726
First Language
English
Primarily Uses
RMVXA
The increase is both added and removed via your dynamic features script. Now not on my computer for several hours but I'll test these as soon as I can.

Thanks
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,286
Reaction score
14,274
First Language
English
Primarily Uses
RMMV
Ah, okay - so you've got a script call in there somewhere. Just adding one of those commands on the next line ought to do it :)
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,305
Reaction score
11,726
First Language
English
Primarily Uses
RMVXA
Both suggestions give the following error message

Game_Interpret line 1411: NameError occurred

undefined local variable or method 'a' for

 #<Game_Interpreter:0x8b1c8147>
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,286
Reaction score
14,274
First Language
English
Primarily Uses
RMMV
Well, I gave the battle damage formula code, because I didn't know your context. a is the actor whose HP you want to change. So you could do this:

Code:
a = $game_actors[5]other command here
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,305
Reaction score
11,726
First Language
English
Primarily Uses
RMVXA
The context is the series of script calls from your dynamic features script which  remove features, specifically this one

remove_feature:)actor, 1, :param, 0, 1.05)

It's not in battle, it's when the player changes maps where the weather changes, as this is being used to create geomancy attributes.  A common event is called to either add or remove features as needed.

EDIT

Using the addition, plus the first option, works, so my system is back in operation.

Thank you.
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,286
Reaction score
14,274
First Language
English
Primarily Uses
RMMV
You'd just do this then (another method I thought of, that would also work):

Code:
remove_feature(:actor, 1, :param, 0, 1.05)$game_actors[1].hp = [$game_actors.hp, $game_actors.mhp].min
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,305
Reaction score
11,726
First Language
English
Primarily Uses
RMVXA
That brings up a NoMethodError

undefined method 'hp' for #<Game_Actors
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
220
First Language
English
Primarily Uses
RMVXA
Is it possible to use message codes or an equivalent within a message box via scrip call? I want to color some text.

Just for example:

$game_message.background = 1
$game_message.position = 0
$game_message.add("Not enough \C[6]Spirit\\C[0] or \C[6]Mana\\C[0]!")

This, would of course, simply crash the game.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,286
Reaction score
14,274
First Language
English
Primarily Uses
RMMV
That brings up a NoMethodError

undefined method 'hp' for #<Game_Actors
So sorry - I only just saw this.  Yeah, I forgot the array index.

$game_actors[1].hp = [$game_actors[1].hp, $game_actors[1].mhp].min@Rinobi, you have \ sometimes and \\ sometimes.  Try one of them, and if it doesn't work, try the other one.  But make them consistent throughout the entire message.

Also, when you say "crash the game", at least give us the error message it gives you.  Otherwise we can only guess what it is.
 
Last edited by a moderator:

varchild4

Veteran
Veteran
Joined
Nov 13, 2015
Messages
30
Reaction score
3
First Language
Francais
Primarily Uses
I made a boulder and switch puzzle. When the boulder is standing on the switch it opens a door. It was successful using variables to check the position of boulder (35,28) but i wanted to simplify the event cause their will be many of those. I don't want to use variables for each one.

  • I tested with player and it works. I've put this scipt in the conditional branch:        $game_player.x == 35 and $game_player.y == 28

  • But with the bouler (EVO21) it doesn't work. I've put this scipt in the conditional branch instead:         $game_map.events[021].x == 35 and $game_map.events[021].y == 28 



Do you know why? Thanks a lot :)

Here's a sceenshot of the event: 

kIzSk.jpg
 
Last edited by a moderator:

Nikitaw99

Pixelmancer
Veteran
Joined
Nov 5, 2015
Messages
30
Reaction score
35
First Language
Russian
Primarily Uses
RMMV
I have A question: How Do I make messages appear on screen?

I am trying to do 

Toodles.meowBut nothing is happening.

Here's the "Script":

class Cat < Animal def meow print "Meow!" endend(And yeah, that's only the part of the script :p  .)

So: Why doesn't "Meow!" Appear on screen?

EDIT: By the way: 

Code:
Toodles = Cat.new
 
Last edited by a moderator:

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
220
First Language
English
Primarily Uses
RMVXA
Maybe you want:

Code:
$game_message.add("Meow!")
 

Latest Threads

Latest Posts

Latest Profile Posts

Progress on my game is nearly done, so I figured I show you guys the title screen. I hope you like it!
Title Screen.png
Does this ever happen to anyone?: your making a battle sprite [or any sprite] then when you mess something up you then see it as something diff, then working with it? its hard to say in words but it happens to me all the time
found out how to change pfp, literally there's a hidden thingy on the bottom of it
Tarzanthecat wrote on SoftCloud's profile.
Bill_shitting.jpg
Interesting week. Lots of stress and anxiety especially on Tuesday but still got thru it. How is everyone doing?

Forum statistics

Threads
109,163
Messages
1,042,646
Members
141,663
Latest member
skipbinsperthwa
Top