Antimagic (Impassable for magicians) Terrain Overlay/Damage type immunity/antimagic Aura
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.
Antimagic (Impassable for magicians) Terrain Overlay/Damage type immunity/antimagic Aura
Hey,
I would like to create a few effects concerning antimagic. First I will have a lot of general questions. I am not looking for a full answer (which would be nice as well), but rather for a: "Take a look at campaign xyz that did something similar" or "read about xyz-WML"
Impassable terrain only for creatures with magical attacks
Creatures shall not be able to pass terrain with the "Beam of Light" overlay when they have magical attacks. Instead they shall say a message like: "I cannot pass this barrier!" and lose all their mp. (Later on I will probably create a custom terrain type for that, but I need to start somewhere; It will be an antimagic stone in the end and not light)
Creatures that can only be destroyed by using the antimagic attack (and therefore are immune to every other attack)
The bigbadevilguy will have a far-range fireball attack. So far I plan to simply create a fireball unit (with skirmisher) that dies whenever it successfully damages anyone and cannot be harmed except by "antimagic" attacks. It will only have 1HP so an antimagic attack most insta-kills it. On the other hand it deals heavy damage once it finds its target (I still have to design the targeting mechanism, but that's a different question)
Antimagic-Aura
By picking up a certain antimagic stone or by being an antimagician one gets a special kind of leadership ability that halfs all magic damage by units (friend and foe) around you
As soon as I have more information I will start posting more detailed questions and also present my minimal solutions/attempts for each single problem, but I thought it might be helpful for me to just express my ideas first, so that more experienced users can give me a bit of direction where to look and what to read.
I would like to create a few effects concerning antimagic. First I will have a lot of general questions. I am not looking for a full answer (which would be nice as well), but rather for a: "Take a look at campaign xyz that did something similar" or "read about xyz-WML"
Impassable terrain only for creatures with magical attacks
Creatures shall not be able to pass terrain with the "Beam of Light" overlay when they have magical attacks. Instead they shall say a message like: "I cannot pass this barrier!" and lose all their mp. (Later on I will probably create a custom terrain type for that, but I need to start somewhere; It will be an antimagic stone in the end and not light)
Creatures that can only be destroyed by using the antimagic attack (and therefore are immune to every other attack)
The bigbadevilguy will have a far-range fireball attack. So far I plan to simply create a fireball unit (with skirmisher) that dies whenever it successfully damages anyone and cannot be harmed except by "antimagic" attacks. It will only have 1HP so an antimagic attack most insta-kills it. On the other hand it deals heavy damage once it finds its target (I still have to design the targeting mechanism, but that's a different question)
Antimagic-Aura
By picking up a certain antimagic stone or by being an antimagician one gets a special kind of leadership ability that halfs all magic damage by units (friend and foe) around you
As soon as I have more information I will start posting more detailed questions and also present my minimal solutions/attempts for each single problem, but I thought it might be helpful for me to just express my ideas first, so that more experienced users can give me a bit of direction where to look and what to read.
- lhybrideur
- Posts: 369
- Joined: July 9th, 2019, 1:46 pm
Re: Antimagic (Impassable for magicians) Terrain Overlay/Damage type immunity/antimagic Aura
For 2, I would create an ability with a [resistance][filter_weapon]special_id=magical if you are using 1.15
Otherwise, I would use a dummy ability and an event
For 3, there is pretty much that in LotI
Otherwise, I would use a dummy ability and an event
Code: Select all
#define ABILITY_IMMUNE
[dummy]
id=immune
name= _ "immune"
description= _ "This unit can only be hurt by antimagic damages."
[/dummy]
#enddef
[event]
name=attack
first_time_only=no
[filter_attack]
[not]
special=antimagic
[/not]
[/filter_attack]
[filter_second]
ability=immune
[/filter_second]
[store_unit]
[filter]
x,y=$x2,$y2
[/filter]
variable=immunised
[/store_unit]
{VARIABLE immunised.status.not_living yes}
[unstore_unit]
variable=immunised
find_vacant=no
advance=no
[/unstore_unit]
[/event]
Code: Select all
#define ABILITY_ANTIMAGIC INTENSITY
[resistance]
id=antimagic
add={INTENSITY}
max_value=80
name= _ "antimagic ("+{INTENSITY}+_")"
female_name= _ "female^antimagic ("+{INTENSITY}+_")"
description= _ "This unit's presence weakens surrounding magic, increasing resistances of oneself and any nearby units by "+{INTENSITY}+_"%, up to a maximum of 80%."
affect_self=yes
affect_allies=yes
affect_enemies=yes
apply_to=fire,cold,arcane
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[/affect_adjacent]
[filter_base_value]
less_than=80
[/filter_base_value]
[/resistance]
#enddef
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Antimagic (Impassable for magicians) Terrain Overlay/Damage type immunity/antimagic Aura
I think this is best done with a custom terrain archetype. I'll go into more details on that later, short on time right now.JustNatan wrote: ↑March 1st, 2021, 12:33 pm Impassable terrain only for creatures with magical attacks
Creatures shall not be able to pass terrain with the "Beam of Light" overlay when they have magical attacks. Instead they shall say a message like: "I cannot pass this barrier!" and lose all their mp. (Later on I will probably create a custom terrain type for that, but I need to start somewhere; It will be an antimagic stone in the end and not light)
For this I would suggest a custom damage type. The fireball would have immunity to the core damage types but no resistance to the antimagic damage type. You can then use movetype patching to set all other units to be immune to antimagic attacks, or you could set it so their antimagic resistance is based on their arcane resistance.JustNatan wrote: ↑March 1st, 2021, 12:33 pm Creatures that can only be destroyed by using the antimagic attack (and therefore are immune to every other attack)
The bigbadevilguy will have a far-range fireball attack. So far I plan to simply create a fireball unit (with skirmisher) that dies whenever it successfully damages anyone and cannot be harmed except by "antimagic" attacks. It will only have 1HP so an antimagic attack most insta-kills it. On the other hand it deals heavy damage once it finds its target (I still have to design the targeting mechanism, but that's a different question)
The example posted by Ihybrideur is a possible interpretation, but personally I don't think it's a very good one. Fire and cold attacks are not necessarily magical, after all. I believe it's possible to create an ability that halves the damage taken when attacked by a weapon with the "magical" special ability, which might be closer to what you want.
Re: Antimagic (Impassable for magicians) Terrain Overlay/Damage type immunity/antimagic Aura
I use 1.15 @lhybrideur I don't get your solution for 2, but I understand your approach for 3.
I would prefer it if the solution for 3 checks for "magical" attacks though, not damage.
@Celtic_Ministrel I don't get what you mean with the movetype patching. Is the idea that you raise the resistance so high it becomes immunity using resistance_default?
Thanks to both of you
I would prefer it if the solution for 3 checks for "magical" attacks though, not damage.
@Celtic_Ministrel I don't get what you mean with the movetype patching. Is the idea that you raise the resistance so high it becomes immunity using resistance_default?
Thanks to both of you
Re: Antimagic (Impassable for magicians) Terrain Overlay/Damage type immunity/antimagic Aura
> Impassable terrain only for creatures with magical attacks
There are 2 main ways how to do it, and which one to choose depends on whether AI should be able to understand the limitation. Options are creating terrain type like mentioned before which remove possibility to move there, or using enter_hex event to interrupt movement after it is attempted.
There are 2 main ways how to do it, and which one to choose depends on whether AI should be able to understand the limitation. Options are creating terrain type like mentioned before which remove possibility to move there, or using enter_hex event to interrupt movement after it is attempted.
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Antimagic (Impassable for magicians) Terrain Overlay/Damage type immunity/antimagic Aura
More on creating a terrain type archetype…
First, you need to define the
Then you will likely want to define a
Finally, you'll need to use movetype patching to allow core units to walk on the terrain (or not). This is perhaps the trickiest part since it goes by move type, not unit type, so I'm not sure if there's a way to match only units with magical attacks; however, in 1.15.x, you can match only units that have an arcane vulnerability, which might be close.
Putting that all together gives something like this:
Then units with an arcane resistance of -20% will require 2 MP to enter the terrain, for example.
Suppose you have the following in your fireball's
And you added an attack like this to some unit:
And add the following code in your
Then every unit in the game except for the fireball will be immune to the antimagic attack, but the fireball will take regular damage. You'll probably also want to add a display string in your _main.cfg:
First, you need to define the
[terrain_type]
, which needs to specify an icon_image (usually magenta) and must not specify any of the alias keys. If you need the alias keys, then you'll need two terrain types. One is the so-called "archetype" which specifies the icon and no alias and will never be used on a map, while the other is the actual real terrain type you use on the map which specifies the archetype as the alias. Of course, they need separate terrain strings. The convention is for archetypes to end in a lowercase T.Then you will likely want to define a
[color_range]
for your custom terrain. This will determine (among other things) what the magenta icon is recoloured to. It needs to have the same ID as your terrain archetype.Finally, you'll need to use movetype patching to allow core units to walk on the terrain (or not). This is perhaps the trickiest part since it goes by move type, not unit type, so I'm not sure if there's a way to match only units with magical attacks; however, in 1.15.x, you can match only units that have an arcane vulnerability, which might be close.
Putting that all together gives something like this:
Code: Select all
[terrain_type]
id=antimagic
icon_image=icons/antimagic_field.png
name=_"Antimagic Field"
description=_"whatever you want"
string="^Zam" # or whatever you want to use
# In this example I assume this is both the archetype and the concrete terrain
[/terrain_type]
[color_range]
id=antimagic
rgb=00bbbb,00eeee,004444,00ffff
[/color_range]
[units]
[terrain_defaults]
id=antimagic
[movement_costs]
antimagic="(max(0, (resistance.arcane - 100) / 10))"
[/movement_costs]
[/terrain_defaults]
[/units]
It just means that if you add a new damage type, you can tell the engine what resistance core units have to that damage.
Suppose you have the following in your fireball's
[unit_type]
tag:Code: Select all
[resistance]
fire=0
cold=0
arcane=0
blade=0
pierce=0
impact=0
antimagic=100
[/resistance]
Code: Select all
[attack_type]
name=antimagic
type=antimagic
range=ranged
[/attack_type]
[units]
tag:Code: Select all
[resistance_defaults]
id=antimagic
default=0
[/resistance_defaults]
Code: Select all
[language]
type_antimagic = _ "antimagic"
[/language]
I think if you remove the "apply_to" line from the LotI example and add the following within the
[resistance]
tag it will work the way you want:Code: Select all
[filter_opponent]
[has_attack]
special_id_active=magical
[/has_attack]
[/filter_opponent]