Serp
King
- Joined
- Apr 1, 2015
- Messages
- 666
I think everytime there is a problem with xml or sql code, there won't be any error message and instead the file just stops executing. So it is hard to find errors =/
I'm not that familiar with sql, so I don't know whats wrong with the code...
I would like to add a new promotion to all recon units, except a few specific units:
I think the second code with the trigger contains an error, cause if I put it above the other code, no recon unit gets the new promotion.
I'm not that familiar with sql, so I don't know whats wrong with the code...
I would like to add a new promotion to all recon units, except a few specific units:
Code:
-- Give all recon units PROMOTION_XP_FOR_SCOUTING
INSERT INTO Unit_FreePromotions(UnitType, PromotionType)
SELECT Type, 'PROMOTION_XP_FOR_SCOUTING' FROM Units WHERE CombatClass='UNITCOMBAT_RECON' AND NOT Type='UNIT_EXPLORERX' AND NOT Type='UNIT_ADVENTURER' AND NOT Type='UNIT_AIRSHIP' AND NOT Type='UNIT_SKY_FORTRESS';
-- Update any additional eg. mod recon units to have PROMOTION_XP_FOR_SCOUTING as well
CREATE TRIGGER FreeXpForScouting
AFTER INSERT ON Units
WHEN ('UNITCOMBAT_RECON'=NEW.CombatClass AND NOT 'UNIT_EXPLORERX'=NEW.Type AND NOT 'UNIT_ADVENTURER'=NEW.Type AND NOT 'UNIT_AIRSHIP'=NEW.Type AND NOT 'UNIT_SKY_FORTRESS'=NEW.Type)
BEGIN
INSERT INTO Unit_FreePromotions(UnitType, PromotionType)
VALUES(NEW.Type, 'PROMOTION_XP_FOR_SCOUTING')
END;
I think the second code with the trigger contains an error, cause if I put it above the other code, no recon unit gets the new promotion.