Extra movement for all units

Wolfdog

Unit Butcher
Joined
Jun 29, 2012
Messages
660
Location
Australia
Playing on a large map and finding that it is taking forever to move around the map so I am looking for a sql command that will add +2 movement to every unit.

I do not want to place an entry for every unit so will this work:
UPDATE Units SET Moves = Moves +2 WHERE Type = *

Thanks.
 
If you want to ensure compatibility with any other mods that add units that might be activated AFTER your mod in the load order, you want to also add a triggered version of the command after the regular one, i.e.:
Code:
UPDATE Units SET Moves = Moves + 2;
CREATE TRIGGER ExtraMovement AFTER INSERT ON Units
    BEGIN
    UPDATE Units SET NEW.Moves = NEW.Moves + 2;
    END;
 
Should be Moves = Moves + 2 (not times), but the trigger is wrong, it should only update the newly added row, not all rows

Explorers move 2
Run SQL, explorers move 4
Mod X adds a new unit, all units get two more moves, explorers now move 6
Mod Y adds a new unit, all units get two more moves, explorers now move 8
etc
 
UPDATE Units SET NEW.Moves = NEW.Moves + 2;

will set ALL units to have 2 more moves than standard for the unit being added (or it might just be a syntax error)

UPDATE Units SET Moves = Moves + 2 WHERE ID=NEW.ID;
 
Back
Top Bottom