Creating a new ability?
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.
Creating a new ability?
Let me start by saying, this is my first post here, and I'm not even really sure if this is the right forum to post for this kind of question, but I love wesnoth, and it seems like the supporting players are so cool! making new stuff and adding units, factions and all that jazz to the game.
I finally decided to put my skills with pixel art and coding to the test and make another faction....(after my last one was lost with my crashed laptop....)
Things have been going smoothly, but ive hit a bump in development while trying to create a unit that adds one gold to the player's total every time it kills another unit. This is a unit ability not a weapon special, more akin to the "FEEDING" ability rather than something like "BERSERK" or "POISON"
Thanks in advance for any help!
I finally decided to put my skills with pixel art and coding to the test and make another faction....(after my last one was lost with my crashed laptop....)
Things have been going smoothly, but ive hit a bump in development while trying to create a unit that adds one gold to the player's total every time it kills another unit. This is a unit ability not a weapon special, more akin to the "FEEDING" ability rather than something like "BERSERK" or "POISON"
Thanks in advance for any help!
Re: Creating a new ability?
Basically when you need something that isn't directly supported by AbilitiesWML, what you need is to use dummy ability tags to make it look like a normal ability to the player, but then write the actual logic as an event. If you're making a faction, then that means you're making an era, in which case you can just put [event]s directly inside your [era] tag to have them always be inserted into any scenario played using that era.
In this case, what you probably want is something like this:
In this case, what you probably want is something like this:
Code: Select all
[event]
name=die
first_time_only=no
[filter_second]
ability=the_ability_id
[/filter_second]
[gold]
side=$second_unit.side
amount=1
[/gold]
[floating_text]
x,y=$x2,$y2
text= _ "+1 gold"
[/floating_text]
[/event]
Re: Creating a new ability?
Welcome to the forum then!
Maybe this Link: https://wiki.wesnoth.org/WML_Abilities#Pickpocket is useful to you.
There is some code for a "pickpocket" weapon special. There are a couple of more examples, also custom abilities so you might be able to rewrite it as you wish.
Curious to see a new faction arriving in Wesnoth! (:
Maybe this Link: https://wiki.wesnoth.org/WML_Abilities#Pickpocket is useful to you.
There is some code for a "pickpocket" weapon special. There are a couple of more examples, also custom abilities so you might be able to rewrite it as you wish.
Curious to see a new faction arriving in Wesnoth! (:
Developer of Project Haldric
Add-ons: Millennium Era, Vision of a Shaman, A New Home
Art: Bitron's Art Thread
Tools: WML Syntax Highlighter for VS Code
Add-ons: Millennium Era, Vision of a Shaman, A New Home
Art: Bitron's Art Thread
Tools: WML Syntax Highlighter for VS Code
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: Creating a new ability?
well, something like this (not tested though, but it should theoretically work):
Code: Select all
#define ABILITY_INSERTNAMEHERE
# Canned definition of the Feeding ability to be included in an
# [abilities] clause. Note: this is deliberately unbalanced WML,
# in order to close the abilities clause then insert the event
# then reopen the abilities clause.
[dummy]
id=insertnamehere
name= _ "insertnamehere"
female_name= _ "female^insertnamehere"
description=_ "This unit's side gains 1 gold whenever this unit kills another unit."
[/dummy]
# wmlxgettext: [abilities]
[/abilities]
[event]
id=ability_insertnamehere_die
name=die
first_time_only=no
[filter_second]
ability=insertnamehere
[/filter_second]
[unstore_unit]
variable=second_unit
text= _ "<span color='#cccc33'>" + _ "+1 gold" + "</span>"
find_vacant=no
[/unstore_unit]
[gold]
side=$second_unit.side
amount=1
[/gold]
[/event]
[+abilities]
# wmlxgettext: [/abilities]
#enddef
# wmllint: unbalanced-off
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: Creating a new ability?
Thanks for all the quick replies guys!
Honestly the last time I made a faction, I was in high school, my pixel art skills were horrid, and I had no internet, so I had absolutely no intention of sharing the faction I created with anyone else, because of that, my experience with "making a new faction" involved diving into the games core code and changing things directly for my OWN wesnoth files.
Which is technically what I'm doing now too....
I assume if I wanted to share the faction I'm creating now, I should be creating these tags in a different folder?
Forestdragon's ability looks like I can copy and paste it directly into the abilities.cfg, but zookeeper's looks like it belongs in a different file : O
Honestly the last time I made a faction, I was in high school, my pixel art skills were horrid, and I had no internet, so I had absolutely no intention of sharing the faction I created with anyone else, because of that, my experience with "making a new faction" involved diving into the games core code and changing things directly for my OWN wesnoth files.
Which is technically what I'm doing now too....
I assume if I wanted to share the faction I'm creating now, I should be creating these tags in a different folder?
Forestdragon's ability looks like I can copy and paste it directly into the abilities.cfg, but zookeeper's looks like it belongs in a different file : O
Re: Creating a new ability?
Well, there is a "Create" Section here: https://wiki.wesnoth.org/BuildingFactions
This should be exactly what you need to create an own era.
What you also could do is to download some UMC add-ons and look into those files to see how others made them.
EDIT: By default, the folder you are looking for is <<C:\Users\*yourName*\Documents\My Games\Wesnoth1.XX\data\add-ons>>
This should be exactly what you need to create an own era.
What you also could do is to download some UMC add-ons and look into those files to see how others made them.
EDIT: By default, the folder you are looking for is <<C:\Users\*yourName*\Documents\My Games\Wesnoth1.XX\data\add-ons>>
Developer of Project Haldric
Add-ons: Millennium Era, Vision of a Shaman, A New Home
Art: Bitron's Art Thread
Tools: WML Syntax Highlighter for VS Code
Add-ons: Millennium Era, Vision of a Shaman, A New Home
Art: Bitron's Art Thread
Tools: WML Syntax Highlighter for VS Code
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: Creating a new ability?
you don't need to put it into the mainline file. that would be it only work for you. you should make a file like that for your add-on specifically.Mmetafour wrote:Forestdragon's ability looks like I can copy and paste it directly into the abilities.cfg, but zookeeper's looks like it belongs in a different file : O
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
Re: Creating a new ability?
Thanks again for the quick replies guys!
Forest, that strip of code worked out perfectly : D
Heres a little something I've been working on today, Image for one of the base units in the faction
Forest, that strip of code worked out perfectly : D
Heres a little something I've been working on today, Image for one of the base units in the faction
- ForestDragon
- Posts: 1771
- Joined: March 6th, 2014, 1:32 pm
- Location: Ukraine
Re: Creating a new ability?
I suggest posting these images in the Art Workshop thread (that way it'll be easier for people to notice them, and you'll be able get some feedback/praise about them.). Looks very good, btw. Feeling quite hyped for the faction itself.
My active add-ons: The Great Steppe Era,XP Bank,Alliances Mod,Pestilence,GSE+EoMa,Ogre Crusaders,Battle Royale,EoMaifier,Steppeifier,Hardcoreifier
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic
My inactive add-ons (1.12): Tale of Alan, The Golden Age
Co-creator of Era of Magic