formula help for a weapon special needed

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.
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: formula help for a weapon special needed

Post by newfrenchy83 »

i only the opponent of omner must takes the damage then you must use apply_to=opponent

Code: Select all

 [drains]
        id=TEST_reflect
        name= _ "reflect"
        description= _ "When this attack hits it harms the caster."
        value=-100
        apply_to=opponent
    [/drains]
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: formula help for a weapon special needed

Post by Adamant14 »

newfrenchy83 wrote: January 11th, 2021, 10:43 pm i only the opponent of omner must takes the damage then you must use apply_to=opponent

Code: Select all

 [drains]
        id=TEST_reflect
        name= _ "reflect"
        description= _ "When this attack hits it harms the caster."
        value=-100
        apply_to=opponent
    [/drains]
I don't know why, but that doesn't work either.
In my tests, the defender sometimes remains undamaged, but most of the time he takes damage, sometimes he takes even more damage than the attacker.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: formula help for a weapon special needed

Post by newfrenchy83 »

wuld you said what specials must active in defense only, then you must add active_on=defense in code

Code: Select all

 [drains]
        id=TEST_reflect
        name= _ "reflect"
        description= _ "When this attack hits it harms the caster."
        value=-100
        apply_to=opponent
        active_on=defense
    [/drains]
if i undestand, the 'defender' for you, is the owner of special when he is in defense, this is an error, when yiu use appply_to=defender, the effect are applied to unit in defense, what he own special or not, same for apply_to=attacker.
explication
apply_to=self , applied to owner to special(value by default)
apply_to=opponent, to opponent to owner
apply_to=both, both owner and opponent
apply_to=attacker,defender applied to unit who attack/defend same if not owner of special
active_on=offense,defense active in offense/defense only
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: formula help for a weapon special needed

Post by newfrenchy83 »

and the attacker is unit who begin the fight
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: formula help for a weapon special needed

Post by Adamant14 »

newfrenchy83 wrote: January 12th, 2021, 12:15 pm if i understand, the 'defender' for you, is the owner of special when he is in defense, ...
Correct

Looks like [drains] misses sometimes, even at value=100, and maybe that's why it doesn't work.

After adding a [chance_to_hit] =100 it seems to work passably:

Code: Select all

#define WEAPON_SPECIAL_REFLECT_TEST
    [drains]
        id=TEST_reflect
        name= _ "reflect"
        description= _ "When this attack hits it harms the caster."
        value=100
        apply_to=self
        active_on=defense
    [/drains]
    [chance_to_hit]
        id=TEST_reflect_m
        value=100
        cumulative=no
    [/chance_to_hit]
#enddef
I still have to test a little, but maybe I found what I was looking for. I thank you all for your ideas and your support.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: formula help for a weapon special needed

Post by newfrenchy83 »

i think what refection was only when attack hit, not when attack misses the cible? the description said what attack refected when attack hit the target, for me what attack don't reflected when attack misses must be normal.
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: formula help for a weapon special needed

Post by newfrenchy83 »

then for you reflect must activate when owner hit this opponent when he is on defense, i believed what it was when the opponent hit the owner what he was harmed with damage= damge what he was inflicted to owner of special, with the code what you use, it ismore a drains 100% WHO HEAL the owner what drains -100% who harm opponent
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: formula help for a weapon special needed

Post by newfrenchy83 »

I'll recap what you're trying to describe:

1. When the owner of this weapon hits his target, he receives damage equal to that he inflicted on his opponent.

2. This only happens when the owner has to defend himself.

3. the attack must hit the mark every time, in defense only or also in attack? if in defense only then

Code: Select all

#define WEAPON_SPECIAL_REFLECT_TEST
    [drains]
        id=TEST_reflect
        name= _ "reflect"
        description= _ "When this attack hits it harms the caster." #it not said what it is in defense only, and it is WHEN the attack hit
        value=-100 #if value positive, caster will be healed instead of harmed
        apply_to=self
        active_on=defense #why in defense only? it is not in description
    [/drains]
    [chance_to_hit]
        id=TEST_reflect_m
        value=100
        cumulative=no
        active_on=defense
    [/chance_to_hit]
#enddef
you will be rewrite description, else the player will believe what special work in defense and in offense
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: formula help for a weapon special needed

Post by Adamant14 »

newfrenchy83 wrote: January 12th, 2021, 2:11 pm i think what refection was only when attack hit, not when attack misses the cible?
Yes.
newfrenchy83 wrote: January 12th, 2021, 2:11 pm the description said what attack refected when attack hit the target, for me what attack don't reflected when attack misses must be normal.
Yes.
newfrenchy83 wrote: January 12th, 2021, 2:19 pm then for you reflect must activate when owner hit this opponent when he is on defense,
special owner is the defender, not the attacker.
newfrenchy83 wrote: January 12th, 2021, 2:19 pm i believed what it was when the opponent hit the owner what he was harmed with damage= damge what he was inflicted to owner of special
That is exactly what it should do.
newfrenchy83 wrote: January 12th, 2021, 2:19 pm ...it ismore a drains 100% WHO HEAL the owner what drains -100% who harm opponent
I don't understand what you mean here.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: formula help for a weapon special needed

Post by newfrenchy83 »

what is your native langage?
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: formula help for a weapon special needed

Post by Adamant14 »

newfrenchy83 wrote: January 12th, 2021, 2:50 pm I'll recap what you're trying to describe:

1. When the owner of this weapon hits his target, he receives damage equal to that he inflicted on his opponent.
That's right, but not the attacker has the weapon special (reflect), but the defender.

newfrenchy83 wrote: January 12th, 2021, 2:50 pm 2. This only happens when the owner has to defend himself.
Yes, the defender reflects the attack of the attacker. With help of the weapon special he reflects all the taken damage back to the attacker.

newfrenchy83 wrote: January 12th, 2021, 2:50 pm 3. the attack must hit the mark every time, in defense only or also in attack?
In defence only.

newfrenchy83 wrote: January 12th, 2021, 2:50 pm description= _ "When this attack hits it harms the caster." #it not said what it is in defense only, and it is WHEN the attack hit
Right, I have to change that.

newfrenchy83 wrote: January 12th, 2021, 2:50 pm value=-100 #if value positive, caster will be healed instead of harmed
No, because not the attacker has the special, but the defender.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
newfrenchy83
Code Contributor
Posts: 165
Joined: October 6th, 2017, 12:57 pm

Re: formula help for a weapon special needed

Post by newfrenchy83 »

you should stop using the terms attacker and defender in special weapon descriptions and use the terms owner and opponent, and when I see the code you wrote for the weapon, did you realize that when the user hits their target, it is then healed while you seem to describe the weapon as having to inflict damage on the enemy of that user (for me 'caster' means the owner of the special weapon, but you seem to refer to caster as the enemy owner)?

The life drain is used by the vampire bats to recover half of the damage inflicted on their opponent for this heal but in this case the drains does not inflict damage by itself, it exploits the damage inflicted to heal its user.

whichever you describe reflect, I understand this as the fact that the 'caster' injures itself even by hurting its target, in this case you should use apply_to = opponent and value = -100 otherwise using [drains] does not match what you seem to want to do.

active_on = defense means that it is during the turn of the enemy of the owner of the weapon that this one is activated, is that how you understood it?

In your response, I would like you to clearly describe the function of the special and tell me if:
1 the weapon works as you want
2. if not, what's the problem?
Post Reply