Help for New Abilities and Weapon Specials
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.
- beetlenaut
- Developer
- Posts: 2814
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Help for New Abilities and Weapon Specials
It doesn't really. This page on WFL says that when you divide two integers, the result is also an integer. To match a unit at half health or below, the page suggests this form:lhybrideur wrote: ↑July 21st, 2020, 11:00 am You might be able to do it the other way around for it to be clearer, if it accepts doubles.
hitpoints <= max_hitpoints / 2
. That's the clearest option in my opinion.I'm a little confused about why you ask in the forum to see if something works instead of trying it to see if it works. Trying it would usually be a lot faster. But, if something is not listed as a possible key in the wiki, it's not valid and will be ignored. In this case, "poison" is the only status variable listed for [regenerate], so the other variables would have to be set in an event.
(You should keep in mind that double posting is technically against the rules around here.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: Help for New Abilities and Weapon Specials
Code: Select all
#define SECOND_ATTACK
{VARIABLE_OP unit.attacks_left add 1}
[set_variables]
name=unit.variables
mode=merge
[value]
double_attack_attacked=yes
double_attack_turn=$turn_number
[/value]
[/set_variables]
[unstore_unit]
text= _ "double attack"
{COLOR_HARM}
variable=unit
[/unstore_unit]
#enddef
#define WEAPON_SPECIAL_LAST_RESORT
# wmlxgettext: [attack]
# wmlxgettext: [specials]
[dummy]
id=last resort
name= _ "Last Resort"
description= _ "This unit can attack two enemies in one turn with a minimum of 50% accuracy and an additional 25% of damage, only if 25% or less of your HP or less remains, but cannot move from a hex, where the first enemy was attacked."
name_inactive= _ "Last Resort"
description_inactive="This unit can attack two enemies in one turn with a minimum of 50% accuracy and an additional 25% of damage, only if 25% or less of your HP or less remains, but cannot move from a hex, where the first enemy was attacked."
[/dummy]
[chance_to_hit]
value=50
cumulative=yes
[filter_self]
formula="max_hitpoints / hitpoints >= 4"
[/filter_self]
[/chance_to_hit]
[damage]"
multiply=1.25
apply_to=self
[filter_self]
formula="max_hitpoints / hitpoints >= 4"
[/filter_self]
[/damage]
[/specials]
[/attack]
[event]
name=attack_end
id=eoma_doubleattack_event
first_time_only=no
[filter_attack]
special=last resort
[filter_self]
formula="max_hitpoints / hitpoints >= 4"
[/filter_self]
[/filter_attack]
[if]
{VARIABLE_CONDITIONAL unit.variables.double_attack_attacked boolean_not_equals yes}
[then]
{SECOND_ATTACK}
[/then]
[else]
[if]
{VARIABLE_CONDITIONAL unit.variables.double_attack_turn not_equals $turn_number}
[then]
{SECOND_ATTACK}
[/then]
[/if]
[/else]
[/if]
[/event]
[+attack]
[+specials]
# wmlxgettext: [/specials]
# wmlxgettext: [/attack]
#enddef
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
Re: Help for New Abilities and Weapon Specials
beetlenaut, you seem to think that i come to post my doubts here at every step. when I come it’s because everything I’ve tried has failed, so have a little patience man.
About the "Last Resort" ability, the code I posted now to ask, is already different than it was before, and it still doesn't work as it should, so technically I haven't posted the same thing twice. And I'm already thinking about giving up this code. I'm just seeing if someone gives me hope.
About the "Last Resort" ability, the code I posted now to ask, is already different than it was before, and it still doesn't work as it should, so technically I haven't posted the same thing twice. And I'm already thinking about giving up this code. I'm just seeing if someone gives me hope.
Last edited by Barbaros on July 24th, 2020, 2:44 am, edited 1 time in total.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
- beetlenaut
- Developer
- Posts: 2814
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Help for New Abilities and Weapon Specials
You have a similar problem to the previous one. You do not see [filter_self] listed under [filter_attack] (in the wiki), so it is being ignored there. To filter on a unit in an event, you use just [filter].
OK, sorry. But, you did ask if it would work. If you had asked why it had failed, I wouldn't have assumed you hadn't tried it.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: Help for New Abilities and Weapon Specials
My native language is Portuguese, maybe I didn't know how to express myself correctly. I have a lot of vacant time here in Brazil, since because of the pandemic, they kicked me from work kkkkkkkk. So I try to program the skills for most of the day, so I decided to sign up for the forum, because I'm still inexperienced. Sorry if I'm being a bore.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
Re: Help for New Abilities and Weapon Specials
I'm trying to study here: https://wiki.wesnoth.org/FilterWML/Exam ... use_Filter
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
Re: Help for New Abilities and Weapon Specials
I am unable to run the event for my "Purified" ability.
I'm getting this error:
Error loading custom game configuration files. The game will try without loading add-ons.
Details:
Macro/file 'CLEAR_VARIABLE' is missing
at core/macros/abilities.cfg:607
included from core/_main.cfg:18
included from _main.cfg:18
Then the game closes.
I don't know what's wrong with the code, if anyone knows, I would like some help.
This code was based on the "slow inmune" ability, which eliminates the slowed status at the end of the attack. The "slow inmune" ability works in my game.
Here is the event:
I'm getting this error:
Error loading custom game configuration files. The game will try without loading add-ons.
Details:
Macro/file 'CLEAR_VARIABLE' is missing
at core/macros/abilities.cfg:607
included from core/_main.cfg:18
included from _main.cfg:18
Then the game closes.
I don't know what's wrong with the code, if anyone knows, I would like some help.
This code was based on the "slow inmune" ability, which eliminates the slowed status at the end of the attack. The "slow inmune" ability works in my game.
Here is the event:
Code: Select all
[event]
name=side turn
first_time_only=no
[filter_attack]
special=slow
special=petrify
special=incinerate
special=maims
special=ROL_ensnare
special=ROL_kick_stun
[/filter_attack]
[filter_second]
ability=purified
[/filter_second]
{CLEAR_VARIABLE second_unit.status.petrified}
{CLEAR_VARIABLE second_unit.status.slowed}
{CLEAR_VARIABLE second_unit.status.incinerated}
{CLEAR_VARIABLE second_unit.status.maimed}
{CLEAR_VARIABLE second_unit.status.stunned}
{CLEAR_VARIABLE second_unit.status.ensnared}
[unstore_unit]
variable=second_unit
find_vacant=no
[/unstore_unit]
[/event]
[event]
name=side turn
first_time_only=no
[filter_second_attack]
special=slow
special=petrify
special=incinerate
special=maims
special=ROL_ensnare
special=ROL_kick_stun
[/filter_second_attack]
[filter]
ability=purified
[/filter]
{CLEAR_VARIABLE second_unit.status.petrified}
{CLEAR_VARIABLE second_unit.status.slowed}
{CLEAR_VARIABLE second_unit.status.incinerated}
{CLEAR_VARIABLE second_unit.status.maimed}
{CLEAR_VARIABLE second_unit.status.stunned}
{CLEAR_VARIABLE second_unit.status.ensnared}
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[/event]
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
Re: Help for New Abilities and Weapon Specials
Everything happened to me today trying to program it, work partially, have no effect, and now you don't want to open the game kkkkkkk
What a failure!
It is very difficult to learn this, even studying on the wiki and on the website, it is exceeding my expectations of how complex it was...
What a failure!
It is very difficult to learn this, even studying on the wiki and on the website, it is exceeding my expectations of how complex it was...
Last edited by Barbaros on July 25th, 2020, 4:34 am, edited 1 time in total.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
- Pentarctagon
- Project Manager
- Posts: 5526
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Help for New Abilities and Weapon Specials
CLEAR_VARIABLE does definitely exist, so I'm not sure what could've happened to make Wesnoth not able to find it.
Beyond that, there's no automatically stored unit in a side turn event, so the filters and unstoring second_unit won't do anything.
Beyond that, there's no automatically stored unit in a side turn event, so the filters and unstoring second_unit won't do anything.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Help for New Abilities and Weapon Specials
This is Slow Inmune below; I wanted to modify it to make Purified, but after about 10 hours of trying, I'm frustrated, and I couldn't make it work...Pentarctagon wrote: ↑July 25th, 2020, 4:34 am CLEAR_VARIABLE does definitely exist, so I'm not sure what could've happened to make Wesnoth not able to find it.
Beyond that, there's no automatically stored unit in a side turn event, so the filters and unstoring second_unit won't do anything.
Code: Select all
#define ELE_ABILITY_SLOW_IMMUNE
[dummy]
id=ELE_slow_immune
name= _ "massive"
description= _ "This unit is so big that it can not be slowed for long."
[/dummy]
[/abilities]
[event]
name=attack end
first_time_only=no
[filter_attack]
special=slow
[/filter_attack]
[filter_second]
ability=slow_immune
[/filter_second]
{CLEAR_VARIABLE second_unit.status.slowed}
[unstore_unit]
variable=second_unit
find_vacant=no
[/unstore_unit]
[/event]
[event]
name=attack end
first_time_only=no
[filter_second_attack]
special=slow
[/filter_second_attack]
[filter]
ability=slow_immune
[/filter]
{CLEAR_VARIABLE unit.status.slowed}
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[/event]
[+abilities] # wmlxgettext: [/abilities]
#enddef
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
Re: Help for New Abilities and Weapon Specials
I'm out of ideas...
I'm just a little bit better than a beginner.
Of course if he is a very smart beginner, then he will make me eat dust kkkkk.
I'm just a little bit better than a beginner.
Of course if he is a very smart beginner, then he will make me eat dust kkkkk.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
Re: Help for New Abilities and Weapon Specials
With some help from here I have already achieved some things. I'm very grateful.
It seems to me that I have a very long learning curve ahead of me.
Beetlenaut, you still haven't complained about me... 5, 4, 3, 2, 1 ... kkkkk
It seems to me that I have a very long learning curve ahead of me.
Beetlenaut, you still haven't complained about me... 5, 4, 3, 2, 1 ... kkkkk
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
- beetlenaut
- Developer
- Posts: 2814
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Help for New Abilities and Weapon Specials
About the game closing: It looks like you might be changing the core game files. If you are doing that, you can expect this kind of crash. You should only be changing files your add-ons directory. If you did change some core files, reinstall the originals. If you didn't change core files, show us the whole file that has these two events, and tell us what folder it's in.
The code you posted for slow_immune looks OK except for one thing: The events filter for the ability "slow_immune", but the ability has the id of "ELE_slow_immune", which is different. Also, if I understand purified correctly, the code for slow_immune will not be similar. Purified needs just one side_turn event. In that event, you need to store all the units with that ability and loop through them with [foreach], fixing the status variables of each one.
The code you posted for slow_immune looks OK except for one thing: The events filter for the ability "slow_immune", but the ability has the id of "ELE_slow_immune", which is different. Also, if I understand purified correctly, the code for slow_immune will not be similar. Purified needs just one side_turn event. In that event, you need to store all the units with that ability and loop through them with [foreach], fixing the status variables of each one.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: Help for New Abilities and Weapon Specials
I usually make the abilities and specials work at the core of the game, to be available in any campaign. I have a lot of them working. In my experience, it is not doing it in the main file that causes the problem. And you have just confirmed that it is my code that is useless. As soon as I removed it from the file the game became normal. Here and there, the abilities and specials that I put on give some error, but as a rule, I almost always manage to correct. And sometimes I really have to give up.beetlenaut wrote: ↑July 25th, 2020, 6:44 am About the game closing: It looks like you might be changing the core game files. If you are doing that, you can expect this kind of crash. You should only be changing files your add-ons directory. If you did change some core files, reinstall the originals. If you didn't change core files, show us the whole file that has these two events, and tell us what folder it's in.
The code you posted for slow_immune looks OK except for one thing: The events filter for the ability "slow_immune", but the ability has the id of "ELE_slow_immune", which is different. Also, if I understand purified correctly, the code for slow_immune will not be similar. Purified needs just one side_turn event. In that event, you need to store all the units with that ability and loop through them with [foreach], fixing the status variables of each one.
I think this ability must be beyond my knowledge to program.
PS: [foreach]: Não consegui entender como usar isso nem estudando. I'm hopeless already for Purified, I do not know how to program the event.
Thanks for the correction of Slow Immune, it was copied and pasted from a campaign, so I didn't check it well. It works, but sometimes it feels like it's kind of weird. It will be very good now.
You're kind of angry, but it helps me a lot. As a rule, anyone who plays Wesnoth always has a good heart.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.
Re: Help for New Abilities and Weapon Specials
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients
How would you put your campaigns in order of game difficulty?
I like to play in ascending order.
I already wanted to start one of them for the next game before coming to the forum.
The Founding of Borstep
Secrets of the Ancients
How would you put your campaigns in order of game difficulty?
I like to play in ascending order.
I already wanted to start one of them for the next game before coming to the forum.
If from 15 to 30 years old, you have not been successful in life, you are already doomed.