Help for New Abilities and Weapon Specials

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
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Help for New Abilities and Weapon Specials

Post by beetlenaut »

Barbaros wrote: July 25th, 2020, 12:34 pm You're kind of angry
I'm really not. I told you to fix your core files because I didn't want you to have errors that crash the game, and that are hard for us to figure out.
Barbaros wrote: July 25th, 2020, 1:05 pm How would you put your campaigns in order of game difficulty?
Most of DW is not that hard. SotA is pretty hard. TFoB is very hard on nightmare difficulty--even for me.
Barbaros wrote: July 25th, 2020, 12:34 pm I usually make the abilities and specials work at the core of the game, to be available in any campaign.
That's what [modification] is for. There is a list of available modifications under the campaign selection window, and you can turn each one on or off with a checkbox. You put the [modification] in your add-ons folder. You can download a mod that adds unit abilities to see how that is done. If you write a good set of mods, you can even publish them on the server, but not if they are in your core files.

This is an event I wrote that uses [foreach]. It's similar to what you want with purify I think, so you can modify it to create your ability.

Code: Select all

[event]
	name=side turn end
	first_time_only=no

	[store_unit]
		[filter]
			side=$side_number
			status=stunned
		[/filter]
		variable=stunned_units
	[/store_unit]

	[foreach]
		array=stunned_units
		variable=this_stunned_unit
		[do]
			{CLEAR_VARIABLE this_stunned_unit.status.stunned}

			[unstore_unit]
				variable=this_stunned_unit
			[/unstore_unit]
		[/do]
	[/foreach]

	{CLEAR_VARIABLE stunned_units}
[/event]
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

This model of the event will help me a lot, even to solve other things. You have chosen a very simple example to understand. Dude, you're really cool, that's why I keep poking you to talk to me, because it brightens me up.

You have a gift for explaining well, and even an ignorant in programming as I end up understanding.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

If I can achieve something that is really enjoyable to play, I will post it on Wesnoth, but I think that is still far away, I have a lot to learn.

However the abilities and custom specials ready, I can even post the code afterwards for those interested, after ready and well tested.

The strengthening ability was very good, it is even applying the increase in resistances in real time, once Lifepoints reach 50%. This worked better than I expected, which made me very happy!
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

One question, is it possible to program a weapon special that causes negative status in sequence? thus:

1. My unit with the Weapon Special "XXX" attacks or is attacked, then causes Slow Status to the opponent.

2. In another confrontation, if the opponent is still Slow, then it will cause Stunned Status.

3. In a third confrontation, being in Slow and Stunned Status, you will then receive greater damage from that attack.

I tried to do this in the past, but I didn't know how to establish the conditions to work properly, so everything was working all at once, the operation totally broke, then getting very unbalanced.

It is very important for me to respect this sequence.
I just need to know how to establish the conditions.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

This has a multitude of potentials...
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

Ability Grudge - This ability activates when an adjacent friendly unit is eliminated, so the unit with that ability will have an increased attack strength if it battles that same turn.

I'm trying this one right now, but it's not activating...
I thought this would be easy...
kkkkkk :doh:
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Help for New Abilities and Weapon Specials

Post by beetlenaut »

Both of these would need custom variables stored in the units. The variables tell you that you are ready for the next effect in the sequence, or that a friendly unit has been killed. If you don't post the code, there is not much we can do to explain why it's not working.

(We get notifications every time you post, so I just got three of them in a row. You should combine your posts into one. You can always edit a previous post to add more. Double posts are against the rules of the forum anyway.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

I'll post tomorrow, if I haven't been able to finish, I'm going to sleep, good night.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

Here's what I've done with the Grudge Ability:

Code: Select all

#define ABILITY_GRUDGE
    # wmllint: unbalanced-on
    # wmlxgettext: [abilities]
    [damage]
        id=Grudge
        name= _ "Grudge"
        description=_"This ability activates when an adjacent friendly unit is eliminated, so the unit with that ability will have an increased attack strength by 25% if it battles that same turn."
        multiply=1.25
        cumulative=yes
        [filter_self]
            [filter_wml]
                [variables]
                    killed_adjacent_unit
                    is_enemy=no
                [/variables]
            [/filter_wml]
        [/filter_self]
    [/damage]
[/abilities]

[event]
	name=last breath
	first_time_only=no
	id=killed_unit
	[filter]
		[filter_adjacent]
			count=1-6
			is_enemy=no
			ability=Grudge
		[/filter_adjacent]
		canrecruit=no
	[/filter]
	[animate_unit]
		flag=death
		[filter]
			ability=Grudge
			[filter_adjacent]
				id=$unit.id
				is_enemy=no
			[/filter_adjacent]
		[/filter]
		text=_"Grudge!"
		{COLOR_HARM}
		[facing]
			[filter]
				id=$unit.id
			[/filter]
		[/facing]
	[/animate_unit]
	[store_unit]
		[filter]
			x,y=$x1,$y1
		[/filter]
		variable=killed_unit
		kill=yes
	[/store_unit]

[event]
    name=attack end
    first_time_only=yes
    [filter]
        ability=Grudge
    [/filter]

    {CLEAR_VARIABLE killed_unit}

    [unstore_unit]
        variable=unit
        find_vacant=no
    [/unstore_unit]
[/event]
The Game ran normally, but as soon as I put the ability on a unit, I start to receive this error: Unterminated Preprocessor Definition, then the game closes.

I don't understand what is wrong.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Help for New Abilities and Weapon Specials

Post by Pentarctagon »

You're missing the #enddef
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

I gave up on Purified Ability. I had a nervous breakdown and no progress kkkkkkk.
Maybe someday...
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

Pentarctagon wrote: July 29th, 2020, 4:13 pm You're missing the #enddef
Jeez that when I get tired my mind, I make some silly mistakes ...

Now the error is this:

Clear Variable Missing.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Help for New Abilities and Weapon Specials

Post by Pentarctagon »

Are you still making changes within Wesnoth's core files?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Barbaros
Posts: 75
Joined: July 17th, 2020, 7:42 pm

Re: Help for New Abilities and Weapon Specials

Post by Barbaros »

Pentarctagon wrote: July 29th, 2020, 6:01 pm Are you still making changes within Wesnoth's core files?
Yes. Fundamentally because, for example:

I use the Era Reign of the Lords, the additional classes work in the standard game, but the abilities and weapon specials don't work with the core units, and I don't know how to do it in an Era, to make them work.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Help for New Abilities and Weapon Specials

Post by Pentarctagon »

Probably it has something to do with that then - if you weren't modifying the core files you wouldn't get errors like the CLEAR_VARIABLE macro not being defined. Also, your last breath event is missing the closing [/event] tag.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Post Reply