[BNW] Looking to make custom trait and unit ability...

JRabes

Chieftain
Joined
Nov 30, 2018
Messages
1
I'm making a custom civ, and want to give it a custom trait and ability for it's unit.
The trait would be +1% science for each unique luxury resource.
The ability would be to the knight, where it would gain additional attack power when near other knights.

How would I go about doing either of these?
 
Both of them would require lua coding in combination with some form of dummy building for the science effect, and probably a promotion for the Knight's combat effect.

The lua script would add or remove dummy buildings as needed to create the correct science % effect. For an experienced lua modder it would not be terribly difficult to achieve.

The lua script would also add or remove the promotion as the Knight unit moved around the game-map, and would probably be both fairly complicated and laggy in terms of the amount of processing needed which might then cause discernable game-lag as the units moved. The problem is that the code for the Knight units would have to run for every unit of every player for every move around the game-map made. Even if code-methods were used to do nothing if the unit that is moving is not the correct unit or does not belong to the correct player, there would still be a minimum amount of code executed each and every time any unit moved. If it were me I would not add or remove the promotion to the Knights in "real time", I would add or remove as part of turn processing so that the requirement would be the unit needed to start its turn near another Knight -- this would eliminate the issues with potential lag from all the processing needed as a unit made a move around the map.
 
Top Bottom