Crash To Desktop

isau

Deity
Joined
Jan 15, 2007
Messages
3,071
Hi folks,

This was an attempt to edit Catherine's spies so they appear with Masonry instead of Castles. I've noticed running this code doesn't update the database at all, and creates a Crash to Desktop after ending turn 1. Is there some specific limitation on inserting or updating the Modifiers, Requirements, or RequirementSets tables that we know of? That's the error that seems to show in the Database log.


Here is the SQL:

Code:
-- Unique Spy: Unlock at Masonry instead of Castles

-- Create the base requirement and its arguments
INSERT INTO Requirements (RequirementId, RequirementType) VALUES ('REQUIRES_TECHNOLOGY_MASONRY', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY') ;

INSERT INTO RequirementArguments (RequirementId, Name, Type, Value) VALUES ('REQUIRES_TECHNOLOGY_MASONRY', 'TechnologyType', 'ARGTYPE_IDENTITY', 'TECH_MASONRY' );

-- Create a requirementset that consists solely of our new requirement
INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES ('PLAYER_HAS_MASONRY_TECHNOLOGY', 'REQUIRES_TECHNOLOGY_MASONRY') ;

-- Update Catherine's existing UNIQUE_LEADER_ADD_SPY ability to point to our new requirement set
UPDATE Modifiers SET SubjectRequirementSetId='PLAYER_HAS_MASONRY_TECHNOLOGY' WHERE ModifierID='UNIQUE_LEADER_ADD_SPY' AND ModifierType='MODIFIER_PLAYER_GRANT_SPY' ;

Errors from the database log suggest the table is locked. Is this true or do I just have a SQL error?

[Gameplay]: While executing - 'Select RequirementId from RequirementSetRequirements where RequirementSetId = ?'
[553041.321] [Gameplay] ERROR: database table is locked: RequirementSetRequirements
[553041.321] [Gameplay]: While executing - 'Select RequirementId from RequirementSetRequirements where RequirementSetId = ?'
[553041.479] [Gameplay] ERROR: database table is locked: Modifiers
[553041.479] [Gameplay]: While executing - 'SELECT mods.ModifierId FROM Modifiers mods INNER JOIN TypeTags tags ON mods.ModifierType = tags.Type WHERE tags.Tag = 'DIPLOMACY_MODIFIER''
[553041.479] [Gameplay] ERROR: database table is locked: Modifiers
[
 
Is that all of your code?

Did you for instance set up the Requirement Ids for
REQUIRES_TECHNOLOGY_MASONRY and requirement type for
PLAYER_HAS_MASONRY_TECHNOLOGY
They would need to be added to be referenced.


I believe so although it's possible I missed something elsewhere in the set up. I thought for example that this line would establish a new RequirementID:

INSERT INTO Requirements (RequirementId, RequirementType) VALUES ('REQUIRES_TECHNOLOGY_MASONRY', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY') ;


Is it normal for a database table to be locked to SQL in Civ 5 programming? I don't have a lot of experience with it.
 
added line and altered one, code worked like this for me:

Code:
-- Unique Spy: Unlock at Masonry instead of Castles

-- Create the base requirement and its arguments
INSERT INTO Requirements (RequirementId, RequirementType) VALUES ('REQUIRES_TECHNOLOGY_MASONRY', 'REQUIREMENT_PLAYER_HAS_TECHNOLOGY') ;

INSERT INTO RequirementArguments (RequirementId, Name, Value) VALUES ('REQUIRES_TECHNOLOGY_MASONRY', 'TechnologyType', 'TECH_MASONRY' );

-- Create a requirementset that consists solely of our new requirement
INSERT INTO RequirementSetRequirements (RequirementSetId, RequirementId) VALUES ('PLAYER_HAS_MASONRY_TECHNOLOGY', 'REQUIRES_TECHNOLOGY_MASONRY') ;
INSERT INTO RequirementSets (RequirementSetId, RequirementSetType) VALUES ('PLAYER_HAS_MASONRY_TECHNOLOGY', 'REQUIREMENTSET_TEST_ALL') ;
-- Update Catherine's existing UNIQUE_LEADER_ADD_SPY ability to point to our new requirement set
UPDATE Modifiers SET SubjectRequirementSetId='PLAYER_HAS_MASONRY_TECHNOLOGY' WHERE ModifierID='UNIQUE_LEADER_ADD_SPY' AND ModifierType='MODIFIER_PLAYER_GRANT_SPY' ;
 
Ah ha! You know how sometimes when you stare at something so long you no longer see what you wrote? Obviously I was suffering from that when I wrote this, because I completely forgot to include a RequirementSet. That explains why RequirementSetRequirements was crashing, no RequirementSet existed. Thanks gyogen2 you saved me hours of frustration! I'll be sure to credit you.
 
Back
Top Bottom