Skip to content

Conversation

@jetrotal
Copy link
Contributor

@jetrotal jetrotal commented May 7, 2024

Command that clones Events from any map inside the current map.

The syntax always comes in pairs. The first parameter of each pair indicates whether you are using a direct value or a variable/indirect variable, through ValueOrVariable().


Syntax (TPC):

@raw 2056,
     "",           // Rename the Target Event [Optional]
      0, 1,        // Source Map's ID.
      0, 2,        // Source Event's ID
      0, 3,        // Target's x coordinate
      0, 4,        // Target's y coordinate
      0, 5,        // Target's Event's ID [Optional] 
                   // 👆 if a value is defined, it will replace an existing event.

Command that clones Events from any map inside the current map.

Co-Authored-By: Primekick <thetrueaxer@gmail.com>
@Ghabry
Copy link
Member

Ghabry commented May 7, 2024

This command looks pretty straight forward and simple to review.

The only optimisation I see is that it shouldn't fetch and retranslate the map again when the map ID is the same as the active map. Maybe also consider "map 0" as the current map? (otherwise you need an additional event call to grab the ID).

And maybe a small test game would be good that spawns an event in two ways:

  • From the current map
  • From a different map

Because I have to add the Web Player Async stuff, so I have directly something for testing...

@jetrotal
Copy link
Contributor Author

jetrotal commented May 7, 2024

Ok, later tonight I'll poke around to fit map0 and mapItself cases.
Would be useful to also have a "destroy Event" command.

jetrotal added 2 commits May 7, 2024 16:22
Updates on DestroyMapEvent

You can also replace an older event with a new one with this optional parameter
@Ghabry
Copy link
Member

Ghabry commented May 8, 2024

This delete event should be a separate command.

It is also much harder than spawn because the semantics are unclear: what is supposed to happen with the interpreter execution (e.g. when having a parallel process running) of the deleted event when:

  • event deletes itself
  • event deletes other event

This must be will defined.

For spawn this is obvious: refresh everything, done. Delete has multiple ways to do it.

@jetrotal jetrotal force-pushed the Jetrotal-SpawnMapEvent branch from 977c5ad to b87cafd Compare May 8, 2024 22:42
@jetrotal
Copy link
Contributor Author

jetrotal commented May 8, 2024

Project for testing, both from map itself and outside map:
image

SpawnEventDemo.zip

@jetrotal jetrotal force-pushed the Jetrotal-SpawnMapEvent branch from b87cafd to 278e2e4 Compare May 9, 2024 15:03
@fdelapena fdelapena added Enhancement Awaiting Rebase Pull requests with conflicting files due to former merge labels Jul 2, 2024
@jetrotal jetrotal force-pushed the Jetrotal-SpawnMapEvent branch from 278e2e4 to df36ee0 Compare July 13, 2024 02:36
@jetrotal
Copy link
Contributor Author

Rebased.

@Ghabry Ghabry added Event/Interpreter EasyRPG New functionality exclusive to EasyRPG Player and removed Awaiting Rebase Pull requests with conflicting files due to former merge labels Jul 31, 2024
@Ghabry Ghabry added this to the 0.8.1 milestone Jul 31, 2024
@Ghabry
Copy link
Member

Ghabry commented Aug 1, 2024

Added async suspension to CloneMapEvent and (NEW) DestoryMapEvent. Is the same technique we already use for ManiacSave/Load implementation to prevent that inconsistent data is saved.


There is still commented out code because it will conflict with a more complex change by #3233 so I didn't wanted to touch this.


The semantics for Delete (and Overwrite) are:

When it is NOT a parallel process (= executes on the main interpreter): The deleted event will execute till the end. (this is the same as for Erase Event).

When it is a parallel process: The event execution will end immediately (even when currently inside a common event call) because the interpreter that runs it is destroyed together with the event. (this differs from Erase Event where only the lowest stack frame will end immediately and the rest will happily continue)

An overwritten event forgets about its execution state so it always continues from line 0.

@Ghabry Ghabry changed the title New Command 2056 - Spawn Map Event New Command 2056/2027 - Clone/Destroy Map Event Aug 1, 2024
@Ghabry Ghabry changed the title New Command 2056/2027 - Clone/Destroy Map Event New Command 2056/2057 - Clone/Destroy Map Event Aug 1, 2024
…t running is destroyed.

Prevents triggering the sanity check about an invalid event on the main interpreter.

Fix operator= of Game_CharacterDataStorage.
@Ghabry
Copy link
Member

Ghabry commented Aug 24, 2024

Battle animations can also contain (stale) references to events as noticed in #3255

Updating these references (or cancelling the animation when the event is deleted) must be also handled by the event command.

Prevents crashes...

Had to add multiple player includes as a header was removed.
@Ghabry
Copy link
Member

Ghabry commented Aug 26, 2024

Battle Animations are now correctly repointed (event overwritten) or cancelled (event deleted).

@fdelapena fdelapena added the Awaiting Rebase Pull requests with conflicting files due to former merge label Sep 3, 2024
@Ghabry Ghabry force-pushed the Jetrotal-SpawnMapEvent branch from 9db3950 to 4843ce2 Compare September 5, 2024 13:20
@Ghabry Ghabry removed the Awaiting Rebase Pull requests with conflicting files due to former merge label Sep 5, 2024
@Ghabry Ghabry force-pushed the Jetrotal-SpawnMapEvent branch from 4843ce2 to 85b82b7 Compare October 9, 2024 22:23
@fdelapena fdelapena merged commit 3b2cb25 into EasyRPG:master Oct 11, 2024
@jetrotal jetrotal deleted the Jetrotal-SpawnMapEvent branch November 28, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EasyRPG New functionality exclusive to EasyRPG Player Enhancement Event/Interpreter

Development

Successfully merging this pull request may close these issues.

5 participants