ChaosRider’s WML questions

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
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need a little help : ).

Post by ChaosRider »

I read it, but I still do not know what to write there was correct.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: I need a little help : ).

Post by Ceres »

For the keys of [multiplayer_side], look at this example and modify it to fit your needs:

Code: Select all

#textdomain wesnoth-multiplayer
[multiplayer_side]
    id=Rebels
    name= _"Rebels"
    image="units/elves-wood/captain.png"
    {MAGENTA_IS_THE_TEAM_COLOR}
    type=Elvish Captain
    leader=Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,White Mage,Red Mage,Elder Wose
    random_leader=Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,White Mage,Red Mage
    recruit=Elvish Fighter,Elvish Archer,Mage,Elvish Shaman,Elvish Scout,Wose,Merman Hunter
    terrain_liked=Ff, Fa, Ss, Ww
    [ai]
        recruitment_pattern=fighter,fighter,archer,archer,mixed fighter,healer,scout
    [/ai]
[/multiplayer_side]
id and name: Well, the name of your faction, name is the displayed name and id is used to identify the faction internally.
image: The image that appears in front of your faction in the faction selection menu
{MAGENTA_IS_THE_TEAM_COLOR}: Simply leave this as it is, it says that the magenta areas on the units sprites are replaced by team colour in-game.
type: default leader
leader: other possible leaders
random_leader: possible leaders when you choose "random leader" in the leader selection menu
recruit: recruit list of this faction
terrain_liked: the AI tries to stay on these terrains (e.g. because of good defences there)
[ai] recruitment_pattern: determindes how the AI will recruit with this faction (i.e. whether it will focus on recruiting ranged attackers or scouts or helaers or whatnot)
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need a little help : ).

Post by ChaosRider »

and what with music and type :P ?
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: I need a little help : ).

Post by Ceres »

music is a relict from older times which would play this piece of music whenever it's this factions turn. It's not documented and I believe it isn't supported anymore, in favor of scenario specific music.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need a little help : ).

Post by ChaosRider »

Post 1:

I'm guessing that this should be so

Code: Select all

[new]

[era]
    id=Chaotic_Era
    name= _ "Chaotic Era"
    [multiplayer_side]
        id=Random
        name={MENU_IMG_TXT "random-enemy.png" _"Random"}
        random_faction=yes
    [/multiplayer_side]
    [multiplayer_side]
        id=Rebels Chaotic
        name={MENU_IMG_TXT "units/elves-wood/fighter.png" (_"Rebels Chaotic")}
        type=
        leader=Elvish Fighter Chaotic,Elvish Archer Chaotic,Mage Chaotic,Elvish Shaman Chaotic,Elvish Scout Chaotic,Wose Chaotic,Merman Hunter Chaotic,Fire Low Guardian Chaotic
        recruit=Elvish Fighter Chaotic,Elvish Archer Chaotic,Mage Chaotic,Elvish Shaman Chaotic,Elvish Scout Chaotic,Wose Chaotic,Merman Hunter Chaotic,Fire Low Guardian Chaotic
        music=
        terrain_liked=Ff, Fa, Ss, Ww
        [ai]
            recruitment_pattern=fighter,fighter,archer,archer,mixed fighter,healer,scout
        [/ai]
    [/multiplayer_side]
	
	[multiplayer_side]
        id=Random
        name=
        random_faction=yes
    [/multiplayer_side]
    [multiplayer_side]
        id=Northerners Chaotic
        name={MENU_IMG_TXT "units/orcs/warrior.png" (_"Northerners Chaotic")}
        type=
        leader=Orcish Grunt Chaotic,Troll Whelp Chaotic,Wolf Rider Chaotic,Orcish Archer Chaotic,Orcish Assassin Chaotic,Naga Fighter Chaotic,Goblin Spearman Chaotic,Low Rat Chaotic,Low Scorpion Chaotic,Tentacle of the Deep Chaotic,Young Ogre Chaotic,Wolf Chaotic
        recruit=Orcish Grunt Chaotic,Troll Whelp Chaotic,Wolf Rider Chaotic,Orcish Archer Chaotic,Orcish Assassin Chaotic,Naga Fighter Chaotic,Goblin Spearman Chaotic,Low Rat Chaotic,Low Scorpion Chaotic,Tentacle of the Deep Chaotic,Young Ogre Chaotic,Wolf Chaotic
        music=
        terrain_liked=Hh, Ha, Mm, Ss
        [ai]
            recruitment_pattern=fighter,fighter,fighter,mixed fighter,archer,scout
        [/ai]
    [/multiplayer_side]
	
	[multiplayer_side]
        id=Random
        name={MENU_IMG_TXT "random-enemy.png" _"Random"}
        random_faction=yes
    [/multiplayer_side]
    [multiplayer_side]
        id=Loyalists Chaotic
        name={"units/human-loyalists/cavalryman.png" (_"Loyalists Chaotic")}
        type=
        leader=Cavalryman Chaotic,Horseman Chaotic,Spearman Chaotic,Fencer Chaotic,Heavy Infantryman Chaotic,Bowman Chaotic,Mage Chaotic,Merman Fighter Chaotic,Low Rat Chaotic,Young Ogre Chaotic,Fire Low Guardian Chaotic,Mudcrawler Chaotic
        recruit=Cavalryman Chaotic,Horseman Chaotic,Spearman Chaotic,Fencer Chaotic,Heavy Infantryman Chaotic,Bowman Chaotic,Mage Chaotic,Merman Fighter Chaotic,Low Rat Chaotic,Young Ogre Chaotic,Fire Low Guardian Chaotic,Mudcrawler Chaotic
        music=
        terrain_liked=Gg, Ww, Wo
        [ai]
            recruitment_pattern=fighter,fighter,fighter,archer,mixed fighter,scout
        [/ai]
    [/multiplayer_side]
	
	[multiplayer_side]
        id=Random
        name={MENU_IMG_TXT "random-enemy.png" _"Random"}
        random_faction=yes
    [/multiplayer_side]
    [multiplayer_side]
        id=Knalgan Alliance Chaotic
        name={MENU_IMG_TXT "units/dwarves/steelclad.png" (_"Knalgan Alliance Chaotic")}
        type=
        leader=Dwarvish Guardsman Chaotic,Dwarvish Fighter Chaotic,Dwarvish Ulfserker Chaotic,Dwarvish Thunderer Chaotic,Thief Chaotic,Poacher Chaotic,Footpad Chaotic,Gryphon Rider Chaotic,Young Ogre Chaotic
        recruit=Dwarvish Guardsman Chaotic,Dwarvish Fighter Chaotic,Dwarvish Ulfserker Chaotic,Dwarvish Thunderer Chaotic,Thief Chaotic,Poacher Chaotic,Footpad Chaotic,Gryphon Rider Chaotic,Young Ogre Chaotic
        music=
        terrain_liked=Hh, Ha, Mm
        [ai]
            recruitment_pattern=fighter,fighter,fighter,mixed fighter,archer,scout
        [/ai]
    [/multiplayer_side]
	
	[multiplayer_side]
        id=Random
        name={MENU_IMG_TXT "random-enemy.png" _"Random"}
        random_faction=yes
    [/multiplayer_side]
    [multiplayer_side]
        id=Drakes Chaotic
        name={MENU_IMG_TXT "units/drakes/burner.png" (_"Drakes Chaotic")}
        type=
        leader=Drake Burner Chaotic,Drake Clasher Chaotic,Drake Glider Chaotic,Drake Fighter Chaotic,Saurian Skirmisher Chaotic,Saurian Augur Chaotic,Fire Low Guardian Chaotic
        recruit=Drake Burner Chaotic,Drake Clasher Chaotic,Drake Glider Chaotic,Drake Fighter Chaotic,Saurian Skirmisher Chaotic,Saurian Augur Chaotic,Fire Low Guardian Chaotic
        music=
        terrain_liked=Hh, Ha, Ds, Ss
        [ai]
            recruitment_pattern=archer,scout,fighter,healer
        [/ai]
    [/multiplayer_side]
	
	[multiplayer_side]
        id=Random
        name={MENU_IMG_TXT "random-enemy.png" _"Random"}
        random_faction=yes
    [/multiplayer_side]
    [multiplayer_side]
        id=Undead Chaotic
        name={MENU_IMG_TXT "units/undead-necromancers/dark-adept.png" (_"Undead Chaotic")}
        type=
        leader=Skeleton Chaotic,Skeleton Archer Chaotic,Walking Corpse Chaotic,Ghost Chaotic,Vampire Bat Chaotic,Dark Adept Chaotic,Ghoul Chaotic
        recruit=Skeleton Chaotic,Skeleton Archer Chaotic,Walking Corpse Chaotic,Ghost Chaotic,Vampire Bat Chaotic,Dark Adept Chaotic,Ghoul Chaotic
        music=
        terrain_liked=Ss, Hh, Ha, Ww
        [ai]
            recruitment_pattern=fighter,fighter,archer,fighter,scout,archer
        [/ai]
    [/multiplayer_side]
[/era]


Post 2:

So what next is needed to do to load this era in wesnoth:)?
Last edited by artisticdude on May 13th, 2012, 12:17 am, edited 1 time in total.
Reason: You seriously need to stop double-posting. Your posts were barely five minutes apart, in this case. Again, use the edit button.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: I need a little help : ).

Post by Ceres »

Create a new folder in userdata/data/add-ons, then put the [era] code in a file called _main.cfg in that folder. Then include all your custom units like this (in your _main.cfg, outside the [era] tag):

Code: Select all

[+units]
	{~add-ons/Chaotic_Era/units} 
[/units]
The above applies if you have put all unit files in a subfolder called "units". If you put them in subsubfolders (like Chaotic_Era/units/Loyalists) you have to include these.
If you did everything right, your era should now appear as a selectable era in the game creation screen.

By the way:
- you have multiple "Random" factions, one is enough
- your factions lack default leaders (the leader that is preselected when you create a game)
- in the "Loyalists Chaotic" faction, you forgot the MENU_IMG_TEXT
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need a little help : ).

Post by ChaosRider »

My era is long Available in a choice of local game, so I refer the impression that you have not understood exactly what I meant in the previous question.
I do not want to know what to do to make it available on the local game (because it's a long time I have), but what to do in order to be uploaded to the server wesnoth.
Files for this I have already done.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: I need a little help : ).

Post by Ceres »

Oh, that's what you meant (well, "load era in wesnoth" isn't very clear).
In that case see PblWML.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need a little help : ).

Post by ChaosRider »

So already I have these files(_server.pbl), but now what with them xD?
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: I need a little help : ).

Post by Ceres »

Start Wesnoth, open the add-ons dialog, scroll down to the bottom where a "Publish Add-on: Chaotic Era" item should be, select it.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

The problem with the path to the cfg file with the skills

Post by ChaosRider »

Is it possible that the cfg file unit was not able to find the path to skills? If so, how you would have to do is to define a code this path in cfg file of this unit?
Because when I run Wesnoth, a local game, it still writes to me that I have not defined the skills included in this unit (where the macro already has a file folder with these skills!).

In macros folder i have abilities.cfg.

The strangest thing about this bug is the fact that:
- The ability / skills in one single file stored with weapon specials
- But the bug disallows me to use this ability in one unit (with its next forms)
- At first I thought that somehow did not see this file abilitie.cfg, but now I'm very in surprise. If I had been right here, then the special weapons that could not be used too for this unit is one (and its next forms).
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

I need help with the creation of codes...

Post by ChaosRider »

I need help with the creation of aura codes for the abilities and specialty weapons.

Below are listed two codes. One is for specialty weapons, and the second for abilities. These codes are presented below gives the person holding it adjacent its units or abilities, or specialty weapons. One is for firststrike (special weapons), the second for the Skirmisher (ability).

The abilities and special weapons such should need to, regeneration, hiding in the night (having the same it will take a similar but hiding in the day), hiding in the forest (when doing this someone could transcribe the codes for the terrain(hills,mountains,etc)), feeding, Berserk , Steadfast, drains (50% hP per hit, 25% per hit - it could be weaker drain),slow,magical, marksman,charge,charge in defense,teleportation. If someone is able to could write.

For special weapons(firststrike):

Code: Select all

#define AURA_INITIATIVE TYPE
[dummy]
	id=initiative
	name= _ "initiative"
	description= _ "Initiative:
Adjacent allies are granted Firststrike with all weapons."
[/dummy]
[/abilities]
	[event]
		name=attack
		first_time_only=no

		[filter]
			[filter_adjacent]
				type={TYPE}
				is_enemy=no
			[/filter_adjacent]
		[/filter]
		
		{FOREACH unit.attack i}
			{VARIABLE unit.attack[$i].specials.firststrike.id "firststrike"}
		{NEXT i}
		
		[unstore_unit]
			variable=unit
		[/unstore_unit]
	[/event]
	[event]
		name=attack
		first_time_only=no

		[filter_second]
			[filter_adjacent]
				type={TYPE}
				is_enemy=no
			[/filter_adjacent]
		[/filter_second]
		
		{FOREACH second_unit.attack i}
			{VARIABLE second_unit.attack[$i].specials.firststrike.id "firststrike"}
		{NEXT i}
		
		[unstore_unit]
			variable=second_unit
		[/unstore_unit]
	[/event]
	[event]
		name=attack_end
		first_time_only=no

		[filter]
			[wml_filter]
				[attack]
					[specials]
						[firststrike]
							id=firststrike
						[/firststrike]
					[/specials]
				[/attack]
			[/wml_filter]
		[/filter]
		
		{FOREACH unit.attack i}
			{CLEAR_VARIABLE unit.attack[$i].specials.firststrike}
		{NEXT i}
		
		[unstore_unit]
			variable=unit
		[/unstore_unit]
	[/event]
	[event]
		name=attack_end
		first_time_only=no

		[filter_second]
			[wml_filter]
				[attack]
					[specials]
						[firststrike]
							id=firststrike
						[/firststrike]
					[/specials]
				[/attack]
			[/wml_filter]
		[/filter_second]
		
		{FOREACH second_unit.attack i}
			{CLEAR_VARIABLE second_unit.attack[$i].specials.firststrike}
		{NEXT i}
		
		[unstore_unit]
			variable=second_unit
		[/unstore_unit]
	[/event]
[+abilities]
#enddef
For ability(skirmisher):

Code: Select all

#define AURA_BLITZ TYPE
[dummy]
	id=blitz	
	name= _ "blitz"
	description= _ "Blitz:
Allies that start their turn adjacent to this unit are granted Skirmisher for that turn."
[/dummy]
[/abilities]
	[event]
		name=side turn
		first_time_only=no
		
		[store_unit]
			[filter]
				
				[wml_filter]
					blitzed=1
				[/wml_filter]
			[/filter]
			variable=blitz_refresh
		[/store_unit]
		
		{FOREACH blitz_refresh i}
			{CLEAR_VARIABLE blitz_refresh[$i].abilities.skirmisher}
			{VARIABLE blitz_refresh[$i].blitzed 0}
			[unstore_unit]
				variable=blitz_refresh[$i]
			[/unstore_unit]
		{NEXT i}

		[store_unit]
			[filter]
				side=$side_number
				[filter_adjacent]
					type={TYPE}
					is_enemy=no
				[/filter_adjacent]
			[/filter]
			variable=blitzed
		[/store_unit]
		
		{FOREACH blitzed i}
			[if]
				[variable]
					name=blitzed[$i].abilities.skirmisher.id
					not_equals="skirmisher"
				[/variable]
				[then]
					{VARIABLE blitzed[$i].blitzed 1}
					{VARIABLE blitzed[$i].abilities.skirmisher.id skirmisher}
					{VARIABLE blitzed[$i].abilities.skirmisher.name "skirmisher"}
					{VARIABLE blitzed[$i].abilities.skirmisher.description  "Skirmisher:
This unit is skilled in moving past enemies quickly, and ignores all enemy Zones of Control."}
					[unstore_unit]
						variable=blitzed[$i]
					[/unstore_unit]
				[/then]
			[/if]
		{NEXT i}
	[/event]
[+abilities]
#enddef

Such written out below, the aura of abilities or special weapons are also useful for other developers to add-ons.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: I need help with the creation of codes...

Post by Dugi »

Why are you listing them here when they're taken from UsefulWMLFragments?
To make some extra abilities/weapon specials, see this post. I want to eventually add the code for more abilities.

To edit some more of them, you can just look into core/macros/abilities and you will figure out almost instantly how to write hiding during daytime, charge in defence and some more others on the list. Also, some useful things are in certain campaigns, such as hiding in the hills in HttT.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: I need help with the creation of codes...

Post by ChaosRider »

Are you able to do poison but without losing 8 hp per round, but losing some % of poisoned unit max hp per round ? Same with aura with this diffrent poison.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: I need help with the creation of codes...

Post by Dugi »

Yes, but that would be quite complicated. The property of poison is that the unit loses 8 hp per turn and it cannot be altered. But you can make an event-based ability that sets a unit's status to toxified=yes, then another event that removes a few points of the every toxified unit's maximum hp each turn, and checks if it is next to a healer or in a village and if it is, the toxification is removed. Try to stick something of that kind together, maybe with some help of this. If you fail, you shall be helped.
Post Reply