Knasp
Warlord
- Joined
- Sep 10, 2011
- Messages
- 266
Is it possible to give a plot minus to a yield due to adjacency, and make this conditional?
Background
I've written sql code that allows Fishing Boats to be built on any coastal tile, which works fine.
New Goal
I want Fishing boats to get -1 to food for every two adjacent Fishing boats.
I've tried two approaches but I can't get any of them to work:
1. Through Improvement_Adjacencies
This doesn't work as expected. Fishing boats get -1 food for every single adjacent Fishing boats. But if I change the yield from a negative -1 to a positive 1, it suddenly requires two adjacent plots...
2. Through ImprovementModifiers
When testing, the Fishing boats get +1 food for having an adjacent Fishing boats improvement, instead of requiring two. Also the yield doesn't change when building more adjacent Fishing boats.
Is there anything wrong with the code?
Is there some other approach that I could try?
Background
I've written sql code that allows Fishing Boats to be built on any coastal tile, which works fine.
New Goal
I want Fishing boats to get -1 to food for every two adjacent Fishing boats.
I've tried two approaches but I can't get any of them to work:
1. Through Improvement_Adjacencies
Code:
insert into Improvement_ValidTerrains (ImprovementType,TerrainType,PrereqTech) values ('IMPROVEMENT_FISHING_BOATS','TERRAIN_COAST','TECH_SAILING');
insert into Improvement_Adjacencies (ImprovementType,YieldChangeId) values ('IMPROVEMENT_FISHING_BOATS','Overfishing');
insert into Adjacency_YieldChanges (ID,Description,YieldType,YieldChange,TilesRequired,AdjacentImprovement) values ('Overfishing','Placeholder','YIELD_FOOD',-1,2,'IMPROVEMENT_FISHING_BOATS');
2. Through ImprovementModifiers
Code:
insert into Improvement_ValidTerrains (ImprovementType,TerrainType,PrereqTech) values ('IMPROVEMENT_FISHING_BOATS','TERRAIN_COAST','TECH_SAILING');
insert into ImprovementModifiers (ImprovementType,ModifierID) values ('IMPROVEMENT_FISHING_BOATS','FISHINGBOATS_OVERFISHING');
--Modifiers
insert into Modifiers (ModifierId,ModifierType,RunOnce,NewOnly,Permanent,SubjectRequirementSetId) values ('FISHINGBOATS_OVERFISHING','MODIFIER_SINGLE_PLOT_ADJUST_PLOT_YIELDS',0,0,0,'OVERFISHING_REQUIREMENTS');
insert into ModifierArguments (ModifierId,Name,Value) values ('FISHINGBOATS_OVERFISHING','YieldType','YIELD_FOOD');
insert into ModifierArguments (ModifierId,Name,Value) values ('FISHINGBOATS_OVERFISHING','Amount',1);
-- I've set the amount to a postive "1" since I want to confirm that the requirements work as intended, before trying the negative yield change.
--RequirementSets
insert into RequirementSets (RequirementSetId,RequirementSetType) values ('OVERFISHING_REQUIREMENTS','REQUIREMENTSET_TEST_ALL');
insert into RequirementSetRequirements (RequirementSetId,RequirementId) values ('OVERFISHING_REQUIREMENTS','REQUIRES_ADJACENT_FISHINGBOATS');
insert into RequirementSetRequirements (RequirementSetId,RequirementId) values ('OVERFISHING_REQUIREMENTS','REQUIRES_PLOT_HAS_FISHINGBOATS');
--Requirements
insert into Requirements (RequirementId,RequirementType) values ('REQUIRES_ADJACENT_FISHINGBOATS','REQUIREMENT_PLOT_ADJACENT_IMPROVEMENT_TYPE_MATCHES');
insert into RequirementArguments (RequirementId,Name,Value) values ('REQUIRES_ADJACENT_FISHINGBOATS','ImprovementType','IMPROVEMENT_FISHING_BOATS');
insert into RequirementArguments (RequirementId,Name,Value) values ('REQUIRES_ADJACENT_FISHINGBOATS','MinimumAmount',2);
--I've tried 'Amount' instead of MinimumAmount, but it doesn't work neither.
Is there anything wrong with the code?
Is there some other approach that I could try?
Last edited: