Fake attack - is this possible?

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
Spannerbag
Posts: 537
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Fake attack - is this possible?

Post by Spannerbag »

Hello,
I'm sure this isn't a new idea so thought I'd ask here first.

What I would ideally like to do is to craft a [fake_attack] tag in lua or failing that implement something in WML.
The logic would utilise (or spoof) a normal attack dialogue.

Ideally the routine would trap a normal attack initiation i.e. when a player selects one of their own units then specifies an enemy unit to attack.
attack_select.png
attack_select.png (177.46 KiB) Viewed 1339 times
attack_dialogue.png
The resulting attack dialogue above would display the unit's normal attacks plus any fake attacks that meet whatever criteria are specified for the fake attack to be active.

Selecting the fake attack would not cause the unit to move towards the enemy unit (if not adjacent) but would instead perform whatever action(s) specified within the logic for that [fake_attack].

The sort of code I'm thinking of is this:

Code: Select all

[fake_attack]
    fake_name=spear
    fake_description=_"spear"
    fake_icon=attacks/spear.png
    fake_type=pierce
    fake_range=melee
    fake_damage=10
    fake_number=3
    [show_if]
      ... conditional WML ...
    [/show_if]
    [command]        # Not really needed
      ... ActionWML ...
    [/command]        # Not really needed
[/fake_attack]
Note that most of these keys are used to populate the fake attack dialogue and could be optional (that might even be desirable in some circumstances?).
Probably only fake_name= will be mandatory so that the fake attack is uniquely identified.
If [show_if] is too awkward to implement the entire fake_name= could, I guess, be contained within an [if] condition?

Typically I suspect the ActionWML will set one or more variables then fire one or more custom events.

I'm sure quite a few UMC creators would find this sort of thing quite useful?
Of course the actual implementation might vary a lot from the idealised case above, but hopefully this explains the spirit of my idea.

So... is this even vaguely feasible or an utter non-starter?

Any comments greatfully received!

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Spannerbag
Posts: 537
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Fake attack - is this possible?

Post by Spannerbag »

Ravana wrote: March 11th, 2024, 4:00 pm https://github.com/wesnoth/wesnoth/issues/4772 is similar.
Hmmm... just put my toe in deep water (for me anyway - I know nothing about the source code).
Will have to do some catching up when I get a decent block of time but my impression so far is that this is at least feasible - though probably not in the form I envisaged...
Thanks for the pointer.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
Post Reply