Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
I put together a Shovel key item that has a common event when used. I got a great idea today, the common event checks Region IDs for spots to dig in. I plan on adding a variable so the shovel will break over time and buy a new one.

So then I thought, is there a button that would be wise or good to use for Shoveling? Having to open the menu and click on the item is just okay. Having a button to repeatedly click would be better. But I'm unsure if that is a good choice so I thought to ask here if there is a good button to use.

Thoughts? (Thanks for reading)
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,836
Reaction score
2,173
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!

Since you are talking about Region Ids and common events, I presume that you didn't put a regular event everywhere on the map, but instead, you are checking for the player region. And if it is on the right region, you do the shovel event.

In that case, maybe you can use the default Z?
Put a check on your common event:
If Button Ok is pressed and if the player is on region ID X and if the player has Item Id X
then do the shovel event.
Otherwise, do nothing.
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
Hi there!

Since you are talking about Region Ids and common events, I presume that you didn't put a regular event everywhere on the map, but instead, you are checking for the player region. And if it is on the right region, you do the shovel event.

In that case, maybe you can use the default Z?
Put a check on your common event:
If Button Ok is pressed and if the player is on region ID X and if the player has Item Id X
then do the shovel event.
Otherwise, do nothing.


Thank you! I will have to try this.

I also had another idea, but not sure if it is a viable option. Could there be a script to check if the player has the Shovel equipped as a weapon and only then the player would be able to hit a button to dig in spots with the Region ID?

The only thing I am worried about is if assigning a key could backfire or coincide with other events or something. I mean, I don't want to replace keys that actually do something important.


Extra note for anyone who actually likes the digging idea. Each of my maps is assigned with a variable so I think I can choose custom items found for each map within the common event. And adding a random variable message. Like,

If map = 22 (Or whatever number, this is just an example)
Random 1 to 2 var

If random 1
item found (but only if player is in map 22)

If random 2
No item found
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
5,730
Reaction score
2,263
First Language
Dutch
Primarily Uses
RMMV
another way which could be possible is YEP_EventSpawner
and create the event inside there.

a usefull way is to select teh item "Shovel" and turn of a switch,
so yo ucan use the button "Z" or other to dig untill it brokes and
switch turned off.

you dont really need to check MAP idea unless its a specific map you can
dig on, or use different regions or different shovels.

I believe there was a basic setup to be found on youtube,
but the event spawner is something you should use to edit it once
if it doesn't work right away.
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
you dont really need to check MAP idea unless its a specific map you can
dig on, or use different regions or different shovels.

Well, I'd like to be able to dig up different items in some other areas. And if the event is all through a common event, then conditional checking the maps I gave variables to is the way I'd like to do it. I already have them numbered because I made a minimap based off a tutorial somewhere. I just thought it would make it more interesting than the same items being dug up everywhere in the game.

I may just end up having the dig only on one map, but I the idea of any map sounds good to me right now too.

I guess I don't really get why I would need the event spawner right now?
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,836
Reaction score
2,173
First Language
Portuguese - Br
Primarily Uses
RMMZ
Thank you! I will have to try this.

I also had another idea, but not sure if it is a viable option. Could there be a script to check if the player has the Shovel equipped as a weapon and only then the player would be able to hit a button to dig in spots with the Region ID?

The only thing I am worried about is if assigning a key could backfire or coincide with other events or something. I mean, I don't want to replace keys that actually do something important.


Extra note for anyone who actually likes the digging idea. Each of my maps is assigned with a variable so I think I can choose custom items found for each map within the common event. And adding a random variable message. Like,

If map = 22 (Or whatever number, this is just an example)
Random 1 to 2 var

If random 1
item found (but only if player is in map 22)

If random 2
No item found
Yes, you can. Do something like that:
1652897953281.png
const shovel = $dataWeapons[ID] or $dataArmors[ID]
const playerHasShovel = $gameParty.leader().isEquipped(shovel)
const isValidRegion = $gamePlayer.regionId() === 1
const canUseShovel = playerHasShovel && isValidRegion

$gameSwitches.setValue(30, canUseShovel)

shovel - If the shovel is a weapon, use the $dataWeapons[ID]. Otherwise, use the $dataArmors[ID]. Replace ID with the ID of the Shovel.

isValidRegion - will check if the player is in the right region. Replace 1 with the region id you assigned for the Shovel areas.

So, in this script, we check if the player has the shovel equipped and also if it is in the right region. And we assigned the result of this condition on switch ID 30(which you can replace with any id you want).

So if this Switch is true, we can check if the player is hitting a specific button. In that example, I used the "OK" which can be: Z, Space, Enter.

But you can assign other buttons too:
1652895636141.png

If you don't want to use any of the default buttons and don't mind using a plugin, I guess you can use my Button Common Events plugin that let you use any keyboard key to call a common event.

So in that case you will don't need to check for a Button Press, since the plugin will be doing that.
Only need to check if the player is on region ID and if it has the Shovel Item.

My core plugin

Button Common Events
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
isValidRegion - will check if the player is in the right region. Replace 1 with the region id you assigned for the Shovel areas.

At the moment the way my common event is set up, is to look at another common event that checks the Region ID of the player before proceeding with the Common Event. So does this mean isValidRegion is not necessary then? Because with the way I have it set up, I could choose whatever region ID I wanted.

With a Conditional branch checking if Region ID = x
Then with a message saying yes can dig
and an else with a message saying cannot dig

◆Common Event:Region ID
◆If:Player Region ID = 1
◆Show Animation:Player, Dig test
◆Text:None, Window, Bottom
: :You can dig here

:Else
◆Text:None, Window, Bottom
: :You cannot dig here

:End

At the moment I an unsure as to why a Switch is also needed?

Thanks btw. :)









Edit1: Would the new script look like this?

◆Common Event:Region ID
◆Script:const shovel = $dataWeapons[6]
: :const playerHasShovel = $gameParty.leader().isEquipped(shovel)
◆If:Player Region ID = 10
◆If:Button [OK] is pressed down
◆Text:None, Window, Bottom
: :You can dig here

:End

:Else
◆Text:None, Window, Bottom
: :You cannot dig here

:End
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
Bump. (Would that script work?)
Thanks fo reading.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,836
Reaction score
2,173
First Language
Portuguese - Br
Primarily Uses
RMMZ
Bump. (Would that script work?)
Thanks fo reading.
Ops, sorry about the late answer.
Yes, I believe it will work. But you need to put the "playerHasShovel " into a condition check too.
The main logic, as I can see, is:
  • check button press
    • call common event
    • check for shovel equipment
    • check region id
      • do the shovel event
The order of the condition check I don't think matters. It only matters that all the conditions are true.
If you want to check it on another common event, is fine. But the conditions must be true.
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
Ops, sorry about the late answer.
Yes, I believe it will work. But you need to put the "playerHasShovel " into a condition check too.
The main logic, as I can see, is:
  • check button press
    • call common event
    • check for shovel equipment
    • check region id
      • do the shovel event
The order of the condition check I don't think matters. It only matters that all the conditions are true.
If you want to check it on another common event, is fine. But the conditions must be true.
No need to apologize. ^^; I really appreciate the help.

So it would look like this now?

◆Common Event:Region ID
◆Script:const shovel = $dataWeapons[6]
: :const playerHasShovel = $gameParty.leader().isEquipped(shovel)
◆If:Script:playerHasShovel = $gameParty.leader().isEquipped(shovel)
◆If:Player Region ID = 10
◆If:Button [OK] is pressed down
◆Text:None, Window, Bottom
: :You can dig here

:End

:Else
◆Text:None, Window, Bottom
: :You cannot dig here

:End

:End
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,836
Reaction score
2,173
First Language
Portuguese - Br
Primarily Uses
RMMZ
No, you did not understand the first post. Take a look at this:
es, you can. Do something like that:
1652897953281.png
I'm assigning all the conditions(except the button press), to a single switch.
Then I'm checking the value of that switch and after the button is pressed.

If you want to apply the condition check for the region ID, you just need to remove the "isValidRegion" from the script and add another conditional branch to check for the region id.

If you don't want that approach, you can just attach the scripts on the conditional branches:
$gameParty.leader().isEquipped($dataWeapons[ID]) - This will check for the shovel.
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
Alright. What I don't understand is what the Switch is for? I was hoping that when the shovel is equipped a common event is called which checks for the players current Region ID and then if does equal x, then the event goes on.

Edit:

◆Common Event:Region ID
◆If:Script:$gameParty.leader().isEquipped($dataWeapons[6])
◆If:Player Region ID = x
◆If:Button [OK] is pressed down
◆Show Animation:Player, Dig
◆Text:None, Window, Bottom
: :you can dig here

:End

:Else
◆Text:None, Window, Bottom
: :You cannot dig here

:End

:End
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,836
Reaction score
2,173
First Language
Portuguese - Br
Primarily Uses
RMMZ
The explanation of the script call is on the first post I showed the script call for you:
1653186763169.png
"Player Can Use Shovel" is ON - That is the switch doing the check.

I was hoping that when the shovel is equipped a common event is called which checks for the players current Region ID and then if does equal x, then the event goes on.
Wait, there is something different here. You said in the earlier posts, that you wanted the DIG common event to play when the player presses a button. Not when he equips the item.

◆Common Event:Region ID
◆If:Script:$gameParty.leader().isEquipped($dataWeapons[6])
◆If:Player Region ID = x
◆If:Button [OK] is pressed down
◆Show Animation:Player, Dig
◆Text:None, Window, Bottom
: :you can dig here

:End

:Else
◆Text:None, Window, Bottom
: :You cannot dig here

:End

:End
But, that will work!
My method is only different because it was doing the same as you, but with only two conditional branches. Not a big deal.
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
I guess I don't understand what the Switch is for. And I apologize for the confusion, I should have reworded that. Does the Switch make the event work/start or something?

I'm missing something here. At the moment, a Switch just seems unnecessary. I was hoping the dig event would just work when I test play and hit the correct ground area.

Wait, there is something different here. You said in the earlier posts, that you wanted the DIG common event to play when the player presses a button. Not when he equips the item.

After reading this again, I understand better. Yes, I want the Dig event to work when the player has the Shovel item equipped and then presses a button.

If the Shovel was a normal Item I could call a Common Event and probably make it work.

So this is what I would like:

If player equips Shovel
If player is standing on the correct Region ID
If player presses button
Then the dig happens

The Shovel event I am making through a Common Event in my database

◆Common Event:Region ID
◆If:Script:$gameParty.leader().isEquipped($dataWeapons[6])
◆If:Player Region ID = 10
◆If:Button [OK] is pressed down
◆Show Animation:Player, Dig
◆Text:None, Window, Bottom
: :you can dig here

:End

:Else
◆Text:None, Window, Bottom
: :You cannot dig here

:End

:End


The "Common Event Region ID" does the checking for the Region ID for me already. But this set up is not working.

"Player Can Use Shovel" is ON - That is the switch doing the check.

But now that I keep re reading, I guess the Switch is the check? Without the Switch the Common Event would not work at all? Is that correct?

So then the new script that would work would be something like this?

◆Script:const shovel = $dataWeapons[6]
: :const playerHasShovel = $gameParty.leader().isEquipped(shovel)
: :const isValidRegion = $gamePlayer.regionId() === 1
: :const canUseShovel = playerHasShovel && isValidRegion
: :
: :$gameSwitches.setValue(3, canUseShovel)
◆If:canUseShovel is ON
◆If:Button [OK] is pressed down
◆Show Animation:Player, Dig
◆Text:None, Window, Bottom
: :you can dig here

:End

:End



Thanks for being patient with me and the help you have been providing. I really appreciate it.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,836
Reaction score
2,173
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi again!
But now that I keep re reading, I guess the Switch is the check? Without the Switch the Common Event would not work at all? Is that correct?

So then the new script that would work would be something like this?

◆Script:const shovel = $dataWeapons[6]
: :const playerHasShovel = $gameParty.leader().isEquipped(shovel)
: :const isValidRegion = $gamePlayer.regionId() === 1
: :const canUseShovel = playerHasShovel && isValidRegion
: :
: :$gameSwitches.setValue(3, canUseShovel)
◆If:canUseShovel is ON
◆If:Button [OK] is pressed down
◆Show Animation:Player, Dig
◆Text:None, Window, Bottom
: :you can dig here

:End

:End
If you try to use the event this way above, yes, the common event will only work if the switch is there.
This one above should already work. Did you test it?
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,175
Reaction score
728
First Language
Javascript
Primarily Uses
RMMZ
If you wanna do it with just script in the conditional branch check:
1653262973922.png
1653263226971.png
1653263095146.png
 
Last edited:

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
If you try to use the event this way above, yes, the common event will only work if the switch is there.
This one above should already work. Did you test it?
I have been testing this and have not gotten it to work as of yet. Does the Switch also need to be set as a Common Event Switch? (Because then that asks for Parallel Process or AutoRun and I'd prefer not that...)

If you wanna do it with just script in the conditional branch check:
I prefer the Shovel as a weapon.

me Video - What that looks like
Looks awesome! I see you have MZ though. I figure it won't make much of a difference however when it comes to MV.
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,175
Reaction score
728
First Language
Javascript
Primarily Uses
RMMZ
I have been testing this and have not gotten it to work as of yet. Does the Switch also need to be set as a Common Event Switch? (Because then that asks for Parallel Process or AutoRun and I'd prefer not that...)


I prefer the Shovel as a weapon.


Looks awesome! I see you have MZ though. I figure it won't make much of a difference however when it comes to MV.
Yep pretty much will be the same thing :cutesmile:

1653275325127.png
One big difference though is MV doesn't have a "button triggered" instead it has "button held down" so if you want the triggered instead of it constantly repeating while the button is held down.
Instead use the following script call
JavaScript:
Input.isTriggered('ok')
 

Sakurra

I want a brownie.
Veteran
Joined
Sep 1, 2015
Messages
743
Reaction score
633
First Language
English
Primarily Uses
RMMV
Is there a way to call this Common Event so there isn't a parallel process or AutoRun when the conditions are met?

I've set up a script in the folder before. Or would that not be a good idea?

I'm wondering now if I can just make an item that calls the event using choice question "Equip or Unequip" using variables for checks if equipped or not. The idea just came to me, I'll have to further think it out...
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
1,175
Reaction score
728
First Language
Javascript
Primarily Uses
RMMZ
Is there a way to call this Common Event so there isn't a parallel process or AutoRun when the conditions are met?

I've set up a script in the folder before. Or would that not be a good idea?

I'm wondering now if I can just make an item that calls the event using choice question "Equip or Unequip" using variables for checks if equipped or not. The idea just came to me, I'll have to further think it out...
Yep :cutesmile::thumbsup-right:
Use this:

Like this:
1653337575174.png
...or like this script below if you don't want to let it trigger while interacting with other events:
1653338432674.png
1653337491169.png
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

NUMINA Part 1 is finally out ✨ Get it now with a 10% launch discount!
Made this simple Training Dummy :D

obraz_2022-07-01_095700524.png
I'm still undecided weather or not I should add minor swearing to my game. Like I'm going for an all ages demographic... but the idea of a cartoon character saying dammit, hell, or crap in normal conversation is really funny to me.
If we assume an Elf's strong suit is Dexterity (AGI) & Intellect (MAT), I imagine Strength (ATK) & Constitution (DEF) would be among their lowest stats. But I'm having a hard deciding which should be lower, Strength or Constitution?
I'm really sorry to have to do this, but I'm going to have to start blocking those who repeatedly put up sexual content and offer absolutely nothing (that I've seen) related to what this community is supposedly created for.
Don't take it personal. I'm a rape victim with permanent injuries who can never enjoy 'it' ever again, so it's the last thing I want to have put in my face. :(

Forum statistics

Threads
123,216
Messages
1,154,986
Members
161,599
Latest member
Yochar
Top