slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
498
Reaction score
13
First Language
english
Primarily Uses
RMVXA
I am trying to get an idea working where if a specific enemy is on a specific region id then they get buffs to their stats and a couple other things in battle. For example:
1617852773683.png1617852789649.png
The red slime is in id 63, if the player gets into a battle with it in that region then the troop gets a agility and attack stat boost and get a 50% chance to stun the player with an attack.
Note this will not be for every enemy troop, only those in specific regions that are good for that part of the map. The red slimes absorb fire, so the lava region needs to buff them up and their troop.
Thanks for the help in advance.
 

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
61
Reaction score
35
First Language
English
Primarily Uses
RMMV
There are probably better ways of doing this that are more flexible, robust, and elegant, but I think this way should work for you.

Start by selecting your red slime, and use a 'Control Variables'. Have it designate some variable called something like "X coordinate", and set it to the Map X value of This Event.
1617860846117.png
Repeat this with a variable called something along the lines of "Y coordinate".

Next, you'll want to use a 'Get Location Info' (it's on the third page, at the bottom of the "Map" heading). Set that to output into a variable called "Region ID" or something. Then select "Region ID" and designate using your X and Y coordinate variables.
1617860968472.png
I'd recommend messing around with this one, because it's possible you could use one of the Tile ID Layers to base this on the lava texture instead of the region ID, which would mean that you don't have to manually set your region ID values every time, though there might be some other problems with this method.

I'd also like to note that all of this so far is based on a tutorial I found on Steam by a user called "thesja". I probably wouldn't have figured it out on my own until much later on if it weren't for them.

Anyhow, moving on.

Next, let's create a 'Conditional Branch', and set that to check if our Region ID variable is set to the correct number (63 in this case).
1617858013318.png
I've included an 'Else' branch, even though it's probably not strictly necessary. This could let me check for multiple conditions later on if I wanted to make things more complicated.

Next, we'll add a switch to say that the red slimes should be boosted.
1617858146024.png
If you want to be extra thorough, it would be a good idea to use that 'Else' branch to tell the same switch to stay off. However, this isn't strictly necessary, although it does create the potential for a strange situation to occur where the switch doesn't get turned off after a battle, and then all your red slimes end up boosted, whether they're in the correct region to get boosted or not.

Lastly, we want to create our encounter with a 'Battle Processing', and we'll naturally set that to our Red Slimes troop. Set this up however you normally would, I've selected 'Can Escape' and 'Can Lose' because that's how I like to do these things for normal mobs.
1617858610908.png
However, it is very important that you leave the 'Battle Processing' outside of the 'Conditional Branch', or else the battle will only trigger on that specific condition.

Now I'd probably recommend moving everything we've added so far into a Common Event, or at least part of it into a Common Event. That way, I won't have to copy paste this whole script into each event every time I want to do this, and just use that single common event. Common Events also lend themselves much better to more flexible and robust solutions, since you can use them to apply to a greater variety of situations.

Next, we'll open up our database and create a new 'State'. I've called it "Red Slime Boost", though you could obviously call it whatever you want. We add in whatever bonuses we want to give in the 'Traits' section (I couldn't figure out how to give the 50% chance to stun, so I just added the Agility and Attack boost). I also like to give a little flavour text, which just serves to tell the player what's going on, and also to tell me if the 'State' has been properly applied when I'm testing.
1617859063988.png

Lastly, we'll go over to our 'Troops' tab in the Database and select the troop we told our event to use in the 'Battle Processing' earlier. We'll start by having the event page conditional on the switch we used to boost the Red Slimes earlier.1617859239444.png
Next, we'll add a 'Change Enemy State' (on the 3rd page in the middle of the 'Battle' heading) to our battle event page, and give the entire troop our Red Slime Boost State that we created earlier.
1617859457370.png
Since we've already boosted our red slimes, and the buff doesn't wear off, we'll just make sure that switch is turned off so that this still works the next time we run into lava slimes.
1617859786010.png
Last thing to do is just add an blank battle event page for when the switch is turned off, and then to test it.
1617859986954.png

Well, that should cover it, let me know if you have more questions!
I'd recommend really messing around with these and trying to understand what's happening on a conceptual level, so that in future you'll be able to expand on systems like this to be more robust and elegant, because it's a pretty interesting idea I'd never considered.
 

Attachments

  • 1617859870989.png
    1617859870989.png
    13.3 KB · Views: 0

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
61
Reaction score
35
First Language
English
Primarily Uses
RMMV
I've just realized that I did that entire tutorial in MV instead of VX Ace. I'm sure it's very similar in VX Ace, but that's still pretty boneheaded on my part

I'll update it with any differences I find in a bit
 

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
61
Reaction score
35
First Language
English
Primarily Uses
RMMV
I have just confirmed that the same process applies to VX Ace as it does to MV, with perhaps a few very minor differences in the exact terminology.
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
498
Reaction score
13
First Language
english
Primarily Uses
RMVXA
It helps. BTW here is my slime events:
1617862868407.png
1617862891850.png
Hope it doesn't mess the info you gave up. BTW what info would I put in a common event and how would I run it?
EDIT: I just noticed that location info was set to terrain tag instead of region id. LOL. Was wondering why it wasn't working. Got that fixed.
 
Last edited:

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
61
Reaction score
35
First Language
English
Primarily Uses
RMMV
For the common event, you just select all the script you think you'll run frequently, and pop it in a common event in your database.

So let's say that I have two slimes I want to use. Slime A, and Slime B.
1617870481487.png
1617870830669.png

So most of this is the same, the only thing that really changes is the battle processing at the end, and we're giving Slime B a little status boost at the start of it's battle.

First, we select, copy, and delete all the script that these events will have in common (or that we expect other events to have in common), and then go over to our database.
1617870925210.png

Paste the code into our common event, and give it a name that makes sense for what this common event does
1617871062935.png

Then, we can go back to our Slimes A and B, and replace all that extra code with the common event.
1617871213772.png
1617871231854.png

This means we have the functionality of that common event right at our fingertips, and we don't have to copy it into every single event we use, which makes it a lot simpler later on, provided the common events work.

It's not so useful if we only want to have slimes like this, but it's much more useful if you're going to be peppering a dozen or more slimes throughout your map.

The biggest advantage happens when you want to change something for all your slimes. If you code it out individually every single time, if you want to make even the tiniest change, you have to go back and change every single slime, and if you miss one, then sometimes things break pretty badly. However, if you use a common event, you just change the common event, and they're all updated to use that new code instead, so you're less likely to miss out on things.


P.S. I'm glad you found it helpful! Hopefully you learned a new technique or two from this, and you'll be able to solve other problems you'll run into in some new ways! It's great that you're adding onto what I showed, because I've always found just experimenting on my own to be a really useful way to learn things in RPGMaker
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
498
Reaction score
13
First Language
english
Primarily Uses
RMVXA
@NeptuneTron Here is my red slime event now:
1617888962805.png
Thanks you so much for all the help. If you find a better or easier way to do this please let me know.
BTW:
1617889198327.png
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
498
Reaction score
13
First Language
english
Primarily Uses
RMVXA
I'd recommend messing around with this one, because it's possible you could use one of the Tile ID Layers to base this on the lava texture instead of the region ID, which would mean that you don't have to manually set your region ID values every time, though there might be some other problems with this method.
BTW how would I do this?
 

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
61
Reaction score
35
First Language
English
Primarily Uses
RMMV
BTW how would I do this?
I'm actually not entirely sure how you'd do it, I've never tried anything like it myself. I just saw that you could use the "Get Location Info" to return the "Tile ID (Layer 1)" (or Layer 2 or Layer 3) instead of the region ID, and I think that means with some experimentation, you could try using that instead of the region ID. It would probably take some experimenting, but I believe it's at least hypothetically possible.

There's also a decent chance it wouldn't be worth the experimenting it would require, unfortunately, but that's something you'd have to decide for yourself
 

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
61
Reaction score
35
First Language
English
Primarily Uses
RMMV
As an example of what some of that experimentation might look like, I modified my common event to include a little bit of text that output the tile information where the slimes were
1617936171358.png
1617936195708.png
Then again, just because something is hypothetically possible doesn't automatically make it *actually* possible. If you set up your test in the same way I did, it's possible you won't actually get any usable results. Sometimes, the most important thing you can learn from testing and experimentation is how not to implement something
 

Thefirelion

Eventer
Veteran
Joined
Mar 25, 2017
Messages
75
Reaction score
24
First Language
Spanish
Primarily Uses
RMVXA
For your simplicity you could use the script call through a condition command event the following: $game_map.events[id].region_id == x

Id = event id
X = region number

About the tiles, try the terrain tags, put this in a conditions script command event: $game_map.events[id].terrain_tag == x
 
Last edited:

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
498
Reaction score
13
First Language
english
Primarily Uses
RMVXA
@NeptuneTron BTW when I start a battle and the slimes get the boost, the text doesn't show up like it is supposed to. How do I fix this?
1617940426300.png
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,984
Reaction score
665
First Language
English
Primarily Uses
RMVXA
If you set up your test in the same way I did, it's possible you won't actually get any usable results.
I think You just didn't put in the right settings. You probably used player x & y not event.
My test gave different results.
1617984412834.png

1617984468988.png1617984745537.png
How do I fix this?
At what point are you adding the state? Are you setting a switch on like in the pictures above? If so tehn in the troop tab for the slimes add the state to all slimes when the switch is on. It should show when you are in battle, if not you can make it a message text box in the troop tab.
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
498
Reaction score
13
First Language
english
Primarily Uses
RMVXA
For your simplicity you could use the script call through a condition command event the following: $game_map.events[id].region_id == x

Id = event id
X = region number

About the tiles, try the terrain tags, put this in a conditions script command event: $game_map.events[id].terrain_tag == x
BTW, this idea is good, but requires me to do it for each individual event since they all have different ids.

At what point are you adding the state? Are you setting a switch on like in the pictures above? If so tehn in the troop tab for the slimes add the state to all slimes when the switch is on. It should show when you are in battle, if not you can make it a message text box in the troop tab.
I got that done, now I need to figure out the info for the terrain tag that you were showing.
@Roninator2 How would I do that? I am a bit confused by the picture setup.
 
Last edited:

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
61
Reaction score
35
First Language
English
Primarily Uses
RMMV
For your simplicity you could use the script call through a condition command event the following: $game_map.events[id].region_id == x

Id = event id
X = region number

About the tiles, try the terrain tags, put this in a conditions script command event: $game_map.events[id].terrain_tag == x
Oh that's devilishly simple. Very elegant my dear sir.

You could further improve this by changing it to $game_map.event[self.event_id()].region_id == x

Then you could even make it more fancy by potentially making x some kind of array, if you really wanted to.
 
Last edited:

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
498
Reaction score
13
First Language
english
Primarily Uses
RMVXA
Oh that's devilishly simple. Very elegant my dear sir.

You could further improve this by changing it to $game_map.event[this.event_id()].region_id == x

Then you could even make it more fancy by potentially making x some kind of array, if you really wanted to.
How would I set that up with there being multiple events and them all having different ids?
 

NeptuneTron

The Salticid Scholar of the North
Veteran
Joined
Jan 13, 2018
Messages
61
Reaction score
35
First Language
English
Primarily Uses
RMMV
@NeptuneTron BTW when I start a battle and the slimes get the boost, the text doesn't show up like it is supposed to. How do I fix this?
View attachment 185511
I honestly don't know why it isn't showing the first text, it seems to be something to do with how the engine inflicts the state that it's not showing up like we expect it to. However, it seems like the remain text works correctly. It's also an issue that persists in MV, so I don't think there's really any way around it unless you have a lot more technical know-how than I do.


How would I set that up with there being multiple events and them all having different ids?
I'd use the "this.event_id" script in a common event. Just go to your common event, and change it to something like this:
1618025577245.png
1618025592542.png
The script inside should say
$game_map.events[self.event_id].region_id == 63

By using "self" (the VX Ace/Ruby equivalent of MV/JavaScript's "this"), it refers to whatever event calls the common event, and looks at the calling event's information instead of requiring it to be manually declared.
 

Latest Threads

Latest Profile Posts

let me introduce you to my worlds source of "wool". A pretty simple-minded, easily scared and mostly blind, double-headed big wooly bird thingy :D Children may be able to ride on a trained one, but they don't support the weight of adults, so they aren't suitable for transportation. And herders use the shown tool to give them sound commands
6nwyqEJ.png
This Life is a Dream is in full production! More pics and some free promo assets coming soon!
Dragonfly3116 wrote on Redweaver's profile.
i need to ask do you mind sending me a link to tutorial town an legend of ancients Please My new Email is necroboy1973@gmail.com
I Am A Member On The Site Here As Well If Your Still teaching Let Me Know Thanks Joseph
Added store elements.
44JtdpE5n4jQMFkSi7pACW.png

2uqvqT3uCWxcXAhlyZokxg.png

The next step will be to start making props (including distillers).
I just saw one of SigmaSuccor's RPG Maker news videos, it mentioned one of my plugins. Now I kind of wish I'd made a demo project for it, having nothing in that segment but a scroll down the code feels a little underwhelming given what the plugin COULD do. Except I suck at making demo stuff, and my testing project isn't fit for that. :(

Forum statistics

Threads
110,523
Messages
1,053,920
Members
143,613
Latest member
captnemo
Top