A downloadable game

# OtherEventAccessor (RPG Developer Bakin) — Documentation

**Translated to English by MelonToucan**

A lightweight helper plugin for **reading/writing another event’s variables**, checking another event’s **sheet condition**, and (optionally) calculating a **damage/formula result** using Bakin’s built-in battle calculation.

This plugin is used via Bakin’s event command:

✅ **Call C# Program** → select a method from this plugin

---

## What this plugin can do

### ✅ Supported (callable) features

- **Store “link definitions”** (like a reusable binding) using a setup panel method.

- **Read** another event’s **local variable** into your own variable.

- **Write** your variable value **into another event’s local variable**.

- **Check** whether another event’s **sheet condition** is currently true (1) or false (0).

- **Auto-link (read-only)** a value from another event (local var or sheet condition) into a **plugin variable**.

### ⚠️ Notes about “Formula Result”

This plugin includes methods to calculate a formula result by calling Bakin’s internal battle damage calculation.

However, **your project’s formula definitions come from the weapon/item **, so:

- Treat the “Formula Result” methods as **advanced / project-dependent**.

- If your formula name is not found or your characters aren’t battle-enabled, the result becomes `0` (or “Miss”).

You can still use this feature if your current attacker has a valid battle status and the formula name you pass matches what Bakin can resolve from your setup.

---

## Requirements / Setup

1. Put `OtherEventAccessor.cs` in your Bakin project’s **script** folder.

2. Attach this plugin to an event (any event that will use it).

3. Make sure your target events have:

   - A matching **Event Name** (string),

   - The **local variable name** you want to read/write,

   - Or a sheet with the **sheet name** you want to test.

---

## Core Concept: “Setup Panels” (Declarations)

You don’t directly pass event names/variable names into the action methods.

Instead, you **declare** a “link setup” using a setup panel method:

### Manual Link Setup

Stores:

- **X** = your unique ID (like 10, 20, 30…)

- **Y** = variable containing the **target event name**

- **Z** = variable containing the **target local variable name / sheet name / formula name**

- **Result Variable** = where fetched results go (or the outgoing value comes from)

Then you call an “Action” method using **that same X**.

✅ Recommended workflow:

- Create a “SETUP” sheet at the bottom of the event that is **never triggered normally**

- Put all `ManualLinkSetup` / `AutoLinkSetup` calls there

---

## How to Call Plugin Methods in Bakin

Use Bakin event command:

**Call C# Program**

Then select a method such as:

- `OtherEventAccessor.ManualLinkSetup`

- `OtherEventAccessor.GetTargetVariable`

- etc.

---

# Method Reference (ONLY methods that are actually usable)

## 1) Setup Methods

### `ManualLinkSetup(Vector3 info)`  *(Setup Group)*

Creates a reusable link definition.

**Call C# Program → OtherEventAccessor.ManualLinkSetup**

**Arguments (Vector3):**

- `X` (number): Unique Setup ID (example: `10`)

- `Y` (variable): A variable containing the **target event name** (string)

- `Z` (variable): A variable containing the **target local var name / sheet name / formula name** (string)

- `Result Variable`: A variable to store results into (or provide outgoing value from)

**What it does:**  

This method mainly exists to be “found” by the plugin scanner so it can later resolve the same setup ID.

---

### `AutoLinkSetup(Vector3 info)` *(Setup Group)*

Creates a **read-only auto-updating link** into a **Plugin Variable**.

**Call C# Program → OtherEventAccessor.AutoLinkSetup**

**Arguments (Vector3):**

- `X` mode:

  - `0` = local variable auto-read

  - `1` = sheet condition auto-read

- `Y` (variable): target event name (string)

- `Z` (variable): local var name OR sheet name (string)

- `Result Variable`: becomes a **Plugin Variable** that updates automatically

⚠️ Important:

- If you assign to that result variable anywhere else, the auto-link is **broken** (it becomes a normal variable and stops updating).

---

## 2) Action Methods

### `GetTargetVariable(float x)` *(Actions Group)*

Fetches the target event’s local variable into your **Result Variable**.

**Call C# Program → OtherEventAccessor.GetTargetVariable**

- `X = Setup ID`

Result:

- `ResultVar = (TargetEvent.LocalVarName)`

If target event or local var is not found → result becomes `0`.

---

### `SetTargetVariable(float x)` *(Actions Group)*

Writes your **Result Variable’s current value** into the target event’s local variable.

**Call C# Program → OtherEventAccessor.SetTargetVariable**

- `X = Setup ID`

Effect:

- `(TargetEvent.LocalVarName) = ResultVar`

If target event isn’t found → no change.

---

### `CheckTargetSheetCondition(float x)` *(Actions Group)*

Checks if the target event’s **sheet condition** is currently met.

**Call C# Program → OtherEventAccessor.CheckTargetSheetCondition**

- `X = Setup ID`

Result:

- `ResultVar = 1` if sheet conditions are true

- `ResultVar = 0` otherwise

This works even for “never normally triggered” sheets, which is great for building custom boolean logic.

---

## 3) Formula Result Methods (Advanced / Project-dependent)

### `GetFormulaResult_SelfAsA(float x)` *(Actions Group)*

Calculates a Bakin battle result using:

- **this event** as `a`

- **target event** as `b`

**Call C# Program → OtherEventAccessor.GetFormulaResult_SelfAsA**

- `X = Setup ID`

### `GetFormulaResult_SelfAsB(float x)` *(Actions Group)*

Calculates a Bakin battle result using:

- **this event** as `b`

- **target event** as `a`

**Call C# Program → OtherEventAccessor.GetFormulaResult_SelfAsB**

- `X = Setup ID`

#### Critical toggle (important!)

In the current script logic:

- **Critical roll is only done when `x > 99`**

- If you do **not** want critical: keep the Setup ID under `100`

So you can do:

- Setup ID `10` → no critical roll

- Setup ID `110` → critical roll enabled

#### What it uses under the hood (high level)

These methods call Bakin’s:

- `battleSequenceManager.CalcAttackWithWeaponDamage(attacker, target, ...)`

So yes — it is effectively using Bakin’s built-in damage calculation logic (including weapon/item-based formula behavior in your project).

If calculation can’t run (missing battle status etc.) → returns `0`.

---

## 4) Debug Methods

### `DoesLinkSetupExist(float x)` *(Debug Group)*

Returns `true/false` if a ManualLinkSetup with ID `x` exists.

---

### `ViewLinkSetupDetails(float x)` *(Debug Group)*

Returns a debug string showing the stored contents of Setup ID `x`.

---

### `ViewAutoLinkDetails()` *(Debug Group)*

Returns a debug string for all auto-links in this event.

---

# Examples (Copy/Paste friendly)

## Example A — Read another event’s local variable (HP)

### Setup sheet (run once / never triggered normally)

1) Set:

- `N:OEA10_Event = "Enemy01"`

- `N:OEA10_Target = "HP"`

2) Call:

**Call C# Program → OtherEventAccessor.ManualLinkSetup**

- X = `10`

- Y = `N:OEA10_Event`

- Z = `N:OEA10_Target`

- Result = `N:OEA10_Result`

### When you want to fetch HP

**Call C# Program → OtherEventAccessor.GetTargetVariable**

- X = `10`

✅ Now `N:OEA10_Result` holds Enemy01’s HP.

---

## Example B — Write to another event’s local variable (STATE)

### Setup

- `N:OEA30_Event = "Enemy01"`

- `N:OEA30_Target = "STATE"`

**Call C# Program → OtherEventAccessor.ManualLinkSetup**

- X = `30`

- Y = `N:OEA30_Event`

- Z = `N:OEA30_Target`

- Result = `N:OEA30_Result`

### Write value

1) Set:

- `N:OEA30_Result = 2`

2) Call:

**Call C# Program → OtherEventAccessor.SetTargetVariable**

- X = `30`

✅ Enemy01.STATE becomes `2`.

---

## Example C — Check another event’s sheet condition

### Setup

- `N:OEA20_Event = "Enemy01"`

- `N:OEA20_Target = "CanAttack"`  *(this is a SHEET NAME)*

**Call C# Program → OtherEventAccessor.ManualLinkSetup**

- X = `20`

- Y = `N:OEA20_Event`

- Z = `N:OEA20_Target`

- Result = `N:OEA20_Result`

### Check sheet condition

**Call C# Program → OtherEventAccessor.CheckTargetSheetCondition**

- X = `20`

✅ Result:

- `N:OEA20_Result = 1` if sheet conditions are currently true

- `0` otherwise

---

## Example D — Auto-link Enemy01 HP (read-only)

### Setup (run once)

- `N:AUTO_Event = "Enemy01"`

- `N:AUTO_Target = "HP"`

**Call C# Program → OtherEventAccessor.AutoLinkSetup**

- X = `0` (local variable mode)

- Y = `N:AUTO_Event`

- Z = `N:AUTO_Target`

- Result = `N:AUTO_HP_READONLY`

✅ `N:AUTO_HP_READONLY` now updates automatically to Enemy01.HP.

⚠️ Do NOT assign to `N:AUTO_HP_READONLY` anywhere else or the auto-link breaks.

---

## Example E — Formula Result (Advanced)

### Goal

Compute a battle result using the default formula style like:

`(max(a.atk / 2.5 - b.def / 4, 0) + a.eatk * b.edef) * rand(0.9, 1)`

### Setup

- `N:OEA50_Event = "Enemy01"`

- `N:OEA50_Target = "default"` *(formula name you want to use)*

**Call C# Program → OtherEventAccessor.ManualLinkSetup**

- X = `110` *(>99 enables critical roll)*

- Y = `N:OEA50_Event`

- Z = `N:OEA50_Target`

- Result = `N:OEA50_Result`

### Run

**Call C# Program → OtherEventAccessor.GetFormulaResult_SelfAsA**

- X = `110`

✅ `N:OEA50_Result` becomes the computed damage/result.

### Notes

- The result includes Bakin’s internal variance (like `rand(0.9, 1)`) if your formula uses it.

- If your battle data isn’t valid (no battle status), result becomes `0` (or “Miss” string).

---

# How does it calculate?

When you call a Formula Result method:

1. Finds your setup by ID `X`

2. Resolves:

   - target event = **Y**

   - formula name = **Z**

3. Chooses attacker/target depending on SelfAsA vs SelfAsB

4. Calls Bakin’s built-in battle calculation:

   - `CalcAttackWithWeaponDamage(attacker, target, ...)`

So yes — **it is using the game system’s weapon/item-based damage calculation**, including the formula and random factor used in your project.

---

# Troubleshooting

### “Auto-link stopped updating”

You assigned to the result variable somewhere else.

Auto-link variables must be treated as **read-only**.

### Result always `0`

Common reasons:

- Event name mismatch (Y string must match the event’s Name)

- Local variable name mismatch (Z must match exactly)

- Sheet name mismatch

- Target event not found (dynamic events vs placed events)

- For formula: battle status / battleSequenceManager not available in that context

### Sheet check always returns `0`

Make sure the target sheet actually exists and has conditions, and that the event is on the same map scene.

---

# Credits / License

Plugin ver01  

Plugin Creator: **Tomegome**  

X (Twitter): `@tomegome_g`  

Email: `tomegomego1@gmail.com`  

Bakin ver: **2.2.0.2**

`.cs` code is free to use and modify.  

Feel free to use and modify the code in `.cs`.

RPG Developer Bakin (C) 2022-2026 SmileBoom Co., Ltd. All Rights Reserved.

**Translated to English by MelonToucan**

Published 10 days ago
StatusReleased
Authormelontoucan

Download

Download
OtherEventAccessor.zip 9.2 kB

Leave a comment

Log in with itch.io to leave a comment.