Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modding requests #3242

Open
yairm210 opened this issue Oct 7, 2020 · 414 comments
Open

Modding requests #3242

yairm210 opened this issue Oct 7, 2020 · 414 comments
Labels

Comments

@yairm210
Copy link
Owner

yairm210 commented Oct 7, 2020

There have been a lot of various requests to extend the modding in various ways.
Usually they're from one person, and have very little effect on the general playerbase, and they're kind of clogging up the issues.

So this is an issue to consolidate all those requests, as comments to this issue.

@GoldenBronze
Copy link
Contributor

  1. Making roads and railroads modifyable - currently, these seem hardcoded. Putting their parameters in TileResources.json and allowing Unciv to handle modded roads and railroads would be extremely beneficial for, say, a mod with several kinds of roads.

When described in the json, roads and railroads could have parameters like "Double movement rate" and "Triple movement rate upon researching [ ]". There's lots of opportunity here.

  1. Allowing terrain-tied resources - currently, resources stay the same if a terrain feature (most commonly Forest and Jungle) is removed. I'd like it if it were possible to set a (in TileResources.json) a resource such that it disappears if the terrain feature it occurs on is removed. Admittedly, this is not present in Civ 5 itself, but it would be extremely helpful to modders like me in putting resources like Cedarwood: I mean, you can't get cedarwood from a tile you've deforested, after all!

A unique for this, maybe "Is removed by [Remove Forest]".

  1. Selective improvement construction: currently, the Roman Legion has the "Can construct roads" unique. It would be great if this unique could be generalised so that it works with any improvement: not only would it make it easy to add the Legion's other ability of constructing forts, it would also be extremely fruitful for modders.

"Can construct [Road], [Fort]".

  1. Tile improvements unique to units: I'd like to be able to define a modded tile improvement as being unique to a non-Worker unit, so that the Worker can't build it.

Maybe a "UniquetoUnit" parameter inside the "uniques": in TileImprovents.json or something similar? This would also allow Oil Wells to be restricted to Workers and Offshore Platforms to be restricted to Work Boats, as in Civ 5, assuming that the "improvement": parameter in TileResources.json can handle more than one improvement.

@GoldenBronze
Copy link
Contributor

  1. Allow terrains, terrain features and resources to be restricted to spawn only on River tiles.

A unique to the effect of "Must be on [River]" or something similar would be great, especially for futureproofing Unciv for Civ 6 (if you eber get to that), and also for modding.

@ravignir
Copy link
Contributor

Here are some ideas for uniques.

"Can not be sold" - for buildings.

"Unlocks at [Era name]" - for buildings and units and improvements (already implemented for Policies).

"Food required for population growth +/- [x]%" - as nation and policy unique (also called civ-wide).

@ravignir
Copy link
Contributor

Just a clarification of what i've meant with the last idea.
Capture+_2020-10-20-16-45-14(1)
A way to interact with this parameter. Maybe call it "City growth rate +/-[value]%"

@ravignir
Copy link
Contributor

ravignir commented Nov 9, 2020

Another suggestions;
Modding unique that makes other policy trees non pickable:
i.e If i pick Piety, I can't pick Rationalism and vice versa;

"Unlocks at [era]" unique for buildings, units;

@Caballero-Arepa
Copy link
Contributor

This is already mentioned on the first comment but: A unique that allows units to build specific tile improvements, like "Can construct [Fort]".
Currently there is only: "can build improvements on tiles" and " Can construct Roads".

@Caballero-Arepa
Copy link
Contributor

A unique that let's you do canals for improvements or tiles. With this, we could make canals (like, suez canal) or make navigable rivers; or even the opposite, as bridges (like the one that ties scotland and ireland).
I imagine the unique could be as: "Acts as [Water]"
How it would is by allowing both land and water units move in such tile normally.

The problem I see with it is that AI would be very dumb to use it but what we care is for the player.

@AdityaMH
Copy link
Contributor

AdityaMH commented Jul 7, 2021

Any wiki tutorial how to mod m̶u̶s̶i̶c̶ sound?

@Caballero-Arepa
Copy link
Contributor

A unique for polices that gives you a free policy, but from a specific tree.

@ajustsomebody
Copy link
Contributor

allow tile filter to contain more than one tile

f.i allow this to work
"Must be next to [Desert]", "[+1 Food, +1 Production, +1 Gold] from [Desert] tiles without [Flood plains, Oasis, Hill] [in this city]"

this is my attempt to only make plain desert tiles get petra bonuses but it completely broke so it gives bonuses to all

@ajustsomebody
Copy link
Contributor

more than 1 techs required for a building
techrequired: "currency, sailing"

@ajustsomebody
Copy link
Contributor

add a property to improvements that is can be build by [unitFilter] so the mods can add more than 1 types of workers. this however should only be the case for worker units that are able to open up select improvements to build window rather than something like legions that have an ability to build only roads

@xlenstra
Copy link
Collaborator

xlenstra commented Aug 2, 2021

add a property to improvements that is can be build by [unitFilter] so the mods can add more than 1 types of workers. this however should only be the case for worker units that are able to open up select improvements to build window rather than something like legions that have an ability to build only roads

This is already implemented the other way around, as you can have the "Can build [improvementFilter] improvements" uniques for units, so this can allow building specific improvements or groups of improvements

@ajustsomebody
Copy link
Contributor

add a property to improvements that is can be build by [unitFilter] so the mods can add more than 1 types of workers. this however should only be the case for worker units that are able to open up select improvements to build window rather than something like legions that have an ability to build only roads

This is already implemented the other way around, as you can have the "Can build [improvementFilter] improvements" uniques for units, so this can allow building specific improvements or groups of improvements

is there a distinction between units than can open up build improvement screen and others? also do you need to do something like this "can build [mine]" "can build [farm] etc or can it directly do can build "[mine,farm,quarry]" etc.

@xlenstra
Copy link
Collaborator

xlenstra commented Aug 3, 2021

add a property to improvements that is can be build by [unitFilter] so the mods can add more than 1 types of workers. this however should only be the case for worker units that are able to open up select improvements to build window rather than something like legions that have an ability to build only roads

This is already implemented the other way around, as you can have the "Can build [improvementFilter] improvements" uniques for units, so this can allow building specific improvements or groups of improvements

is there a distinction between units than can open up build improvement screen and others? also do you need to do something like this "can build [mine]" "can build [farm] etc or can it directly do can build "[mine,farm,quarry]" etc.

Only units that have have the "Can build []" unique can open the "build improvement"-screen. Uniques don't support comma separation, so you need a different unique for each imrpovement

@ajustsomebody
Copy link
Contributor

comma seperation for uniques

@ajustsomebody
Copy link
Contributor

two uniquesets for anything that supports uniques, one for with religion on and one with religion off

like:
monastery(r on) = 2 culture 2 faith from incense/wine
monastery(r off) = 2 culture from incense/wine

or we can just make the game ignore anything about faith or gprop points when religion is disabled

@ajustsomebody
Copy link
Contributor

being able to put decimals in bonuses for instance.

[+0.50 Food] for [tundra] tiles for each adjacent [mountain] tiles [in all cities]
[-0.16 Food] for [tundra] tiles for each adjacent [snow] tiles without [mountain] tiles

for instance when calculating this you do math on each other and remove the decimal at the end of the calculation (or just allow decimals in [stats])
(0.50+0.50+0.50) - (0.32) which is 1.18.
if the value is less than 0 you round it down normally (0 if <50 1 if >50) if it is over 1 just remove the decimals and if it is 1.82 something round it to 2

@ajustsomebody
Copy link
Contributor

ajustsomebody commented Aug 8, 2021

add an option to hide certain uniques from showing up in descriptions like
uniques: "[HIDE] [+1 Gold, +1 Science] from every [grassland] with [jungle]", "[does something that dhows up in description]"

something something:
400Production
womething that shows up in description

@xlenstra
Copy link
Collaborator

xlenstra commented Aug 8, 2021

Use the replacementTextForUniques parameter, most major things have that

@GeneralWadaling
Copy link
Contributor

GeneralWadaling commented Aug 1, 2024

Can we have Unclaimed Land / Unclaimed as a TerrainFilter?
To explain it, it is Foreign Land but exclude lands that has been owned by any civ or city state.

Could be useful for application for the modified culture bomb (Citadel land claim) unique days ago.

@yairm210
Copy link
Owner Author

yairm210 commented Aug 1, 2024

There is [Neutral] tiles

@GeneralWadaling
Copy link
Contributor

Ahh I see. Thank you.

@ProgramCrafter
Copy link

  1. IndirectFire unique applicable on nation level (I want it to be nation bonus which shouldn't be preserved on units should they be captured in any way):

    IndirectFire("Ranged attacks may be performed over obstacles", UniqueTarget.Unit),

  2. IgnoreHillMovementCost generic over terrain type (I want no OP penalty in forests, for instance):

    IgnoreHillMovementCost("Units ignore terrain costs when moving into any tile with Hills", UniqueTarget.Nation),

@yairm210
Copy link
Owner Author

yairm210 commented Aug 4, 2024

Indirect fire on national level - you can make all units get the promotion with "[mapUnitFilter] units gain the [promotion] promotion" ;)
IgnoreHillMovementCost - We should probably deprecate that anyway, we already have "Double movement in [terrainFilter]" which can effectively replace that

@ProgramCrafter
Copy link

Indirect fire on national level - you can make all units get the promotion with "[mapUnitFilter] units gain the [promotion] promotion" ;)

Of course, but how do I revoke this promotion when unit is captured or gifted to city-state? Lore of my mod dictates that it is bonus of nation, which does not transfer to others.

Double movement in [terrainFilter]

Seems OK, will do that!

@carriontrooper
Copy link

Indirect fire on national level - you can make all units get the promotion with "[mapUnitFilter] units gain the [promotion] promotion" ;)

Of course, but how do I revoke this promotion when unit is captured or gifted to city-state? Lore of my mod dictates that it is bonus of nation, which does not transfer to others.

Double movement in [terrainFilter]

Seems OK, will do that!

Try adding "This unit loses the [promotion] promotion <for [non-[civName]]>" to the added promotion? Or another promotion that's also added to that unit?

@yairm210
Copy link
Owner Author

yairm210 commented Aug 5, 2024

Oh wow that's very meta and a trick I'll remeber for the future :D
But I think adding the indirect fire to check national uniques is simple enough, and it's not a check we need to conduct very often

@ProgramCrafter
Copy link

@yairm210

IgnoreHillMovementCost - We should probably deprecate that anyway, we already have "Double movement in [terrainFilter]" which can effectively replace that

Oh. Double movement is also unit-only. I can add yet another promotion bound to nation, but maybe it's worth it to allow nation-wide modification here as well?

@carriontrooper
Copy link

Echoing LoliAkulka's suggestion over on Discord - a <if [modFilter] is enabled> conditional would be great.

@yairm210
Copy link
Owner Author

yairm210 commented Aug 6, 2024

Damn, that's meta :|
Mods that dynamically react to other mods existing
I like

@SomeTroglodyte
Copy link
Collaborator

SomeTroglodyte commented Aug 6, 2024

a <if [modFilter] is enabled> conditional

We don't have one already? Then I probably dreamed about it long ago then forgot on waking up...

Any volunteers to test this patch?
Subject: [PATCH] Extend docDescription
---
Index: core/src/com/unciv/models/ruleset/validation/ModCompatibility.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/src/com/unciv/models/ruleset/validation/ModCompatibility.kt b/core/src/com/unciv/models/ruleset/validation/ModCompatibility.kt
--- a/core/src/com/unciv/models/ruleset/validation/ModCompatibility.kt	(revision bcf50497ab68d9d82263e8f99862aa7d42268142)
+++ b/core/src/com/unciv/models/ruleset/validation/ModCompatibility.kt	(date 1719508388471)
@@ -56,7 +56,7 @@
             && mod.name.isNotBlank()
             && !mod.modOptions.hasUnique(UniqueType.ModIsAudioVisualOnly)
 
-    private fun modNameFilter(modName: String, filter: String): Boolean {
+    fun modNameFilter(modName: String, filter: String): Boolean {
         if (modName == filter) return true
         if (filter.length < 3 || !filter.startsWith('*') || !filter.endsWith('*')) return false
         val partialName = filter.substring(1, filter.length - 1).lowercase()
Index: core/src/com/unciv/models/ruleset/unique/UniqueType.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt
--- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt	(revision bcf50497ab68d9d82263e8f99862aa7d42268142)
+++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt	(date 1722979006393)
@@ -937,6 +937,7 @@
     ModIsNotAudioVisual("Cannot be used as permanent audiovisual mod", UniqueTarget.ModOptions, flags = UniqueFlag.setOfNoConditionals),
     ModMapPreselection("Mod preselects map [comment]", UniqueTarget.ModOptions, flags = UniqueFlag.setOfNoConditionals,
         docDescription = "Only meaningful for Mods containing several maps. When this mod is selected on the new game screen's custom maps mod dropdown, the named map will be selected on the map dropdown. Also disables selection by recently modified. Case insensitive."),
+    ConditionalModEnabled("if [modFilter] is enabled", UniqueTarget.Conditional),
 
     // endregion
 
Index: core/src/com/unciv/models/ruleset/unique/Conditionals.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/src/com/unciv/models/ruleset/unique/Conditionals.kt b/core/src/com/unciv/models/ruleset/unique/Conditionals.kt
--- a/core/src/com/unciv/models/ruleset/unique/Conditionals.kt	(revision bcf50497ab68d9d82263e8f99862aa7d42268142)
+++ b/core/src/com/unciv/models/ruleset/unique/Conditionals.kt	(date 1722756642467)
@@ -6,6 +6,7 @@
 import com.unciv.logic.city.City
 import com.unciv.logic.civilization.Civilization
 import com.unciv.logic.civilization.managers.ReligionState
+import com.unciv.models.ruleset.validation.ModCompatibility
 import com.unciv.models.stats.Stat
 import kotlin.random.Random
 
@@ -303,6 +304,11 @@
                     first in second..third
                 }
 
+            UniqueType.ConditionalModEnabled -> checkOnGameInfo {
+                val filter = conditional.params[0]
+                (gameParameters.mods.asSequence() + gameParameters.baseRuleset).any { ModCompatibility.modNameFilter(it, filter) }
+            }
+
             else -> false
         }
     }

Edit for reference: got implemented in 2b81172

@yairm210
Copy link
Owner Author

yairm210 commented Aug 6, 2024

@SomeTroglodyte Works like a charm :D
I'll take it ;)

@RealBamboolord
Copy link
Contributor

At this point I am convinced that Yairm is an alien and SomeTrog is a sorcerer

@SomeTroglodyte
Copy link
Collaborator

No, one is an alienated sorcerer and the other an ensorcelled alien.

@RealBamboolord
Copy link
Contributor

At least I was somewhat close

@SomeTroglodyte
Copy link
Collaborator

SomeTroglodyte commented Aug 9, 2024

Idea: A debug flag to disable the "Hidden" flags - so one can better analyze a mod using Civilopedia??? Is that clever or just senility speaking?

Off:
image
On:
image

Off:
image
On:
image

Off:
image
On:
image

Edit: Code is pretty simple...

@hackedpassword
Copy link

hackedpassword commented Aug 9, 2024

Looks good @SomeTroglodyte seems like a no-brainer to have.

Over in adding yet another modding request:
"This tile obstructs "

I'm reaching for a grey area of movement caching compatibility. If the tile's movement condition was able to be precalc'd under a fixed conditional, that could potentially be non-dynamic as to not interfere with reachability.

Fixed conditional example:
<vs [mapUnitFilter] units>
edit: forgot tech and era can change mid-turn

Requires dynamic consideration example:
<on foreign continents>

Fixed conditionals could be labeled in the wiki as fixed conditionals which may go towards guiding the modder on which conditionals may apply. Instead of noting "Due to performance considerations..." if a pre-cached conditional applies, a new statement could be "Compatible with fixed conditionals only". 🥇 🏆

@yairm210
Copy link
Owner Author

...not accurate, mapUnitFilter can include "wounded", "embarked", promotion name (which can be gained within a turn), etc
I tried mapping out the actual fixed conditionals and there aren't a lot - before/after turn X, dependent on game start (era, speed, difficulty, water maps), and that's basically it
I understand the direction but there's not much practical application

@hackedpassword
Copy link

k thanks for considering =)

@AutumnPizazz
Copy link
Contributor

AutumnPizazz commented Aug 19, 2024

Well, "Gain control over [all] tiles in a [1]-tile radius" never appears in Unciv Wiki , is it okay?

This has been solved in new version.

@GeneralWadaling
Copy link
Contributor

I would like to ask for opening alternatives revealing a resource other than tech, such as by policies or beliefs.
I'm planning on a mod which it has a resource that has multiple ways to reveal it - it can be revealed early by a policy but can still be normally revealed by later tech.

@ThunderWasTaken
Copy link

Modding city states to:

  • Declare war themselves on certain circumstances such as reaching -60 opinion or etc
  • Immediately declare war on any civs that come across it
  • Disallow the city state to be given a peace offer, forcing it to be in a forever war

all of these as seperate uniques would be great, also give city state types (militaristic, mercantile, etc) the ability to be given uniques if it isn't possible already.

@carriontrooper
Copy link

new UnitActionModifier: <loses [promotion] promotion>
For when you want an unitAction to 'cost' a promotion.

@RealBamboolord
Copy link
Contributor

<upon gifting a [mapUnitFilter] unit to [civFilter]> would be neat to have. Would allow to mod a civ that gains some compensations for gifting units

@hackedpassword
Copy link

UnitFilter: <Gains an upgrade>

<All [MapUnitFilter] units gain an upgrade>

To be able to award upgrades just as promotions are.

@AceHank
Copy link

AceHank commented Sep 22, 2024

I am once again requesting some uniques,

Unit Trigger Condition
"<upon gaining [promotion] promotion>"
"<upon losing [promotion] promotion>"
"upon defending" and/or please make "upon losing at least x hp" compatible with the "vs unit"

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests