Stellaris
Zbyt mało ocen
SGM Library
   
Przyznaj nagrodę
Ulubione
Ulubione
Usuń z ulubionych
Utilities
Tagi: SGM
Rozmiar pliku
Zamieszczono
Zaktualizowano
135.413 KB
26 czerwca 2017 o 10:37
26 lutego 2018 o 13:08
Listy zmian: 5 ( zobacz )

Zasubskrybuj, aby pobrać
SGM Library

Opis
Overview
This is not a mod, but a resource for modders. Its purpose is to centralize scripts that are used by multiple addons.

Features
Most of the library functions allow you to determine (or estimate) the numerical value of an ingame property (which is not possible via normal scripting). The other "innovation" is that it shows a way to apply dynamic modifiers (by implementing a range of static modifiers and using binary search to determine which one is actually applied).

List of Functions
The naming scheme is more or less SGM_<scope>_<action>_<property>
  1. SGM_country_add_energy/food/influence/minerals/unity
  2. SGM_country_sub_energy/food/influence/minerals/unity
  3. SGM_country_get_energy_balance
  4. SGM_country_get_max_naval_capacity
  5. SGM_country_get_mineral_balance
  6. SGM_fleet_acc_fleet_size
  7. SGM_fleet_get_fleet_power
  8. SGM_fleet_get_fleet_size
  9. SGM_planet_get_planet_size
  10. SGM_ship_modifier_upkeep_add
  11. SGM_ship_modifier_weapon_damage_add

Some of these scripts consist of several thousands lines of code. When Stellaris is launched the code is interpreted, which causes the loading time to increase. Most mods use exclusively their own scripts, but I found that several of the SGM mods need the same functionality and thus I created this library to avoid loading the same script multiple times.

Using SGM Library In Your Own Mods
Modders are welcome to take a peak and copy as they like. Please leave a comment or thumbs up if you find something useful. You can also use the provided functions in your own mods by including this library as a "Required Item". If you do so, please make sure that you read and understand the disclaimer at the very end.

Automatic Code Generation
Some of the provided scripts are created "automatically" using a simple code creator written in Matlab. The source of the coder is included in the upload as well. You might find it useful for creating static, loop unrolled binary searches to determine the exact numerical value of Stellaris ingame variables, using only the minimally required number of "if" statements.

Return Value Concept
To specify the scope for the return value of a function use
  1. "save_event_target_as=SGM_result_scope" in your desired result scope
  2. the script will make the return value available in the marked scope using "event_target:SGM_result_scope"
  3. the result variable is named "SGM_<name_of_ingame_property>"

Disclaimer
At last a fair word of warning: Stellaris scripting is primitive. There is no abstraction, there are no interfaces. You are directly depending on the implementation itself. If you use this library, every change that I make will directly affect your mod. I'll try to keep the library stable and up-to-date, but understand that I am doing this in my free time, as a hobby. In no way am I to be held responsible for any inconvenience or error that results from using this library.
Komentarzy: 1
Doomwarrior 28 czerwca 2017 o 5:04 
Hello, i am currently working on fixing the combat balance and corvette spam, i would love to make it as compatible to your mod as possible, maybe we can connect and see whats possible.

http://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=952619600