Function for acquiring upgrades in-game

Bug #1331628 reported by Andre Novellino Gouvêa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stratagus
Fix Released
Undecided
cybermind

Bug Description

Attached to this report is a patch that creates a Lua function for acquiring upgrades during a game (using DefineAllow during a game didn't apply the appropriate modifiers).

The function is called "AcquireUpgrade" and takes two arguments: the first argument is the number of the player who will acquire the upgrade, and the second argument is the upgrade's ident.

Related branches

Revision history for this message
Andre Novellino Gouvêa (andre-ng) wrote :
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

Revision history for this message
cybermind (iddqd-mail) wrote :

I have made a more universal function in SetPlayerData - "Allow" (same, as in your "Allow" from GetPlayerData) in rev. 8930

Changed in stratagus:
status: New → Fix Committed
assignee: nobody → cybermind (iddqd-mail)
cybermind (iddqd-mail)
Changed in stratagus:
status: Fix Committed → Fix Released
milestone: none → 2.3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.