Era-of-InvasionS's ability thread

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
User avatar
Dugi
Posts: 4955
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Era-of-InvasionS's ability thread

Post by Dugi »

side=$2? That will do nothing. Write side=$second_unit.side instead.

User avatar
francophone
Posts: 393
Joined: February 20th, 2010, 2:19 pm

Re: Era-of-InvasionS's ability thread

Post by francophone »

dugi wrote:side=$2? That will do nothing. Write side=$second_unit.side instead.
:lol2: side=$2 works. but I replace it with the more formal version.





And so the finish code (if someone want its version of plague):
Spoiler:
Thank you Dugi !
Last edited by francophone on May 15th, 2012, 10:38 pm, edited 1 time in total.

User avatar
Dugi
Posts: 4955
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Era-of-InvasionS's ability thread

Post by Dugi »

No problem, always glad to help.

User avatar
francophone
Posts: 393
Joined: February 20th, 2010, 2:19 pm

Re: Era-of-InvasionS's ability thread

Post by francophone »

I try to improve another skill. It works by directly indicating the value that I want to remove to the unit. But I want this value to be a quarter of the damage of its attack. I did some tests but I have trouble with variable operations (and I find nothing about this in the wiki).
The idea is to store the unit for divide by 4 the damage of the attack. Then use the negative of that value as "amount".
How do I do?

I put the code: The first event (in attack) in the original version that works with directly indicating value (-4). The second event (in defense) is an attempt to improve damage with value = / 4. I multiplied the variables to divide operations, but it does not work at all. I think my writing is completely incorrect, right?
Spoiler:

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Era-of-InvasionS's ability thread

Post by Sapient »

second_weapon and damage_inflicted are automatically stored variables

Code: Select all

amount="-$($second_weapon.damage / 4)"
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
francophone
Posts: 393
Joined: February 20th, 2010, 2:19 pm

Re: Era-of-InvasionS's ability thread

Post by francophone »

it works perfectly (it was so simple). Thank you!

In testing I found a problem:
Capacity "arcane feeding" heal 2 X damage to arcane. It seems I have tested but I possibly only tested the equivalent with fire (it works). As "arcane feeding" is a copy of "fire life" (with changed names, type of attack ... ), there is no reason that it does not work at the same. Yet rather than heals damage 2X, it heals 4X !
I recently added another ability that uses "arcane feeding" as filter. But it is precisely because the function does not work in this case. This is an event with "die". It should not be added to another, does not it?
So, I changed the code of "arcane feeding" macro, so that instead of repeating the heal operation, I double the amount. I have not changed elsewhere. I no longer heal 4X the amount of damage but 2X double the amount.
I take an example: Before when a ghost touch a celest it harms 2 damage, "2" appears in red, then "2" appears in green 4 times. Now after "2" in red, I have 2 times "4" in green. It is so in this macro the problem is (otherwise I would have a "4" and two "2").
Spoiler:
Unit files have this capacity once time.
Who can tell me what causes this doubling effect?

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Era-of-InvasionS's ability thread

Post by Sapient »

When events are included in unit_type, it is prudent to use an id to prevent duplication.
http://wiki.wesnoth.org/EventWML#Event_IDs
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
francophone
Posts: 393
Joined: February 20th, 2010, 2:19 pm

Re: Era-of-InvasionS's ability thread

Post by francophone »

It work correctly by adding an id to the events.
Thank you again Sapient

Still a problem:
"final flourish": When the unit die it explodes its energy, which hurts all those around, including allies. But as arcane heal those of the same race, it is often beneficial to the allies.
And thus the amount of arcane damage is variable and depends on the indication in the file unit.
[abilities]
{ABILITY_FINAL_FLOURISH_DAMAGE (6)}
[/abilities]

I tested with 6. No worries. But now that I insert the file in the fife of lvl 2 (9 damage) and lvl 3 (12), all units inflict 12 damage of arcane.

At worst, I can do three different abilities, each with a fixed damage.
But it would be better to get one ability with the amount selected for each unit.
Spoiler:
Do you see what's wrong and how to fix it?

User avatar
Dugi
Posts: 4955
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Era-of-InvasionS's ability thread

Post by Dugi »

Spoiler:
How about doing it simply so that you don't damage those who have the ability and heal them instead?

Also, you are using a lot of event-based abilities, so I suggest you to stop using this method to load them into the scenario, and to place the events into the era tag (leaving only the dummy tag in the ability macro). You will not have them together, but the code after that the macros are preprocessed will be shorter, they won't need IDs, and it will be easier to add these abilities with objects or advancements.

User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Era-of-InvasionS's ability thread

Post by 8680 »

francophone wrote:But now that I insert the file in the fife of lvl 2 (9 damage) and lvl 3 (12), all units inflict 12 damage of arcane.
Looks like you're using the same id= for all the events. Try id=final flourish {DAMAGE}.

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Era-of-InvasionS's ability thread

Post by Sapient »

Not only that, but you would need to change the ability id as well...

There is another way to do it using a single event, but it would probably be more complicated for you.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
francophone
Posts: 393
Joined: February 20th, 2010, 2:19 pm

Re: Era-of-InvasionS's ability thread

Post by francophone »

dugi wrote:
Spoiler:
How about doing it simply so that you don't damage those who have the ability and heal them instead?
"Acane feeding" depends on the resistence of each unit. Most times it's during an attack. I copy the principle and I can not think in this case avoid damage. But as celests are first damaged before being regenerated twice, I think I will keep the same operating here to be consistent and that the animation remains the same (for the same thing).
If I avoid hurting those with "arcane feeding" (not "final flourish"), I should have amount = inflicted damage (not X2). But there is no damage done. The inflicted damage alows know how much heal according to the resistance to arcane (higher is resistence, less unit absorbs). And therefore, it would not be easier not to hurt units first.

On the other hand I did not understand "amount = $ ({DAMAGE} / 2}" that you add. (?)
dugi wrote:Also, you are using a lot of event-based abilities, so I suggest you to stop using this method to load them into the scenario, and to place the events into the era tag (leaving only the dummy tag in the ability macro). You will not have them together, but the code after that the macros are preprocessed will be shorter, they won't need IDs, and it will be easier to add these abilities with objects or advancements.
I have now 3 ages (era tag) on my era. Soon unbalanced factions will be playable in other ages (somes with celests).


8680 wrote:Looks like you're using the same id= for all the events. Try id=final flourish {DAMAGE}.
Sapient wrote:Not only that, but you would need to change the ability id as well...

There is another way to do it using a single event, but it would probably be more complicated for you.
OK ! And names for have amount in the description of unit.
Now it works good.
I have also remove the sound and put it as die sound of unit (with death animation)
Spoiler:

User avatar
Dugi
Posts: 4955
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Era-of-InvasionS's ability thread

Post by Dugi »

Making it depend on their resistances is hard. You will have to store all adjacent units (variable=hit_ones in my further code here; index is i), check if the unit has the arcane feeding ability (would be easier if all celestials had this ability), and then heal the amount of $({DAMAGE}*$hit_ones[$i].resistances.arcane) to the unit at $hit_ones[$i].x,$hit_ones[$i].y coordinates for each unit if it has the ability, and hurt it in the classical way if it does not.

$ ({DAMAGE} / 2} is a formula. {DAMAGE} is first substituted by the amount of damage it deals when exploding (say, 15 in this case), and then it looks like this $(15/2), and that is 15 divided by 2 and round (actually, I wanted to multiply instead, as you said multiplied by 2).

If you have 3 eras, then simply put all the events in a macro and place the macro into all three eras. It is still preprocessed quicker than if it was in all units.

Good luck.

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Era-of-InvasionS's ability thread

Post by Sapient »

name= _ "final flourish {DAMAGE}"
female_name= _ "female^final flourish {DAMAGE}"
Never put a macro call inside a translateable string: the translation won't work.

Instead you could write something like this:

Code: Select all

name= _ "final flourish ("+{DAMAGE}+")"
female_name= _ "female^final flourish ("+{DAMAGE}+")"
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
francophone
Posts: 393
Joined: February 20th, 2010, 2:19 pm

Re: Era-of-InvasionS's ability thread

Post by francophone »

dugi wrote: If you have 3 eras, then simply put all the events in a macro and place the macro into all three eras. It is still preprocessed quicker than if it was in all units.
It is still preprocessed quicker than if it was in all unit files.

Post Reply