Skip to content

Commit

Permalink
Erase Event - Erase Event By ID + Recreate Event Option (Maniacs Feat…
Browse files Browse the repository at this point in the history
…ure)

Another smaller update:
Events can be disabled and enabled again through maniacs patch.
It also allows targeting event by ID instead of only erasing the caller itself.

```js
//TPC SYNTAX

@ev[2].erase
@wait .input
v[1] = 2
@ev[ v[1] ].return
```
  • Loading branch information
jetrotal committed Dec 18, 2024
1 parent 6a45364 commit e56b7a1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3850,11 +3850,21 @@ bool Game_Interpreter::CommandEndLoop(lcf::rpg::EventCommand const& com) { // co
return true;
}

bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& /* com */) { // code 12320
bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& com) { // code 12320
int event_id = 0; // default rm values
bool is_active = 0; // In Vanilla RM event is always itself and it always becomes inactive

if (Player::IsPatchManiac()) {
event_id = ValueOrVariableBitfield(com.parameters[0], 1, com.parameters[2]);
is_active = com.parameters[1];
}

auto& frame = GetFrame();
auto& index = frame.current_command;

auto event_id = GetThisEventId();
if (event_id == 0) {
event_id = GetThisEventId();
}

// When a common event and not RPG2k3E engine ignore the call, otherwise
// operate on last map_event
Expand All @@ -3863,7 +3873,7 @@ bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& /* com */

Game_Event* evnt = Game_Map::GetEvent(event_id);
if (evnt) {
evnt->SetActive(false);
evnt->SetActive(is_active);

// Parallel map events shall stop immediately
if (!main_flag) {
Expand Down

0 comments on commit e56b7a1

Please sign in to comment.