sinuspinus

Warper
Member
Joined
Apr 16, 2021
Messages
3
Reaction score
0
First Language
German
Primarily Uses
RMMZ
Hello Dear Community!

I wanted to create a Farm-Bot, this Event is collecting for its own Items oder Variables.

To get an Idea :
The Player can purchase a Farm-Bot wich is collecting items, the Player can travel and do other Stuff, and after some Time the Player can collect the gathered items from the bot and sell it.

How do i programm the Part, that i can speak to the Bot while he is still collecting and stop collecting to speak with the Player. After some Chat, he continue his work. I found it very difficult to find a Solution to interact to a Parallel process.

I would be very Happy if somebody could help me with that.


Thank you!
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
527
Reaction score
500
First Language
german
Primarily Uses
RMMZ
Hmm, we definitely need more information about this. How detailed should that feature look like? As you refer "Bot" you maybe want to set up an A.I.? Then you should look in another forum about it, it's a whole different subject than RPGs.

But I don't think you need a bot or an A.I. You can start using simple Common Events, parallel processes, and then improve your eventing. For some inspiration: You can google how to get the current Playtime. When the Player orders the Bot to go farming, you save the playtime in some variable. When the Player asks the Bot if it has completed its task, you can check how much time passed since your saved playtime, and then response with "yes" or "no".
 

sinuspinus

Warper
Member
Joined
Apr 16, 2021
Messages
3
Reaction score
0
First Language
German
Primarily Uses
RMMZ
Hmm, we definitely need more information about this. How detailed should that feature look like? As you refer "Bot" you maybe want to set up an A.I.? Then you should look in another forum about it, it's a whole different subject than RPGs.

But I don't think you need a bot or an A.I. You can start using simple Common Events, parallel processes, and then improve your eventing. For some inspiration: You can google how to get the current Playtime. When the Player orders the Bot to go farming, you save the playtime in some variable. When the Player asks the Bot if it has completed its task, you can check how much time passed since your saved playtime, and then response with "yes" or "no".
Thank you for your fast reply.

What i was trying to say was :

I want an event wich is farming items, and i can iterrupt this event and collect the items the event collected till then and starts to cellect again after iterrupting it. but i dont know how to interrupt an parallel event.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
885
Reaction score
475
First Language
English
Primarily Uses
RMMV
Thank you for your fast reply.

What i was trying to say was :

I want an event wich is farming items, and i can iterrupt this event and collect the items the event collected till then and starts to cellect again after iterrupting it. but i dont know how to interrupt an parallel event.
What @Aerosys is saying, is you need to try to make your thinking a bit more abstract and less literal.

If this were the real world, then your farmer bot is out there performing the physical act of gathering the crops, and when you walk up to him you'd see how much he's done.

But this isn't the real world, there are no physical crops, so there's no reason he actually needs a process running the entire time. The only thing that matters is how long it's been since he started.

So at 2:00 you tell the bot "Go to work!"

At 2:30, you ask the bot "How much do you have?" There's no reason to have an actual parallel event running for half an hour, you just need to know it's been half an hour, and you do the math on how many crops he's gotten in that time.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
636
Reaction score
552
First Language
English
Primarily Uses
RMMV
First, find a planet covered in naturally occurring gears, levers and pulleys.

Second, wait a few million years.

7yQuQt9.jpg




... oh, not that kind of autobot?

I agree with the people saying that you should cheat on the simulation, that's what major games do as well.

How to hide your cheating depends upon how your farm is set up.

If the bot is just collecting resources in an abstract way, just have him kind of mill around using a move route

wO8wMtU.png

l517KMs.png


Put the dialogue into the bot itself.
rwW2r9U.png


For the resource collecting, it depends on what 'clock' system you're currently using for calculating off-map.

(So if you're counting steps, or doing realtime, or something else with a plugin that stores into variable 20, use that). I'd recommend against using a parallel event as a timer, but in theory you could have a parallel event add 1 to variable 20 every minute or whatever.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
885
Reaction score
475
First Language
English
Primarily Uses
RMMV
I'd recommend against using a parallel event as a timer, but in theory you could have a parallel event add 1 to variable 20 every minute or whatever.
I'm sure you know this (and you do recommend against it), but I think it's a bad idea to even mention this as a possibility, as it only works if the player stays in the same map the entire time (which is not most games) :wink:
I think it's best not to confuse the confused.
 
  • Like
Reactions: J-G

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,408
Reaction score
1,817
First Language
EN
Primarily Uses
RMMZ
For your original idea, you just need 2 separate events with different triggers, e.g. 1 Parallel (timed loop, preferably a Common Event so it affects all maps) and 1 Action Button (NPC). There's nothing wrong with that approach, but using a Parallel event here is an unnecessary use of CPU, since you only need to know how much time has passed when the player talks to the NPC.

So instead, like Aerosys said, just use a single, Action Button NPC event and compare the current time with the previous time (if any) when the player talks to them. You can store the time value in a variable for this purpose. How to get the current time depends on how you want to measure time in your game. A couple of options:
  1. In-game time - frames since New Game:
    • Control Variables > Game Data > Play Time

  2. Real time - measure using system clock:
    • Control Variables > Script: Date.now() / 1000
    (I've divided by 1000 here to convert from milliseconds to seconds.)
You can then use variables to store and compare time values whenever you interact with the event. You might find this old post helpful:
Yes, using a little scripting! Here's an example (source):
Code:
◆If:Self Switch A is OFF
  ◆Control Variables:#0001 timestamp = Math.floor(Date.now()/1000)
  ◆Control Self Switch:A = ON
  ◆Text:None, Window, Bottom
  :    :Come back in 10 seconds!
  ◆
:Else
  ◆Control Variables:#0002 check = Math.floor(Date.now()/1000)
  ◆Control Variables:#0002 check -= timestamp
  ◆If:check ≥ 10
    ◆Text:None, Window, Bottom
    :    :Such patience, much wow.
    ◆Control Self Switch:A = OFF
    ◆
  :Else
    ◆Text:None, Window, Bottom
    :    :I SAID WAIT!
    ◆
  :End
  ◆
:End
Here I've assigned a time value to a variable using Control Variables > Script:
Code:
Math.floor(Date.now() / 1000)
Date.now() gets the milliseconds since midnight on 1 Jan 1970. More details here: the Date object (MDN). Basically it simply stores the start time, then takes the difference between current and stored times to decide whether enough time has elapsed yet. :kaopride:
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
636
Reaction score
552
First Language
English
Primarily Uses
RMMV
Note that with real time you have to have something in place to handle savegames, which may or may not be what you want.
 

sinuspinus

Warper
Member
Joined
Apr 16, 2021
Messages
3
Reaction score
0
First Language
German
Primarily Uses
RMMZ
i found a quite simple Solution to this.

1. Event : Is adding +1 to a Variable after Wait(60) as a Parallel Event.
2.Event : (The Autobot) : is giving the amount of Variable in gold/Item and reseting the variable to Zero

The Problem is, that it works only if the Player is on the Map.
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
527
Reaction score
500
First Language
german
Primarily Uses
RMMZ
Sounds like a neat solution, you just need to change some things:

When Event 1 is a Common Event (in the Database), then it should run on any Map.
Alternatively, you should do something like we already recommended. Save the current Playtime, and when you interact with the drone again, just calculate the difference. It should be much more convenient and precise.

Sorry I don't know the command to get the current Playtime, but I think you will find it when googling for some minutes.
 

Latest Threads

Latest Posts

Latest Profile Posts

Just spent $174 on Shining the Holy Ark on the Saturn. Good lord.
My brain when designing quests:
There is piano, it needs help --> The organ (yes organ now) is missing a component! --> Where the heck am I supposed to put this missing piece!??! --> Add an entire new mini dungeon specifically created to house this new piece. --> Connect this brand new mini dungeon to an already designed dungeon with background information about the town it's found it.

Me: :LZYhuh:
Rising of the Shield Hero!
Sheesh, Guys, don't think you can throw easy prices like $25/$50 on potions/ethers then have monsters pay you $75 for killing them (never understood that concept btw lol) and think it'll all work out!!! Just realized my prcies vs payout left my players unable to get decent stuff without some serious farming from the start, i'm about to call H&R Block to help my MC get his stimulus check just to buy new armor :LZSlol:

Forum statistics

Threads
111,095
Messages
1,058,218
Members
144,290
Latest member
Blizzie
Top