戦闘システムにフォグを提供 – CS_FogOfWar.js

タイトル
This plugin provides a complete fog of war system.
作者名
ヘルプ
============================================================================
Latest Version
============================================================================

Get the latest version of this script on
https://github.com/cityshrimp/rmmv_fow/blob/master/CS_FogOfWar.js

=============================================================================
パラメータ
param Enabled
desc Enable fog by default in any map.
default false

param Fog Opacity
desc Default opacity of the fog sprites, between 0 to 1
default 0.6

param Fade Speed
desc Amount of opacity that changes with each update, between 0 to 1
default 0.1

param Map Hidden
desc Whether the map is hidden and needs to be discovered. If set to true, then map starts out blacked out (think Starcraft)
default false

param Gradient Vision
desc Vision is gradient (as opposed to completely clear)
default false

param Strict Diagonals
desc If diagonals can be seen more easily or not. For example, with Strict Diagonals enabled, if a player has blocked vision on top and to the right, then the top-right tile is not visible. The top-right tile will be visible if Strict Diagonals is disabled.
default false

param Player Vision
desc Player has vision. Can be toggled with plugin command.
default true

param Player Vision Range
desc Player's vision range. Can be modified with plugin command.
default 3

param Player Vision Type
desc Default vision type for Player. 1 - Diamond, 2 - Square, 3 - Circle, 4 - Directional (does not work with 8 or 16 directional movement)
default 1

param Player Flying Vision
desc Whether Player has unobstructed vision or not.
default false

param Player Vision Brightness
desc Default brightness of the player's vision on fog, between 0 to 1.
default 1

param Origin Vision Range
desc This is the default vision range for origin events.
default 3

param Origin Vision Type
desc Default vision type for origin events (except Player). 1 - Diamond, 2 - Square, 3 - Circle, 4 - Directional (does not work with 8 or 16 directional movement)
default 1

param Origin Flying Vision
desc Whether origin events will have unobstructed vision by default or not
default false

param Origin Vision Brightness
desc Default brightness of the origin events' vision on fog, between 0 to 1.
default 1

param Forest RegionId
desc RegionId for forest tiles
default 1

param Hill RegionId
desc RegionId for hill tiles. Origins on Hills can see through everything but Mountain and Blocker tiles
default 2

param Mountain / Wall RegionId
desc RegionId for mountain / wall tiles
default 3

param Blocker RegionId
desc RegionId for blocker tiles (cannot see through or reveal unless origin is flying)
default 4

param Dark RegionId
desc RegionId for dark tiles (can see through, but never revealed)
default 5

param Watchtower RegionId
desc RegionId for watchtower tiles. Origins on Hills can see through everything but Mountain and Blocker tiles
default 6

param Watchtower Modifier
desc Vision range modifier for watchtower tiles. It will increase the origin's range by n
default 1

===Map Notetag===

<fow_enabled>
desc: Eanbles fog of war for this map

<fow_opacity: (value)>
desc: Sets the fog sprite opacity for this map. (value): between 0 to 1

<fow_map_hidden>
desc: Eanbles hidden map fog of war

<fow_gradient_vision>
desc: Eanbles gradient vision

<fow_strict_diagonals>
desc: Eanbles strict diagonals visibility detection

<fow_origin_range: (value)>
desc: Origin events' vision range for this map

<fow_origin_type: (value)>
desc: Sets the fog type for this map. (value): 1 - Diamond, 2 - Square, 3 - Circle, 4 - Directional

<fow_flying_origins>
desc: Origins will have unobstructed vision.

<fow_origin_brightness: (value)>
desc: Origin events' vision brigthness for this map. (value): between 0 to 1

<fow_player_vision>
desc: Player has vision for this map

<fow_player_range: (value)>
desc: Player's vision range for this map

<fow_player_type: (value)>
desc: Player's vision type for this map

<fow_player_flying>
desc: Player has flying vision for this map

<fow_player_brightness: (value)>
desc: Player's vision brigthness for this map

===Event Notetag / Comment===
Note: Comments have precedence over Notetags.

<fow_origin>
desc: Event will be able to reveal fog. (range) is the vision range of the event.

<fow_origin_range: (integer)>
desc: Set the origin event's vision range.

<fow_origin_type: (integer)>
desc: Set the origin event's vision type.

<fow_origin_flying: (bool)>
desc: Set the origin's flying (unobstructed vision) attribute

<fow_origin_brightness: (value)>
desc: Set the origin event's brightness. (value): between 0 to 1

<fow_target>
desc: Event will be hidden unless on a revealed tile.

<fow_blocker: (type)>
desc: Event will block vision. 1 - Can see through on elevated terrain (hill), 2 - Can reveal, but not see through (mountain), 0 - not blocker

===Plugin Commands===

cs_fow enable
desc: Enable fog of war. Does not persist if map changes.

cs_fow disable
desc: Disable fog of war. Note: does not reveal target events hidden by fog. Does not persist if map changes.

cs_fow enable_player
desc: Enable player vision.

cs_fow disable_player
desc: if put in the map note tags then scrolling will be back to normal instead of grid scrolling.

cs_fow set_player_range <integer>
desc: Set the player's vision range. Does not persist if map changes.

cs_fow set_player_type <event id> <type>
desc: Set the player's vision type. Does not persist if map changes.

cs_fow set_player_flying <bool>
desc: Set the player's flying (unobstructed vision) attribute. Does not persist if map changes.

cs_fow add_origin <event id>
desc: Event will be able to reveal fog. Does not persist if map changes.

cs_fow set_origin_range <event id> <integer>
desc: Set the origin's vision range. Does not persist if map changes.

cs_fow set_origin_type <event id> <integer>
desc: Set the origin's vision type. Does not persist if map changes.

cs_fow set_origin_flying <event id> <bool>
desc: Set the origin's flying (unobstructed vision) attribute. Does not persist if map changes.

cs_fow set_origin_brightness <event id> <value>
desc: Set the origin's brightness, value: between 0 to 1. Does not persist if map changes.

cs_fow remove_origin <event id>
desc: Remove event from origin list. Does not work on events with <fow_origin> notetag. Does not persist if map changes.

cs_fow remove_all_origins
desc: Removes all origins, excluding player and events with <fow_origin> notetag. Does not persist if map changes.

cs_fow add_target <event id>
desc: Event will be hidden in fog unless tile is revealed. Does not persist if map changes.

cs_fow remove_target <event id>
desc: Remove event from target list. Does not work on events with <fow_target> notetag. Does not persist if map changes.

cs_fow remove_all_targets
desc: Remove all targets, excluding events with <fow_target> notetag. Does not persist if map changes.

cs_fow add_blocker <event id> <type>
desc: Event will block vision. Does not persist if map changes. 1 - Can see through on elevated terrain (hill), 2 - Can reveal, but not see through (mountain), 0 - not blocker

cs_fow_remove_blocker <event id>
desc: Remove the event from blocker list. Does not work on events with <fow_blocker> notetag. Does not persist if map changes.

cs_fow remove_all_blockers
desc: Remove all blockers, excluding events with <fow_blocker> notetag. Does not persist if map changes.

===Limitation and Notes===
- Does not work with maps with loop
- Targets may not show/hide correctly if they are bigger than 1 tile
- Performance may become an issue if 1) too many origins, 3) heavy use of circle or directinoal vision type, or 4) origin vision is too large
- All calclulations are "tile-based". E.g., if an blocker event stands between two tiles, it will find which tile it's coordinates are on, and block vision for that tile only.
- If a tile is marked as a special region and also contains a blocker event, it will take the more restrictive of the two. Example, if there's a blocker event (type 2 - mountain) on a hill tile. It will block vision like a mountain.
- If an event initially starts had <fow_blocker> tag in comment, and then move into a page without the tag, it will continue to act as a blocker. To clear it, make sure to include <fow_blocker: 0> in the new page. This is done to preserve blockers added via plugin commands.

ライセンス表記

紹介ページ https://github.com/cityshrimp/rmmv_fow/blob/master/CS_FogOfWar.js