Skip to content

Commit e56b7a1

Browse files
committed
Erase Event - Erase Event By ID + Recreate Event Option (Maniacs Feature)
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 ```
1 parent 6a45364 commit e56b7a1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/game_interpreter.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3850,11 +3850,21 @@ bool Game_Interpreter::CommandEndLoop(lcf::rpg::EventCommand const& com) { // co
38503850
return true;
38513851
}
38523852

3853-
bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& /* com */) { // code 12320
3853+
bool Game_Interpreter::CommandEraseEvent(lcf::rpg::EventCommand const& com) { // code 12320
3854+
int event_id = 0; // default rm values
3855+
bool is_active = 0; // In Vanilla RM event is always itself and it always becomes inactive
3856+
3857+
if (Player::IsPatchManiac()) {
3858+
event_id = ValueOrVariableBitfield(com.parameters[0], 1, com.parameters[2]);
3859+
is_active = com.parameters[1];
3860+
}
3861+
38543862
auto& frame = GetFrame();
38553863
auto& index = frame.current_command;
38563864

3857-
auto event_id = GetThisEventId();
3865+
if (event_id == 0) {
3866+
event_id = GetThisEventId();
3867+
}
38583868

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

38643874
Game_Event* evnt = Game_Map::GetEvent(event_id);
38653875
if (evnt) {
3866-
evnt->SetActive(false);
3876+
evnt->SetActive(is_active);
38673877

38683878
// Parallel map events shall stop immediately
38693879
if (!main_flag) {

0 commit comments

Comments
 (0)