Comment 2 for bug 1331628

Revision history for this message
Andre Novellino Gouvêa (andre-ng) wrote :

Improved version of this code, as discussed in the Stratagus conference:

https://dl.dropboxusercontent.com/u/1732902/Wyrmsun/Stratagus%20Patch/script_player.cpp
https://dl.dropboxusercontent.com/u/1732902/Wyrmsun/Stratagus%20Patch/upgrade.cpp

This makes the upgrade be acquired or lost through the SetPlayerData function (via "HasUpgrade")‏, and the UpgradeLost function now works properly, reversing the upgrade's modifiers accordingly‏.

Example of how this would be used through Lua:
SetPlayerData(0, "HasUpgrade", "upgrade-dwarven-broad-axe", true) -- makes player 0 acquire the dwarven broad axe upgrade