Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.
Original Source
- Original title: ozu_Self – No-Frills Self-Variables
- Original author: ozubon
- Original date: May 3, 2020
- Source thread: https://forums.rpgmakerweb.com/threads/ozu_self-no-frills-self-variables.121053/
- Source forum path: Game Development Engines > RPG Maker Javascript Plugins > JS Plugin Releases (RMMV)
Summary
ozu_Self 1.0 by ozubon Introduction This is a self-variable or event variable plugin using mere 13 lines of code. Self-variables are saved with the game save, and persist through maps.
Archived First Post
ozu_Self 1.0
by ozubon
Introduction
This is a self-variable or event variable plugin using mere 13 lines of code. Self-variables are saved with the game save, and persist through maps.
Self-variables? What?
Instead of using game variables for every event you can give the event its own variables. All those times you make new game variables for single events and your game variables list gets longer and... bloated..er... This, like other self-variable plugins seeks to address that. When you think about it, why shouldn't events have their own variables?
How to use
Terms of use
You don't have to credit me but I'd appreciate it!
For commercial use, you gotta credit me!
Plugin
https://raw.githubusercontent.com/ozubon/tidbits/master/ozu_Self.js
Right-click link -> Save As
Credit
ozubon
by ozubon
Introduction
This is a self-variable or event variable plugin using mere 13 lines of code. Self-variables are saved with the game save, and persist through maps.
Self-variables? What?
Instead of using game variables for every event you can give the event its own variables. All those times you make new game variables for single events and your game variables list gets longer and... bloated..er... This, like other self-variable plugins seeks to address that. When you think about it, why shouldn't events have their own variables?
How to use
Code:
* ===========================================================================
* Self-variables
* ===========================================================================
* A self-variable looks like this:
*
* self(this)[Variable id]
*
* Now that you know that, all you have to do is come up with a variable id
* and set it to something!
*
* Let's say you want to set self-variable 1 to 9001
* Put this in a script call:
*
* self(this)[1] = 9001
*
* Bonus:
* You can have variable id's with names instead of numbers, but they gotta
* be in quotation!
*
* self(this)["garlic cloves"] = 10
*
* ===========================================================================
* Conditional branch
* ===========================================================================
* This uses standard javascript operators, but don't panic, it's easy!
*
* To check if self-variable 1 is indeed 9001, put this into the conditional
* branch script box:
*
* self(this)[1] == 9001
*
* Don't use one lonely equal sign, one means set; two means compare!
*
* Here's some other operators:
*
* Greater than: > Less than: <
* Greater than or equal to: >= Less than or equal to: <=
* Not equal to: != Equal and equal type: ===
*
* This will return true because garlic cloves is more than 9:
*
* self(this)["garlic cloves"] > 9
*
* ===========================================================================
* Math
* ===========================================================================
* These are the assignment operators:
*
* Set: = Mod: %=
* Add: += Subtract: -=
* Multiply: *= Divide: /=
*
* So, to add 3 to garlic cloves you do this:
*
* self(this)["garlic cloves"] += 3
*
* Given that garlic cloves was 10, it is now 13!
*
* Bonus: MV's own modulo always return positive, if you want ot use it
* it's a little extra finger work (or whatever you type with):
*
* self(this)["garlic cloves"] = self(this)["garlic cloves"].mod(5)
*
* ===========================================================================
* Other events' variables
* ===========================================================================
* To access other events' variables all you have to do is replace "this" with
* the id of the event. Let's say you want to set event 2's variable 3 to 4:
*
* self(2)[3] = 4
*
* Or check in a conditional branch if it is 4:
*
* self(2)[3] == 4
*
* ===========================================================================
* Events on other maps
* ===========================================================================
* You can also access variables on events on other maps, to do that you
* specify the map id after the event id:
*
* self(Event id, Map id)[Variable id]
*
* Let's say you want to set event 8 on map 7's potato variable to 6:
*
* self(8, 7)["potato"] = 6
*
* Or check in a conditional branch if it is 6:
*
* self(8, 7)["potato"] == 6
*
* ===========================================================================
* Setting game variables to event variables
* ===========================================================================
* Simply, set a game variable using Control Variables with script operand:
*
* self(this)[Variable id]
*
* Some examples:
*
* self(this)[40]
* self(3)["pebbles"]
* self(1, 2)["quarks"]
*
Terms of use
You don't have to credit me but I'd appreciate it!
For commercial use, you gotta credit me!
Plugin
https://raw.githubusercontent.com/ozubon/tidbits/master/ozu_Self.js
Right-click link -> Save As
Credit
ozubon
Downloads / Referenced Files
Log in to download
Log in, then follow the RPG Maker Developers Group to see these download links.
Log in to downloadLicense / Terms Note
Terms of use You don't have to credit me but I'd appreciate it! For commercial use, you gotta credit me! Plugin
Creator Claims / Removal
If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.
Replies (0)
No replies yet.
0
replies
1
view
Topic Summary
Loading summary...