Feature: Change Opacity
This script provides a “change opacity” feature to your feature objects. When the feature is applied, the opacity of a sprite is changed.
Download
Script: download here
Required: Feature Manager
Installation
- Open the script editor
- Place this script below Feature Manager and above Main
Usage
Note-tag feature objects with
<feature: change_opacity> formula: YOUR_FORMULA </feature>
where YOUR_FORMULA evaluates to an integer.
If the opacity is, then the sprite is invisible, while 255 is fully opaque.
The following variables are available for your formula
a - the current subject opc - the subject's current opacity
Note that you cannot have spaces in your formula if your are using the simple note-tag
Examples
Straight numbers
<feature: change_opacity> formula: 128 </feature>
Base it as a fraction of the subject’s HP
<feature: change_opacity> formula: a.hp / a.mhp.to_f </feature>
Use the current opacity value
<feature: change_opacity> formula: opc - 1 </feature>
Is it possible to apply this on enemies with script calls? For example, using this in a common event to replicate the blink that enemies perform when they take damage?
Unfortunately, this script was designed to work with features only, such as being applied by a state.
Me: starts testing my game
Game: "Warning: 'change_opacity' feature requires version 2.00 of this script"
What's out of date on my end?
That usually means there's a newer version of Feature Manager, and it may require some things that are only available in the new version.
Just grab the latest one and see if the warning goes away.
i was wondering, does this work with states?
Yes. It works with all database objects.