Modify saved map to allow mod

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
Slann
Posts: 66
Joined: March 2nd, 2008, 3:47 pm

Modify saved map to allow mod

Post by Slann »

In this case, i'm playing Return From Captivity and wanted to modify a saved file to allow xp modification mod. At first, i created a new map with the mod actived, saved and copied the differences, but this method produced crashes, (maybe because some setup that had to happen at the beggining?). I'd like to know if this change is possible by just modifying the saved file. Thanks
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Modify saved map to allow mod

Post by Ravana »

It should mean finding place where scenario events are, adding those from xp mod, and also all the variables that are usually created from settings.

Adding stuff to scenario before start is much easier, I did it all the time with 1.10 that did not support modifications.
User avatar
Slann
Posts: 66
Joined: March 2nd, 2008, 3:47 pm

Re: Modify saved map to allow mod

Post by Slann »

Ravana wrote:It should mean finding place where scenario events are, adding those from xp mod, and also all the variables that are usually created from settings.

Adding stuff to scenario before start is much easier, I did it all the time with 1.10 that did not support modifications.
So, the question is, how do i add those mods before the map start?
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Modify saved map to allow mod

Post by Ravana »

Code: Select all

#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
#converted to partial macro form in version .3 in order to enable translation
	[set_menu_item]
		id=xp_mod_a
		description=_ "+$hp_amount hp: $hp_cost xp"
		{XP_MOD_MENU $hp_amount $hp_cost hitpoints increase_total {XP_MOD_NOT_DRAIN}}
			[chat]
				speaker=_ "$unit.name the $unit.type"
				message=_ "I spent $hp_cost xp for +$hp_amount hp!"
			[/chat]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$hp_amount hp</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$hp_cost)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_b
		description=_ "+$hp_amount hp: $hp_cost_drainer xp"
		{XP_MOD_MENU $hp_amount $hp_cost_drainer hitpoints increase_total {XP_MOD_DRAIN}}
			[chat]
				speaker=_ "$unit.name the $unit.type"
				message=_ "I spent $hp_cost_drainer xp for +$hp_amount hp!"
			[/chat]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$hp_amount hp</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$hp_cost_drainer)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_c
		description=_ "+$move_amount movement: $move_cost xp"
		{XP_MOD_MENU $move_amount $move_cost movement increase {XP_MOD_NOT_DRAIN}}
			[chat]
				speaker=_ "$unit.name the $unit.type"
				message=_ "I spent $move_cost xp for +$move_amount movement!"
			[/chat]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$move_amount movement</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$move_cost)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_d
		description=_ "+$move_amount movement: $move_cost_drainer xp"
		{XP_MOD_MENU $move_amount $move_cost_drainer movement increase {XP_MOD_DRAIN}}
			[chat]
				speaker=_ "$unit.name the $unit.type"
				message=_ "I spent $move_cost_drainer xp for +$move_amount movement!"
			[/chat]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$move_amount movement</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$move_cost_drainer)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_e
		description=_ "+$damage_amount damage: $damage_cost xp"
		{XP_MOD_MENU $damage_amount $damage_cost attack increase_damage {XP_MOD_NOT_DRAIN}}
			[chat]
				speaker=_ "$unit.name the $unit.type"
				message=_ "I spent $damage_cost xp for +$damage_amount damage!"
			[/chat]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$damage_amount damage</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$damage_cost)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_f
		description=_ "+$damage_amount damage: $damage_cost_drainer xp"
		{XP_MOD_MENU $damage_amount $damage_cost_drainer attack increase_damage {XP_MOD_DRAIN}}
			[chat]
				speaker=_ "$unit.name the $unit.type"
				message=_ "I spent $damage_cost_drainer xp for +$damage_amount damage!"
			[/chat]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$damage_amount damage</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$damage_cost_drainer)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_g
		description=_ "+$strike_amount strike: $strike_cost xp"
		{XP_MOD_MENU $strike_amount $strike_cost attack increase_attacks {XP_MOD_NOT_DRAIN}}
			[chat]
				speaker=_ "$unit.name the $unit.type"
				message=_ "I spent $strike_cost xp for +$strike_amount strike!"
			[/chat]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$strike_amount strike</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$strike_cost)"}
		[/command]
	[/set_menu_item]
	[set_menu_item]
		id=xp_mod_h
		description=_ "+$strike_amount strike: $strike_cost_drainer xp"
		{XP_MOD_MENU $strike_amount $strike_cost_drainer attack increase_attacks {XP_MOD_DRAIN}}
			[chat]
				speaker=_ "$unit.name the $unit.type"
				message=_ "I spent $strike_cost_drainer xp for +$strike_amount strike!"
			[/chat]
			[floating_text]
				[filter]
					id=$unit.id
				[/filter]
				text=_ "<span color='#BCB088'>+$strike_amount strike</span>"
			[/floating_text]
			{MODIFY_UNIT x,y=$x1,$y1 experience "$($MODIFY_UNIT_store[$MODIFY_UNIT_i].experience-$strike_cost_drainer)"}
		[/command]
	[/set_menu_item]
#enddef

#define XP_MOD_START_MSG
	[event]
		name=start
		[message]
			speaker=narrator
			image=portraits/humans/transparent/huntsman.png
			caption=_ "XP Mod"
			message=_ "<i>v.3 by Dovolente - based on work by itota and Nosmos</i>
  
You can spend experience points to buy upgrades for hitpoints, movement, damage, and strikes. <span color='green'>Right click on the unit</span> that has earned enough experience, and the upgrade menu will appear.
 
<i>Note: Upgrading hitpoints doesnt heal the unit. It increases only the max hitpoints.</i>
 
<tt>  <span underline='low'>  Upgrade  |  Standard Cost  | Cost for Drainer </span>
   max hp +$hp_amount |      xp -$hp_cost      |      xp -$hp_cost_drainer
   move +$move_amount   |      xp -$move_cost      |      xp -$move_cost_drainer
   damage +$damage_amount |      xp -$damage_cost     |      xp -$damage_cost_drainer
   strike +$strike_amount |      xp -$strike_cost     |      xp -$strike_cost_drainer</tt>
  
See the <b>Dov MP Pack</b> thread on the official forums (multiplayer board) for info or to give feedback."
		[/message]
	[/event]
#enddef

#define XP_MOD
	[event]
		name=turn 1
            [message]
                speaker=narrator
                message= _ ""
                [option]
                    message="<b><big><span foreground='green'>"+ _ "XP Mod ON"+"</span></big></b>"
                    [command]
						{VARIABLE move_cost 6}
						{VARIABLE move_cost_drainer 9}
						{VARIABLE move_amount 1}
						{VARIABLE hp_amount 4}
						{VARIABLE damage_amount 1}
						{VARIABLE strike_amount 1}
						{VARIABLE hp_cost 6}
						{VARIABLE hp_cost_drainer 9}
						{VARIABLE damage_cost 16}
						{VARIABLE damage_cost_drainer 24}
						{VARIABLE strike_cost 56}
						{VARIABLE strike_cost_drainer 84}
						{XP_MOD_MENU_SETUP}
						{XP_MOD_START_MSG}
                    [/command]
                [/option]
                [option]
                    message="<b><big><span foreground='red'>"+ _ "XP Mod OFF"+"</span></big></b>"
                [/option]
			[/message]
	[/event]
#enddef
+

Code: Select all

{XP_MOD}
Post Reply