ghype's Problems:

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.
Post Reply
User avatar
sergey
Posts: 475
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: 1069
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: 1432
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: 2949
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: 1069
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: 2949
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: 1069
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: 2215
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. :)
User avatar
ghype
Posts: 1069
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: 475
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: 2215
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 ;)
User avatar
Acho161293
Posts: 32
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: 1069
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.
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Coding Problem: Multi-Hex Images

Post by ghype »

Hello there.
So I managed to place multi-hex images and they do appear in the game.
They however disappear once you move the courser over it and reappear once scroll out and back.
What am I missing?

Code: Select all

[terrain_graphics]
    map="
, *, *, *, *
* ,* , *, *, *
, *, *, *, *
* ,* , *, *, *
, *, *, *, *
* ,* , *, *, *
, *, *, *, *
* ,* , *, *, *
, 1, *, *, *  
*, * , *, *, *
, *, *, *, *" 

    [tile]
        pos=1
        type=*^Vytb
        no_flag=overlay
        set_flag=overlay
    [/tile]

    [image]
        name=terrain/scenery/tavern-inside.png
        base=90,190
        center=252,202
        layer=0
    [/image]

    probability=100
[/terrain_graphics]

Code: Select all

{PLACE_IMAGE terrain/scenery/tavern-inside.png 8 21}
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: ghype's Coding Problems

Post by beetlenaut »

The PLACE_IMAGE macro is for adding items to a hex like a storm trident or ring, so that's why it doesn't work now. You should use the map editor to make a map that has your tile in it. You just need the tile at the position marked "1", and the graphics will fill in the rectangle you defined. (You can also use [terrain] inside an event to modify a tile on the running map.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Post Reply