ghype's Coding Problems

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.
sergey
Posts: 98
Joined: January 9th, 2015, 9:25 pm

Re: ghype's Coding Problems - Ability Work Only On Hit

Post by sergey » March 5th, 2019, 8:15 am

Hey ghype.

I coded the "shock on hit" special, but it doesn't work. If the enemy is hit by this weapon, its WML shows that the number of strikes is reduced. But that doesn't change anything, it still uses all its strikes. Perhaps the number of strikes is copied before a combat. In other words, changing the number of strikes in a mid combat doesn't affect the current combat. Or maybe lua can help.

I checked that "swarm" special works the same way. Number of strikes is decreased when unit looses HP, but that doesn't affect the current combat.

Just in case posting the code.
Spoiler:

User avatar
ghype
Posts: 547
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Coding Problems - Ability Work Only On Hit

Post by ghype » March 5th, 2019, 8:36 am

Thanks for you time, I will look into this with the others, maybe they can make it work.
post sprites & stuff every day: ghype's Daily Art
destroying enemy castle here: Orcish Castle - Destroyed - work in progress

gfgtdf
Developer
Posts: 1144
Joined: February 10th, 2013, 2:25 pm

Re: ghype's Coding Problems - Ability Work Only On Hit

Post by gfgtdf » March 5th, 2019, 12:48 pm

the number of strikes is determined when the attack begins, see also issue https://github.com/wesnoth/wesnoth/issues/1362
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

User avatar
Ravana
Moderator
Posts: 2002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ghype's Coding Problems - Ability Work Only On Hit

Post by Ravana » March 5th, 2019, 5:48 pm

That is why I said you would need to manually simulate combat.

User avatar
ghype
Posts: 547
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Coding Problems - Ignore Specific Trait

Post by ghype » March 8th, 2019, 3:30 pm

Very simple. I want a unit to ignore one specific trait which is tis race has defined for it. But i don't want create a new movetype for that one unit only.
Is there an opposite of {MUSTHAVE_TRAIT} like {IGNORE_TRAIT} ?
post sprites & stuff every day: ghype's Daily Art
destroying enemy castle here: Orcish Castle - Destroyed - work in progress

User avatar
Ravana
Moderator
Posts: 2002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: ghype's Coding Problems - Ignore Specific Trait

Post by Ravana » March 8th, 2019, 3:38 pm

Ignore_race_traits and include traits it should have.

User avatar
ghype
Posts: 547
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Coding Problems - Ignore Specific Trait

Post by ghype » March 8th, 2019, 4:05 pm

thanks, that did it!
post sprites & stuff every day: ghype's Daily Art
destroying enemy castle here: Orcish Castle - Destroyed - work in progress

User avatar
The_Gnat
Posts: 1935
Joined: October 10th, 2016, 3:06 am
Contact:

Re: ghype's Coding Problems

Post by The_Gnat » March 8th, 2019, 7:34 pm

Hi ghype,

An even easier way to do this is with a special [attacks] instead of a dummy. This way the reduced strike is actually displayed in the attack menu before the battle begins, unlike if you use an event.

You can find an example if this in my add on under macros/abilities weapons.cfg

I have created my own shock special for one of the units. :)

User avatar
ghype
Posts: 547
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Coding Problems

Post by ghype » March 8th, 2019, 8:00 pm

Oh well that would have saved us a lot of trouble. thanks for pointing this out.
post sprites & stuff every day: ghype's Daily Art
destroying enemy castle here: Orcish Castle - Destroyed - work in progress

sergey
Posts: 98
Joined: January 9th, 2015, 9:25 pm

Re: ghype's Coding Problems

Post by sergey » March 8th, 2019, 8:42 pm

The_Gnat wrote:
March 8th, 2019, 7:34 pm
An even easier way to do this is with a special [attacks] instead of a dummy. This way the reduced strike is actually displayed in the attack menu before the battle begins, unlike if you use an event.

You can find an example if this in my add on under macros/abilities weapons.cfg
The same special was described in the initial comment https://forums.wesnoth.org/viewtopic.ph ... 30#p639118 . The idea was to apply shock only on hit, which is currently impossible.

User avatar
The_Gnat
Posts: 1935
Joined: October 10th, 2016, 3:06 am
Contact:

Re: ghype's Coding Problems

Post by The_Gnat » March 9th, 2019, 3:46 am

@sergey - Thank you for that, I need to read better ;)

Post Reply