Ravana's Multiplayer Works

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

User avatar
Ravana
Forum Moderator
Posts: 3175
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Ravana's Multiplayer Works

Post by Ravana »

Ravana = Laela
List of addons I have uploaded and to which current server and their status:
Laela-Uesmae's_MPmaps 1.12 [Abandoned]
Orocia Random Mod 1.14 1.15 [Actively maintained]
Royal Rumble Updated 1.14 [Passively maintained]
XP Modification 1.14 1.15 [Maintained/complete]
Color Modification 1.14 1.15 [Maintained]
Ally Village Modification 1.14 1.15 [Maintained/complete]
Hide Faction Choice 1.12 [Abandoned, addon requested by someone else]
Recruit Level Limit 1.12 [Abandoned, addon requested by someone else]
Switch Leader 1.14 1.15 waiting on https://github.com/wesnoth/wesnoth/issues/4325 [Maintained]
Ageless Era - post everything to http://forums.wesnoth.org/viewtopic.php?f=19&t=25274
Most of my addons can also be found from https://github.com/ProditorMagnus


Post your suggestions and feedback here, new ideas are welcome as well.
Last edited by Ravana on April 20th, 2015, 8:46 am, edited 6 times in total.
Knutor
Posts: 10
Joined: August 19th, 2013, 5:47 pm

Re: Laela's Multiplayer Works

Post by Knutor »

Ya. 3p Colosseum works. Its very fun, I've made a variant, and have been trying to upload it onto Add-Ons, maybe you could include it in your pack.. dunno how. Thanks, Knutor
User avatar
Ravana
Forum Moderator
Posts: 3175
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Laela's Multiplayer Works

Post by Ravana »

For wesnoth 1.11+ version i can include other variants as options, i suppose you changed waves?
User avatar
Ravana
Forum Moderator
Posts: 3175
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Ravana's Multiplayer Works

Post by Ravana »

Updated first post.
Generous
Posts: 47
Joined: July 4th, 2011, 7:28 am

Re: Ravana's Multiplayer Works

Post by Generous »

Hi Ravana, I have a problem with XP Modification 2.0.0 in Wesnoth 1.12.0 (Mac platform, if that matters here)

When I try to upgrade the unit for XP (e.g. +1 movement) I get a following error:

Code: Select all

<Lua error> [string " ..."]:9: bad argument #1 to 'message' (string expected, got userdata)
stack traceback:
     [C]: in function 'message'
     [string " ..."]:9: in function 'bytecode'
     .../Wesnoth.app/Contents/Resources/.//data/lua/wml-tags.lua:277: in function 'cmd'
     .../Wesnoth.app/Contents/Resources/.//data/lua/wml-tags.lua:277: in function
  <.../Wesnoth.app/Contents/Resources/.//data/lua/wml-tags.lua:284>
Although it appears that unit upgraded fine, this error is very annoying. Please reproduce and fix it ;)
User avatar
Ravana
Forum Moderator
Posts: 3175
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Ravana's Multiplayer Works

Post by Ravana »

With windows I am unable to replicate this. I havent ever used mac.

Try again after replacing macros/xp.cfg with

Code: Select all

#textdomain wesnoth-XP_Modification

#define XP_MOD_DRAIN
#filter by zookeeper via itota
	[filter_wml]
		[attack]
			[specials]
				[drains]
					id=drains
				[/drains]
			[/specials]
		[/attack]
	[/filter_wml]
#enddef

#define XP_MOD_NOT_DRAIN
#by itota
	[not]
		{XP_MOD_DRAIN}
	[/not]
#enddef

#define XP_MOD_MENU AMOUNT COST APPLICATION ADJUSTMENT FILTER
	[show_if]
		[have_unit]
			x,y=$x1,$y1
			side=$side_number
			formula="experience >= {COST}"
			[and]
				{FILTER}
			[/and]
		[/have_unit]
	[/show_if]
	[command]
		[sound]
			name=fanfare-short.wav
		[/sound]
		[object]
			silent=yes
			[filter]
				x,y=$x1,$y1
				side=$side_number
			[/filter]
			[effect]
				apply_to={APPLICATION}
				{ADJUSTMENT}={AMOUNT}
			[/effect]
		[/object]
#enddef

#define XP_MOD_MENU_SETUP
	[set_menu_item]
		id=xp_mod_a
		description=_ "+$Rav_XP_hp_amount hp: $Rav_XP_hp_cost xp"
		{XP_MOD_MENU $Rav_XP_hp_amount $Rav_XP_hp_cost hitpoints increase_total {XP_MOD_NOT_DRAIN}}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_hp_cost"
					local up_amount = wesnoth.get_variable "Rav_XP_hp_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " hp!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_hp_amount hp</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_hp_cost)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_b
		description=_ "+$Rav_XP_hp_amount hp: $Rav_XP_hp_cost_drainer xp"
		{XP_MOD_MENU $Rav_XP_hp_amount $Rav_XP_hp_cost_drainer hitpoints increase_total {XP_MOD_DRAIN}}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_hp_cost_drainer"
					local up_amount = wesnoth.get_variable "Rav_XP_hp_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " hp!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_hp_amount hp</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_hp_cost_drainer)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_c
		description=_ "+$Rav_XP_move_amount movement: $Rav_XP_move_cost xp"
		{XP_MOD_MENU $Rav_XP_move_amount $Rav_XP_move_cost movement increase {XP_MOD_NOT_DRAIN}}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_move_cost"
					local up_amount = wesnoth.get_variable "Rav_XP_move_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " movement!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_move_amount movement</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_move_cost)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_d
		description=_ "+$Rav_XP_move_amount movement: $Rav_XP_move_cost_drainer xp"
		{XP_MOD_MENU $Rav_XP_move_amount $Rav_XP_move_cost_drainer movement increase {XP_MOD_DRAIN}}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_move_cost_drainer"
					local up_amount = wesnoth.get_variable "Rav_XP_move_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " movement!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_move_amount movement</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_move_cost_drainer)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_e
		description=_ "+$Rav_XP_damage_amount damage: $Rav_XP_damage_cost xp"
		{XP_MOD_MENU $Rav_XP_damage_amount $Rav_XP_damage_cost attack increase_damage {XP_MOD_NOT_DRAIN}}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_damage_cost"
					local up_amount = wesnoth.get_variable "Rav_XP_damage_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " damage!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_damage_amount damage</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_damage_cost)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_f
		description=_ "+$Rav_XP_damage_amount damage: $Rav_XP_damage_cost_drainer xp"
		{XP_MOD_MENU $Rav_XP_damage_amount $Rav_XP_damage_cost_drainer attack increase_damage {XP_MOD_DRAIN}}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_damage_cost_drainer"
					local up_amount = wesnoth.get_variable "Rav_XP_damage_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " damage!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_damage_amount damage</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_damage_cost_drainer)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_g
		description=_ "+$Rav_XP_strike_amount strike: $Rav_XP_strike_cost xp"
		{XP_MOD_MENU $Rav_XP_strike_amount $Rav_XP_strike_cost attack increase_attacks {XP_MOD_NOT_DRAIN}}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_strike_cost"
					local up_amount = wesnoth.get_variable "Rav_XP_strike_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " strike!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_strike_amount strike</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_strike_cost)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_h
		description=_ "+$Rav_XP_strike_amount strike: $Rav_XP_strike_cost_drainer xp"
		{XP_MOD_MENU $Rav_XP_strike_amount $Rav_XP_strike_cost_drainer attack increase_attacks {XP_MOD_DRAIN}}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_strike_cost_drainer"
					local up_amount = wesnoth.get_variable "Rav_XP_strike_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " strike!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_strike_amount strike</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_strike_cost_drainer)"}
		[/command]
	[/set_menu_item]
#enddef
Let me know if that helps.
Generous
Posts: 47
Joined: July 4th, 2011, 7:28 am

Re: Ravana's Multiplayer Works

Post by Generous »

I didn't understood clearly how to apply this patch. So I tried it in two ways, and :
1) If I replace the whole xp.cfg file with your change, I get:

Code: Select all

The following add-on had errors and could not be loaded: XP Modification
Please report this to the author or maintainer of this add-on. Details:
    Unterminated preprocessor definition
    at ~add-ons/XP_Modification/macros/xp.cfg:13
        included from ~add-ons/XP_Modification/_main.cfg:4
2) If I replace only a "header" of file (by removing #enddef line which comes directly after the change:

Code: Select all

The following add-on had errors and could not be loaded: XP Modification
Please report this to the author or maintainer of this add-on. Details:
     Macro/file 'XP_MOD_NOT_DRAIN' is missing
    at ~add-ons/XP_Modification/macros/xp.cfg:54
        included from ~add-ons/XP_Modification/_main.cfg:4
        included from ~add-ons/XP_Modification/mods/xp_mod.cfg:83
        included from ~add-ons/XP_Modification/_main.cfg:5
User avatar
Ravana
Forum Moderator
Posts: 3175
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Ravana's Multiplayer Works

Post by Ravana »

1.1) Was the right way, do the same with this.
1.2) Header? The thing that is actually relevant is wesnoth.message(tostring(unit_name),tostring(up_cost)), but replacing entire file is easier.

Make sure you get all 252 lines of this.

Code: Select all

#textdomain wesnoth-XP_Modification

#define XP_MOD_DRAIN
#filter by zookeeper via itota
	[filter_wml]
		[attack]
			[specials]
				[drains]
					id=drains
				[/drains]
			[/specials]
		[/attack]
	[/filter_wml]
#enddef

#define XP_MOD_NOT_DRAIN
#by itota
	[not]
		{XP_MOD_DRAIN}
	[/not]
#enddef

#define XP_MOD_MENU AMOUNT COST APPLICATION ADJUSTMENT FILTER
	[show_if]
		[have_unit]
			x,y=$x1,$y1
			side=$side_number
			formula="experience >= {COST}"
			[and]
				{FILTER}
			[/and]
		[/have_unit]
	[/show_if]
	[command]
		[sound]
			name=fanfare-short.wav
		[/sound]
		[object]
			silent=yes
			[filter]
				x,y=$x1,$y1
				side=$side_number
			[/filter]
			[effect]
				apply_to={APPLICATION}
				{ADJUSTMENT}={AMOUNT}
			[/effect]
		[/object]
#enddef

#define XP_MOD_MENU_SETUP
	[set_menu_item]
		id=xp_mod_a
		description=_ "+$Rav_XP_hp_amount hp: $Rav_XP_hp_cost xp"
		{XP_MOD_MENU $Rav_XP_hp_amount $Rav_XP_hp_cost hitpoints increase_total {XP_MOD_NOT_DRAIN}}
		{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_hp_cost)"}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_hp_cost"
					local up_amount = wesnoth.get_variable "Rav_XP_hp_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " hp!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_hp_amount hp</span>"
			[/floating_text]
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_b
		description=_ "+$Rav_XP_hp_amount hp: $Rav_XP_hp_cost_drainer xp"
		{XP_MOD_MENU $Rav_XP_hp_amount $Rav_XP_hp_cost_drainer hitpoints increase_total {XP_MOD_DRAIN}}
		{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_hp_cost_drainer)"}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_hp_cost_drainer"
					local up_amount = wesnoth.get_variable "Rav_XP_hp_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " hp!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_hp_amount hp</span>"
			[/floating_text]
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_c
		description=_ "+$Rav_XP_move_amount movement: $Rav_XP_move_cost xp"
		{XP_MOD_MENU $Rav_XP_move_amount $Rav_XP_move_cost movement increase {XP_MOD_NOT_DRAIN}}
		{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_move_cost)"}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_move_cost"
					local up_amount = wesnoth.get_variable "Rav_XP_move_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " movement!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_move_amount movement</span>"
			[/floating_text]
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_d
		description=_ "+$Rav_XP_move_amount movement: $Rav_XP_move_cost_drainer xp"
		{XP_MOD_MENU $Rav_XP_move_amount $Rav_XP_move_cost_drainer movement increase {XP_MOD_DRAIN}}
		{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_move_cost_drainer)"}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_move_cost_drainer"
					local up_amount = wesnoth.get_variable "Rav_XP_move_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " movement!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_move_amount movement</span>"
			[/floating_text]
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_e
		description=_ "+$Rav_XP_damage_amount damage: $Rav_XP_damage_cost xp"
		{XP_MOD_MENU $Rav_XP_damage_amount $Rav_XP_damage_cost attack increase_damage {XP_MOD_NOT_DRAIN}}
		{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_damage_cost)"}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_damage_cost"
					local up_amount = wesnoth.get_variable "Rav_XP_damage_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " damage!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_damage_amount damage</span>"
			[/floating_text]
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_f
		description=_ "+$Rav_XP_damage_amount damage: $Rav_XP_damage_cost_drainer xp"
		{XP_MOD_MENU $Rav_XP_damage_amount $Rav_XP_damage_cost_drainer attack increase_damage {XP_MOD_DRAIN}}
		{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_damage_cost_drainer)"}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_damage_cost_drainer"
					local up_amount = wesnoth.get_variable "Rav_XP_damage_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " damage!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_damage_amount damage</span>"
			[/floating_text]
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_g
		description=_ "+$Rav_XP_strike_amount strike: $Rav_XP_strike_cost xp"
		{XP_MOD_MENU $Rav_XP_strike_amount $Rav_XP_strike_cost attack increase_attacks {XP_MOD_NOT_DRAIN}}
		{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_strike_cost)"}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_strike_cost"
					local up_amount = wesnoth.get_variable "Rav_XP_strike_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " strike!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_strike_amount strike</span>"
			[/floating_text]
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_h
		description=_ "+$Rav_XP_strike_amount strike: $Rav_XP_strike_cost_drainer xp"
		{XP_MOD_MENU $Rav_XP_strike_amount $Rav_XP_strike_cost_drainer attack increase_attacks {XP_MOD_DRAIN}}
		{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$Rav_XP_strike_cost_drainer)"}
			[lua]
				code = << 
					local unit_name = wesnoth.get_variable "unit.name"
					local unit_id = wesnoth.get_variable "unit.type"
					local language_name = wesnoth.unit_types[unit_id].name
					unit_name = unit_name .. " the " .. tostring(language_name)
					local up_cost = wesnoth.get_variable "Rav_XP_strike_cost_drainer"
					local up_amount = wesnoth.get_variable "Rav_XP_strike_amount"
					up_cost = "I spent " .. up_cost .. " xp for +" .. up_amount .. " strike!"
					wesnoth.message(tostring(unit_name),tostring(up_cost))
				>>
			[/lua]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$Rav_XP_strike_amount strike</span>"
			[/floating_text]
		[/command]
	[/set_menu_item]
#enddef
Dealt with some of 2) too, I suspect error halts current command.

I suspect you lost some of my posted code as line 13 is [/filter_wml]
Generous
Posts: 47
Joined: July 4th, 2011, 7:28 am

Re: Ravana's Multiplayer Works

Post by Generous »

sorry Ravana, my scrollbar in browser was invisible until move, so I didn't realise there's much more code than I see...

After trying your code from last message, seems the "Lua error" disappeared and everything is working fine now :D
Btw, after further testing it looks like "Lua error" happened only to units (leaders) who are "Anonymous Local Player".
The best way to reproduce this error was to create a Local Match ;)
User avatar
Ravana
Forum Moderator
Posts: 3175
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Ravana's Multiplayer Works

Post by Ravana »

Uploaded this change then.

That might actually be reason why I didnt notice it, I use that gametype only for testing, and then with debug mode; and these tests I did on server so no debug mode for getting xp, so I used berserker on weak leader and upgraded that. Still added to changelog as Mac problem.
Generous
Posts: 47
Joined: July 4th, 2011, 7:28 am

Re: Ravana's Multiplayer Works

Post by Generous »

Default prices in XP Modification

Using find/grep commands , spreadsheets and text tools, I have calculated the average damage-attack properties of weapon:

:eng: units taken from two very popular eras, values rounded

Code: Select all

Average val |  DMG  -  ATK  |
Default era | 8.988 - 2.887 | 
Ageless era | 9.096 - 2.932 |
(very similar values between eras ;) )

Judging by these results: for a balance, extra attack should be in ~3.108 times more expensive than extra damage point :

Code: Select all

16 EXP points (current default price of DMG ) * 3.108 = 49.72
Please decrease a default price of extra ATK to 50 EXP points (instead of 56)

===

Regaring HP default price: 6 EXP for 4 HP - without healing - is good :) check a spoiler if you're interested
Spoiler:
Regarding MP default price: 6 EXP for 1 MP is too low... probably should be twice as high as it costs currently :
Spoiler:
User avatar
Ravana
Forum Moderator
Posts: 3175
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Ravana's Multiplayer Works

Post by Ravana »

I agree about MP. That one is difficult to get right though, I suspect I need to leave quite large slider there.

However the damage~strike relation seems fine as it it, because you choose strikes when you want more chances to do any damage, even if average damage would benefit less. Then again there are both 70/1 and 2/20 attacks...
Generous
Posts: 47
Joined: July 4th, 2011, 7:28 am

Re: Ravana's Multiplayer Works

Post by Generous »

I agree that more attacks could be better in many situations when you need more chances to do any damage...
However, there are many other situations, where more damage gives more benefit than more attacks. Examples:

1) There's an enemy unit with 9 hp left, no resistances vs blade/pierce, and standing on 40% defence terrain.
You could either attack it with orc grunt or goblin. Without considering hitpoints of your units:

Code: Select all

chances to kill with orc grunt (9-2 weapon) : 84%
chances to kill with goblin    (6-3 weapon) : 64.8%
orc grunt's chance for success is 84%/64.8% = 1.3x times higher, thanks to more damage ;)

Now, imagine that this enemy unit has a strong melee attack, and your units' health is not high...
Orc grunt would be able to kill this powerful unit with a less chance to suffer from a powerful counter-attack (which could be deadly)

2) Unit with a higher damage suffers less from a mass assault of weak troops, because its able to kill them faster than a unit with more attacks

3) About archers: if you want to attack a unit which has enslow range weapon (e.g. elf shaman) you would prefer a high damage than more attacks


On top of that, upgrading damage is easier and gives you advantage faster.
Imagine there is a unit with 9-3 weapon (this weapon is very close to average values)

If it chooses to upgrade damage, it would:
*) upgrade to 10-3 then fight for some time (easier to fight than with 9-3)
*) upgrade to 11-3 then fight for some time again (easier to fight than with 10-3)
*) and, finally, upgrade to 12-3
Total price: 48 EXP with default settings

If it chooses to upgrade attack:
***) need to fight for more than 3x longer time, and only then upgrade to 9-4
Total price: 56 EXP with default settings

As you see, for this close-to-average-unit, upgrading damage was not just cheaper but also more efficient :
with damage upgrades, this unit was able to get advantage from upgrades faster - which increased a chance for eventual success

===

I realize that, for those units who are 70/1 or 2/20, this change won't make a difference.
But, if extra attack would cost 50 EXP by default, it would be more balanced on average.
Otherwise - for more than 50% of units it would be more efficient to upgrade damage rather than attacks, which means imbalance.
Although an imbalance in this case is not very noticeable (50 EXP vs 56 EXP is just 12% difference) its not good either

===

Btw it would be nice if those sliders would have a smaller steps for adjustment (+- 2 EXP instead of +- 4 EXP)
I cant set up 12 EXP price for movement, only 10 EXP or 14 EXP. Same problem with other upgrades
User avatar
Ravana
Forum Moderator
Posts: 3175
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Ravana's Multiplayer Works

Post by Ravana »

I am still not convinced there is need to change strikes default. Just like with default era, it is what people use if they have nothing better. The whole point of this addon is to encourage people use different settings than default. If damage is more effective to upgrade then by all means choose that, eventually strike starts giving more. As I see little benefit in lowering strikes cost I leave it as is, as it has been since before I started playing.

I do not understand what you say about sliders. Movement step there is 1 not 4.

Code: Select all

[slider]
			id=Rav_XP_move_cost
			default=6
			min=4
			max=10
			step=1
			name=_"MP cost"
			description=_"XP required to upgrade movement"
		[/slider]
Only strikes have step of 4.
Last edited by Ravana on February 8th, 2015, 9:14 pm, edited 1 time in total.
Generous
Posts: 47
Joined: July 4th, 2011, 7:28 am

Re: Ravana's Multiplayer Works

Post by Generous »

Sorry for confusion: I was unable to set up 12 EXP price for movement not because a step here is +- 4 (its indeed 1), but because max available value is 10....
Also it would be nice if a step for strike would be 2 instead of 4
Post Reply