Skip to content

Commit

Permalink
add difficulcy level slider to dark forecast mp scenario
Browse files Browse the repository at this point in the history
unfortunateley the 'description' (the tooltip of the widget in the mp
configure dialog) doesn't show in current master. This is likeley to be
a bug related to gui internals.
  • Loading branch information
gfgtdf committed Feb 18, 2016
1 parent f507418 commit 39eb8fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions data/multiplayer/scenarios/2p_Dark_Forecast.cfg
Expand Up @@ -234,4 +234,15 @@ The weather will also change randomly, affecting the layout of the map.
message= _ "The enemy cheers as a dark mist rises from the land, engulfing you. As ghostly wisps drain away your will, you realize that your time in this land is over."
[/message]
[/event]
[options]
[slider]
id = "enemey_gold_factor"
default = 0
min = -30
max = 30
step = 10
name = "Difficulty"
description = "Changes the gold worth of the enemy spawns by a certain perentage"
[/slider]
[/options]
[/multiplayer]
3 changes: 2 additions & 1 deletion data/multiplayer/scenarios/2p_Dark_Forecast.lua
Expand Up @@ -100,6 +100,7 @@ end
-- @a base_gold_amount, gold_increment: used to cauculate the amount of gold available for each timed spawn
-- @a units_amount, gold_per_unit_amount: used to cauculate the number of units spawned in each timed spawn
local function create_timed_spaws(interval, num_spawns, base_gold_amount, gold_increment, units_amount, gold_per_unit_amount)
local configure_gold_factor = (wesnoth.get_variable("enemey_gold_factor") + 100)/100
local final_turn = math.ceil(((num_spawns - 1) * interval + 40 + wesnoth.random(2,4))/2)
local end_spawns = 0
for spawn_number = 1, num_spawns do
Expand Down Expand Up @@ -128,7 +129,7 @@ local function create_timed_spaws(interval, num_spawns, base_gold_amount, gold_i
wesnoth.set_variable("timed_spawn[" .. (spawn_number - 1) .. "]", {
units = math.ceil(units),
turn = turn,
gold = gold,
gold = helper.round(gold * configure_gold_factor),
})
else
wesnoth.set_variable("timed_spawn[" .. (spawn_number - 1) .. "]", {
Expand Down

0 comments on commit 39eb8fe

Please sign in to comment.