Avorion Wiki
Advertisement

This is a mod that shows how to add new events to the game that happen randomly. In this case, a new event is added that spawns a mysterious, large resource-rich asteroid.

About[ | ]

This event spawns a large, resource rich asteroid that despawns after 15 minutes. The event itself is also terminated after 15 minutes, so that other events only happen after this event finished.

  • eventscheduler.lua Extension to the eventscheduler.lua script, that tells the event scheduler about the event
  • mysteryasteroid.lua Core file that spawns the asteroid

mysteryasteroid.lua[ | ]

Player script that spawns the asteroid. On initialization, starts a callback that, after 15 minutes, terminates the script again so that other events can start.

The spawned asteroid gets a ComponentType.DeletionTimer component, that will delete the asteroid after 15 minutes.

On spawn, the script sends a message to every player in the sector that a mysterious asteroid appeared.

modinfo.lua[ | ]

  • serverSideOnly = false This mod introduces a new Sector script, which the client has to know about. Also: Localization.
  • clientSideOnly = false Client side only is impossible, since a new script is added to sectors, which is only possible on the server.
  • saveGameAltering = true The mod adds a new script data/scripts/events/mysteryasteroid.lua whose path will be saved into the database. Once the mod is disabled, the script is no longer existant and the savegame will be slightly corrupted (not unplayable though).

Localization[ | ]

In the data/localization/ folder you can find an example for a German localization of texts that appear in the mod.

Workshop Link[ | ]

See Also[ | ]

Advertisement