In general, scripting is a poor way to handle traits. The problem is that the only way to give a character a trait from inside a script is via the give_trait console command. However, this requires that your script knows the name of the character it wants to give the trait to. But there is usually no way for the script to know with certainty the names of characters existing in the game.
There are only two situations in which giving traits from a script is more or less entirely predictable. The first is when a script is run just prior to the first turn of the game, as when specified in descr_strat.txt. In this case you know the name of every character in the game. The second case is immediately after a character has been spawned by a script, because the script names him. Even this case is a bit problematic, since a character by that same name may already exist. When two characters have the same name, it's usually not clear which will get the trait.
Bookmarks