wowgetoffyourcellphone Posted July 17, 2020 Report Share Posted July 17, 2020 https://trac.wildfiregames.com/changeset/23843#file0 https://code.wildfiregames.com/D270 So, what syntax must I use in the technology file? Is there an example in-game? A good use case for EA would be the Seleucid reform techs. It unlocks either Silvershield Pikeman or Romanized Heavy Swordsman, so what the tech could do is remove the other. Quote Link to comment Share on other sites More sharing options...
Stan` Posted July 17, 2020 Report Share Posted July 17, 2020 modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": "units/{civ}_champion_infantry_a_barracks>units/{civ}_champion_infantry_e_barracks units/{civ}_champion_infantry_a>units/{civ}_champion_infantry_e" }] Where tokens is the new list separated by spaces 1 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 17, 2020 Author Report Share Posted July 17, 2020 (edited) > = replace? / = a new set? Edited July 17, 2020 by wowgetoffyourcellphone Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 17, 2020 Author Report Share Posted July 17, 2020 (edited) 1 hour ago, Stan` said: modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": "units/{civ}_champion_infantry_a_barracks>units/{civ}_champion_infantry_e_barracks units/{civ}_champion_infantry_a>units/{civ}_champion_infantry_e" } Where tokens is the new list separated by spaces So, this probably won't work: { "genericName": "Iphicrates", "description": "Iphicrates.", "icon": "athen_hero_iphicrates_card.png", "tooltip": "Select Iphicrates to lead your civilization.", "modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": " -units/athen_hero_miltiades -units/athen_hero_pericles -units/athen_hero_socrates" } ], "affects": ["CivilCentre"] } Edited July 17, 2020 by wowgetoffyourcellphone Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 17, 2020 Author Report Share Posted July 17, 2020 1 hour ago, Stan` said: modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": "units/{civ}_champion_infantry_a_barracks>units/{civ}_champion_infantry_e_barracks units/{civ}_champion_infantry_a>units/{civ}_champion_infantry_e" } Where tokens is the new list separated by spaces 57 minutes ago, wowgetoffyourcellphone said: > = replace? / = a new set? From technologies.js: Supports "A>B" to replace A by B, "-A" to remove A, and the rest will add tokens Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 17, 2020 Author Report Share Posted July 17, 2020 (edited) { "genericName": "Iphicrates", "description": "Iphicrates.", "icon": "athen_hero_iphicrates_card.png", "tooltip": "Select Iphicrates to lead your civilization.", "modifications": [{ "value": "ProductionQueue/Entities/_string", "tokens": ["-units/athen_hero_miltiades_infantry -units/athen_hero_themistocles -units/athen_hero_pericles"] }], "affects": ["CivilCentre"] } This validates, but throw this error: Spoiler ERROR: Script message handler OnTemplateModification failed ERROR: JavaScript error: globalscripts/Technologies.js line 58 TypeError: modification.split is not a function HandleTokens@globalscripts/Technologies.js:58:45 GetTechModifiedProperty@globalscripts/Technologies.js:32:11 ModifiersManager.prototype.FetchModifiedProperty@simulation/components/ModifiersManager.js:110:9 ModifiersManager.prototype.ApplyTemplateModifiers@simulation/components/ModifiersManager.js:193:9 ApplyValueModificationsToTemplate@simulation/helpers/ValueModification.js:19:11 AIInterface.prototype.OnTemplateModification@simulation/components/AIInterface.js:256:19 ModifiersManager.prototype.SendPlayerModifierMessages@simulation/components/ModifiersManager.js:69:1 ModifiersManager.prototype.ModifiersChanged@simulation/components/ModifiersManager.js:60:4 ModifiersManager.prototype.Init/this.modifiersStorage._OnItemModified@simulation/components/ModifiersManager.js:23:65 MultiKeyMap.prototype.AddItem@simulation/helpers/MultiKeyMap.js:49:2 MultiKeyMap.prototype.AddItems@simulation/helpers/MultiKeyMap.js:62:14 ModifiersManager.prototype.AddModifiers@simulation/components/ModifiersManager.js:265:9 TechnologyManager.prototype.ResearchTechnology@simulation/components/TechnologyManager.js:228:1 g_Commands["civ-choice"]@simulation/helpers/CommandsCivChoice.js:4:2 ProcessCommand@simulation/helpers/Commands.js:47:3 ERROR: Failed to call ProcessCommand() global script function @Stan` @wraitii Edited July 18, 2020 by wowgetoffyourcellphone Quote Link to comment Share on other sites More sharing options...
Silier Posted July 18, 2020 Report Share Posted July 18, 2020 without [ and ] like here { "value": "ProductionQueue/Entities/_string", "tokens": "units/{civ}_champion_infantry_a_barracks>units/{civ}_champion_infantry_e_barracks units/{civ}_champion_infantry_a>units/{civ}_champion_infantry_e" } 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 How do I subtract tokens? Quote Link to comment Share on other sites More sharing options...
Silier Posted July 18, 2020 Report Share Posted July 18, 2020 This should remove house { "value": "Builder/Entities/_string", "tokens": "structures/stonehenge -structures/{civ}_house" } Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 17 minutes ago, Angen said: This should remove house { "value": "Builder/Entities/_string", "tokens": "structures/stonehenge -structures/{civ}_house" } Thanks. It works to remove the other heroes as desired. However, I get this error: ERROR: Script message handler OnValueModification failed ERROR: Script message handler OnValueModification failed ERROR: Script message handler OnValueModification failed ERROR: Script message handler OnValueModification failed ERROR: Script message handler OnValueModification failed ERROR: Script message handler OnGlobalValueModification failed ERROR: JavaScript error: simulation/components/ProductionQueue.js line 142 TypeError: token.split is not a function ProductionQueue.prototype.CalculateEntitiesMap/this.entitiesMap<@simulation/components/ProductionQueue.js:142:1 ProductionQueue.prototype.CalculateEntitiesMap@simulation/components/ProductionQueue.js:135:21 ProductionQueue.prototype.OnValueModification@simulation/components/ProductionQueue.js:940:2 ModifiersManager.prototype.SendPlayerModifierMessages@simulation/components/ModifiersManager.js:74:2 ModifiersManager.prototype.ModifiersChanged@simulation/components/ModifiersManager.js:60:4 ModifiersManager.prototype.Init/this.modifiersStorage._OnItemModified@simulation/components/ModifiersManager.js:23:65 MultiKeyMap.prototype.AddItem@simulation/helpers/MultiKeyMap.js:49:2 MultiKeyMap.prototype.AddItems@simulation/helpers/MultiKeyMap.js:62:14 ModifiersManager.prototype.AddModifiers@simulation/components/ModifiersManager.js:265:9 TechnologyManager.prototype.ResearchTechnology@simulation/components/TechnologyManager.js:228:1 g_Commands["civ-choice"]@simulation/helpers/CommandsCivChoice.js:4:2 ProcessCommand@simulation/helpers/Commands.js:47:3 ERROR: Failed to call ProcessCommand() global script function Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 token = token.split(/\s+/); What's this? Quote Link to comment Share on other sites More sharing options...
Silier Posted July 18, 2020 Report Share Posted July 18, 2020 it is supposed to split string stored in token based on white spaces and reuse the same variable Hmm, that might be an actual issue, can you show your modification file? Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 3 minutes ago, Angen said: it is supposed to split string stored in token based on white spaces and reuse the same variable Hmm, that might be an actual issue, can you show your modification file? { "genericName": "Iphicrates", "description": "Iphicrates.", "icon": "athen_hero_iphicrates_card.png", "tooltip": "Select Iphicrates to lead your civilization.", "modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": "-units/athen_hero_miltiades_infantry -units/athen_hero_themistocles -units/athen_hero_pericles" } ], "affects": ["CivilCentre"] } Here she is. Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 10 minutes ago, Angen said: it is supposed to split string stored in token based on white spaces and reuse the same variable Hmm, that might be an actual issue, can you show your modification file? Oddly, altering the tech like this removed the error code. { "genericName": "Iphicrates", "description": "Iphicrates.", "icon": "athen_hero_iphicrates_card.png", "tooltip": "Select Iphicrates to lead your civilization.", "modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": "-units/athen_hero_miltiades_infantry -units/athen_hero_themistocles -units/athen_hero_pericles", "affects": "CivilCentre" }, { "value": "ProductionQueue/Entities/_string", "tokens": "-units/athen_hero_socrates", "affects": "Stoa" } ] } Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 This one still gives that error { "genericName": "Socrates", "description": "Socrates.", "icon": "athen_hero_socrates_card.png", "tooltip": "Select Socrates to lead your civilization.", "modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": "-units/athen_hero_miltiades_infantry -units/athen_hero_themistocles -units/athen_hero_pericles -units/athen_hero_iphicrates", "affects": "CivilCentre" } ] } Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 Neh 11 minutes ago, wowgetoffyourcellphone said: Oddly, altering the tech like this removed the error code. { "genericName": "Iphicrates", "description": "Iphicrates.", "icon": "athen_hero_iphicrates_card.png", "tooltip": "Select Iphicrates to lead your civilization.", "modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": "-units/athen_hero_miltiades_infantry -units/athen_hero_themistocles -units/athen_hero_pericles", "affects": "CivilCentre" }, { "value": "ProductionQueue/Entities/_string", "tokens": "-units/athen_hero_socrates", "affects": "Stoa" } ] } Meh, at 100 seconds I get this similar error: ERROR: Script message handler OnOwnershipChanged failed ERROR: Script message handler OnOwnershipChanged failed ERROR: Script message handler OnOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Error in timer on entity 1304, IID97, function TimerHandler: TypeError: token.split is not a function ProductionQueue.prototype.CalculateEntitiesMap/this.entitiesMap<@simulation/components/ProductionQueue.js:142:1 ProductionQueue.prototype.CalculateEntitiesMap@simulation/components/ProductionQueue.js:135:21 ProductionQueue.prototype.OnOwnershipChanged@simulation/components/ProductionQueue.js:624:3 Foundation.prototype.Build@simulation/components/Foundation.js:417:3 Builder.prototype.PerformBuilding@simulation/components/Builder.js:78:3 UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.REPAIR.REPAIRING.Timer@simulation/components/UnitAI.js:2883:6 FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:265:12 UnitAI.prototype.TimerHandler@simulation/components/UnitAI.js:4110:2 Timer.prototype.OnUpdate@simulation/components/Timer.js:139:4 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 Lol, now buildings won't finish construction. Quote Link to comment Share on other sites More sharing options...
Silier Posted July 18, 2020 Report Share Posted July 18, 2020 I can't debug right now, I raised concern with commit. Ping @wraitii 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 18, 2020 Author Report Share Posted July 18, 2020 (edited) { "genericName": "General Craterus", "description": "General Craterus.", "icon": "mace_hero_craterus_card.png", "tooltip": "Select General Craterus to lead your civilization.", "modifications": [ { "value": "ProductionQueue/Entities/_string", "tokens": "-units/mace_hero_philip_infantry -units/mace_hero_demetrius_infantry -units/mace_hero_alexander_infantry", "affects": "CivilCentre" } ] } I get this error now once a building is "completed", but is not really completed. It just sits at 99.999999% completed. Spoiler ERROR: Script message handler OnOwnershipChanged failed ERROR: Script message handler OnOwnershipChanged failed ERROR: Script message handler OnOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Script message handler OnGlobalOwnershipChanged failed ERROR: Error in timer on entity 1290, IID97, function TimerHandler: TypeError: token.split is not a function ProductionQueue.prototype.CalculateEntitiesMap/this.entitiesMap<@simulation/components/ProductionQueue.js:142:1 ProductionQueue.prototype.CalculateEntitiesMap@simulation/components/ProductionQueue.js:135:21 ProductionQueue.prototype.OnOwnershipChanged@simulation/components/ProductionQueue.js:624:3 Foundation.prototype.Build@simulation/components/Foundation.js:417:3 Builder.prototype.PerformBuilding@simulation/components/Builder.js:78:3 UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.REPAIR.REPAIRING.Timer@simulation/components/UnitAI.js:2883:6 FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:265:12 UnitAI.prototype.TimerHandler@simulation/components/UnitAI.js:4110:2 Timer.prototype.OnUpdate@simulation/components/Timer.js:139:4 @wraitii @Angen @Freagarach Edited July 18, 2020 by wowgetoffyourcellphone Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 20, 2020 Report Share Posted July 20, 2020 Thanks for reporting this, I did miss this case. See D2894 for a fix. 1 Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted July 20, 2020 Author Report Share Posted July 20, 2020 59 minutes ago, wraitii said: Thanks for reporting this, I did miss this case. See D2894 for a fix. The fix seems to work on my end. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.