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

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

Post by sergey »

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:
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.

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

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

Post by ghype »

Thanks for you time, I will look into this with the others, maybe they can make it work.

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

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

Post by gfgtdf »

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
Forum Moderator
Posts: 2380
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

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

Post by Ravana »

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

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

Re: ghype's Coding Problems - Ignore Specific Trait

Post by ghype »

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} ?

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

Re: ghype's Coding Problems - Ignore Specific Trait

Post by Ravana »

Ignore_race_traits and include traits it should have.

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

Re: ghype's Coding Problems - Ignore Specific Trait

Post by ghype »

thanks, that did it!

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

Re: ghype's Coding Problems

Post by The_Gnat »

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. :)
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon
Co-designer of the (not-wesnoth) space combat video game Planet Bounce.

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

Re: ghype's Coding Problems

Post by ghype »

Oh well that would have saved us a lot of trouble. thanks for pointing this out.

User avatar
sergey
Posts: 455
Joined: January 9th, 2015, 9:25 pm

Re: ghype's Coding Problems

Post by sergey »

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.
Author of SP scenario Dragon Fight and SP campaign Captured by a Nightmare.
Created The Rise of Wesnoth (alternative mechanics) version of the mainline campaign.

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

Re: ghype's Coding Problems

Post by The_Gnat »

@sergey - Thank you for that, I need to read better ;)
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon
Co-designer of the (not-wesnoth) space combat video game Planet Bounce.

User avatar
Acho161293
Posts: 31
Joined: January 29th, 2020, 10:54 am
Location: indonesian
Contact:

Re: ghype's Coding Problems

Post by Acho161293 »

Add this text " hp_bar_scaling=0.01 " to unit type / unit.cfg
Example=

[unit_type]
id=absalom
name="Absalom"
race=undead
gender=male
image="absalom/absalom1.png"
profile="absalom/absalom1.png"
hitpoints=43
hp_bar_scaling=0.01 (PUT IN HERE AND IT IS WORK)

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

Re: ghype's Coding Problems

Post by ghype »

Acho161293 wrote:
February 6th, 2020, 11:31 pm
Add this text " hp_bar_scaling=0.01 " to unit type / unit.cfg
Thanks, but this one was already fixed.

Post Reply