[DYNRPG] AUTO SWITCHES

Automatic Switch management based on map, event & page #

========================================================================
Auto Switches v2.0
For RPG Maker 2003 with DynRPG v0.20 or higher
By PepsiOtaku
========================================================================

This plugin allows for auto-switches by event # & page #, meaning you can add things like chests &
searchable pots without using precious switches. Additionally, if you wanted to give something
different search states (searched more than once) you can just add more pages.

These are stored in your SaveXX.dyn files and require no additional setup.

Custom variable importing/exporting has been removed in this version, but I might add it back in some way in a later release.


Installation

To install the plugin, make sure that you have patched your project with cherry's DynRPG patch which
can be found here: http://cherrytree.at/dynrpg

1. Copy the "auto_swithes_vars.dll" into the DynPlugins folder of your own project.

2. Add the following (between the asterisks) to your DynRPG.ini
**********************************************

[auto_switches_vars]
MasterSwitch=4041
**********************************************

3. "MasterSwitch" will be the Switch ID that is set to yes/no based on the saved state of the event/page.


Commands

Supports two commands, documented below:

@export_event_state p1
- Exports the state based on the map ID, event & page #
p1: If set to "0" then, the master switch will be set to OFF (resetting that event)

@import_event_state
- Checks the state of the map ID, event & page # and passes it to "MasterSwitch"
-If it doesn't exist yet, the master switch is turned OFF
-If it does exist, the master switch is turned ON


Instructions

To use @import_event_state and @export_event state, create an event on a map of your choice & add the following:

(This is just a simple example)
<>Comment: @import_event_state

<>Branch if Switch [XXXX:DynRPG-AutoSwMaster] is OFF
<>Call Event: RandomLoot --- Common event that gives random loot
<>Comment: @export_event_state
<>
: Else Handler
<>Call Event: SeenAlready --- Common event for when a chest has already been seen.
<>
: End



You can potentially add this same code on multiple pages, and the plugin will make/get a different state for every page based on whatever other page conditions you set.

See the included test project for in-game examples!

Details

  • 754.3 KB
  • 197
  • 03/10/2024 02:19 PM

Actions

Posts

Pages: first 12 next last
I've found a way to make my system of destroy brushes and control the reset events for my Lufia using this plugin,
basically

The brush without graphic, parallel process and as hero.
@import_event_state
Conditions: Switch 001: OFF
Change event graphic: Show brush graphic
---all the brush code---
@export_event_state
Stop event process
Exception
Move event: this event, fixed direction, start route
Delete event

And when I exit the dungeon and I want that re-appear all the brushes
only use @delete_aswitch_file (XX=ID of map) before the teleport

thanks dude
For some odd reason this plug-in *REALLY* slows my game down - I get a lot of lag whenever I'm using a large amount of pictures.

Too bad - the ability to store variable info outside of the game would be extremely useful.
Odd. It's probably an issue with your pictures. Do you have "Show Picture" commands in parallel process events? That's a huge cause of lag.
I have a few - what about the Move Picture command? Does that cause issues with parallel process events too?
No. Just Show picture, because it is loading a picture into memory. If you put that in a parallel process event, it's loading that picture into memory every frame (60-80 times per second I believe). Try loading all of the pictures first, then turn on a switch that enables the parallel process event. In that event, just stick to move picture commands.
How exactly do I turn off specific autoswtiches?
Ok. I'll explain what I'm working on now.

I'm trying different methods to show a picture like "Talk" or "Push" above Link when he stands next to a certain event. So if Link triggers that event it turns on the self switch and shows the picture. When Link walks away, the self switch is turned off and the picture is erased.

Don't tell me how simple it is to use a normal switch, I'd like to be able to generally use the self switches like that. The way I understand your explanation of the delete function, you can only completely wipe all values for all self switches in a file linked to a certain save file.
I honestly think that could be better accomplished with calling a common event or two. Why do you need auto-switches for that?

My main use for this plugin was for stuff like chests, pots, barrels, and shrubs. Things that need to be tracked in some way, but don't deserve a switch for each one.

This plugin should have a way to turn an individual switch off though. I'll fix that.
author=PepsiOtaku
I honestly think that could be better accomplished with calling a common event or two. Why do you need auto-switches for that?

My main use for this plugin was for stuff like chests, pots, barrels, and shrubs. Things that need to be tracked in some way, but don't deserve a switch for each one.

This plugin should have a way to turn an individual switch off though. I'll fix that.

For that specific example, there would be many ways of doing it. I even mentioned that I don't want to know about other ways to do it. The point of my post was to see about being able to use auto switches in that manner for any kind of system I might want to create. Having control of each one would be one more tool to work with. I didn't need help making that thing I posted about work, that's just what I was trying to do when I realized that I couldn't turn off a single self switch.

Even if I wanted to do it for shrubs and pots, how would I make it so that they respawn when leaving the dungeon/area?

And when I exit the dungeon and I want that re-appear all the brushes
only use @delete_aswitch_file (XX=ID of map) before the teleport

gadesx says he does this, but your help file doesn't show it having any parameters. What exactly can that delete command do?
@delete_aswitch_file deletes the switch file for the save specified in the DeleteFileVar variable. It would basically reset all of the switches for that save.
So then gadesx is probably deleting all self switches? If he has some for treasure and some for bushes, he's really reseting both chests and bushes? Not just bushes?

So do you figure you can add more delete commands soon? Should I prepare my game for that? Deleting a single switch, all switches related to an event, all switches related to a map; would all be welcome commands.
Yeah, I don't know what gadesx was doing.

I just updated this page with the new version. All you do now is put a "0" after @export_event_state and it will turn the switch off. Everything else is the same, but you'll need DynRPG version 0.20 now.
Sweet.

author=PepsiOtaku
you'll need DynRPG version 0.20 now.

Is that different than what you linked to me recently in the main dynRPG thread? http://rpgmaker.net/forums/topics/10254/?post=524863#post524863
This looks very promising! I will have to try it out later. However, could someone easily cheat by manipulating the external auto switches that are stored upon saving the game?
Theoretically, it would be kinda easy, but the chances of someone doing that would be pretty slim. They would have to know to open that file with notepad, and they'd be in for a surprise after that, because they would have to know the map id, followed by the event id in order to change it. I suppose they could just delete the file also, but they would just be screwing themselves over, really, by breaking their own savegame.

I'd call it a conscious oversight. I don't really have the know-how required to encrypt that kind of information and pass it back and forth from the file to RPG Maker.

This plugin kind of does something similar, but it would be a lot harder for someone unfamiliar with DynRPG to figure out.
I rewrote this plugin last night to take advantage of DynRPG's onSaveGame and onLoadGame extensions instead of using the ini method. Data saves to the ".dyn" files now. This actually saves a ton of headaches that managing the previous format was like. It also cuts down on a ton of code, and it's probably a lot more efficient. I'll post the update later today.
How could I make a chest stay open after moving across different maps? Is that possible with this plug-in?
Yeah. You would have to call a common event or something as soon as you enter the map that does all the check & graphics changes. You could also just use a regular switch.

In my game, I use this plugin for searchable barrels and pots that don't require graphics changes, and then regular switches for chests, since I need a way of tracking those and give them different graphic states.
Pages: first 12 next last