Any way to change damage type vs specific opponent?

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

Any way to change damage type vs specific opponent?

Post by Spannerbag »

I'm tweaking an item in my UMC and decided it'd be great for game balancing if it did a different damage type (arcane rather than impact) against certain unittypes (mudcrawler variants to be precise). It already has additional effects against these unittypes but I cannot see any any (easy) way to implement a temporary change to damage type. Simply modifiying damage is an option but I'd prefer to preserve existing attack damage and temporarily change the attack type if possible, hence this post :)

Damage type seems to only be modifiable via [effect] so I was wondering if some sort of short lifetime (for a single melee combat to be specific) [object] could be wrapped around [effect]?

I could, I suppose, use [event] to [modify_unit] prior to an attack vs appropriate unittypes then restore the original damage type post-combat using logic similar to the force chance to hit macro. But I'd prefer a more elegant method, if there is one.

I had thought maybe [effect] [set_specials] [damage] with [filter_opponent] might do the trick, but [damage] does not seem to support changing damage type.

I do have various ideas and work-arounds but ideally I'd like to have this neatly wrapped up inside an [effect] if at all possible.

Am I missing something? Happy to use lua if that's an option.

Thanks in advance for any advice!

Cheers,
--Spannerbag
UMC Campaign: After EI
I suspect the universe is simpler than we think and stranger than we can know.
User avatar
Celtic_Minstrel
Developer
Posts: 1915
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Any way to change damage type vs specific opponent?

Post by Celtic_Minstrel »

You could always add an [object] in attack start and remove it in attack end. That wouldn't allow the AI to understand it and would probably break the attack prediction dialog too, but I think it would make it function.

I don't know of any way that supports AI and attack prediction, but if any such thing exists, it would not use [effect].
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.
User avatar
Spannerbag
Posts: 209
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Any way to change damage type vs specific opponent?

Post by Spannerbag »

Celtic_Minstrel wrote: August 2nd, 2022, 5:47 pm You could always add an [object] in attack start and remove it in attack end. That wouldn't allow the AI to understand it and would probably break the attack prediction dialog too, but I think it would make it function.

I don't know of any way that supports AI and attack prediction, but if any such thing exists, it would not use [effect].
Many thanks for the information, much appreciated.
I've been testing simply multiplying the damage and for simplicity I'll use that, given the alternatives.
I think if I add many more events to this campaign my computer will melt... :)

Cheers!
--Spannerbag
UMC Campaign: After EI
I suspect the universe is simpler than we think and stranger than we can know.
User avatar
Ravana
Forum Moderator
Posts: 2579
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Any way to change damage type vs specific opponent?

Post by Ravana »

There are multiple options with different side effects.
1) event based way mentioned before
2) define custom damage type where resistance defaults to impact, but for specific units you change their resistance https://wiki.wesnoth.org/UnitsWML#.5Bre ... efaults.5D
3) give your unit 2 attacks with different damage types, possibly with filter that either can only be used against correct enemies
User avatar
Spannerbag
Posts: 209
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Any way to change damage type vs specific opponent?

Post by Spannerbag »

Ravana wrote: August 3rd, 2022, 12:20 am There are multiple options with different side effects.
1) event based way mentioned before
2) define custom damage type where resistance defaults to impact, but for specific units you change their resistance https://wiki.wesnoth.org/UnitsWML#.5Bre ... efaults.5D
3) give your unit 2 attacks with different damage types, possibly with filter that either can only be used against correct enemies
Wow, I like #2 :D

Many thanks for your post, very enlightening!

However, I've playtested a simple x3 damage multiplier and (so far) it produces results very close to what I wanted.
That said, I'll certainly keep your suggestions in mind!

Thanks again for the advice, much appreciated.

Cheers,
--Spannerbag
UMC Campaign: After EI
I suspect the universe is simpler than we think and stranger than we can know.
Post Reply