Function for acquiring upgrades in-game

Bug #1331628 reported by Andre Novellino Gouvêa on 2014-06-18
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

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

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) on 2015-03-19
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  Edit
Everyone can see this information.

Other bug subscribers