Is there a way to disable attacking certain units?
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.
Is there a way to disable attacking certain units?
I came up with the weapon special for a fencer-like unit: Challenge.
If the units attacks the oponent, it challenges it for a duel. Both unit would receive status "challenged" and will not be able to move and attack any other units but each other until one of them gets killed. Also none of the other units are able to attack the challenged units.
While I have more or less the idea how to filter units (status challenged and variable inside unit that would contain the id of the challenged oponent), I have no idea how to make attack certain units impossible. Do you know how can I do it?
If the units attacks the oponent, it challenges it for a duel. Both unit would receive status "challenged" and will not be able to move and attack any other units but each other until one of them gets killed. Also none of the other units are able to attack the challenged units.
While I have more or less the idea how to filter units (status challenged and variable inside unit that would contain the id of the challenged oponent), I have no idea how to make attack certain units impossible. Do you know how can I do it?
I'm also a drummer. Checkout our new album:
YT - https://www.youtube.com/watch?v=gf8GRfa ... XuwBotnU84
Spotify - https://open.spotify.com/album/39mHk6cA ... MiOZMqVW1Q
YT - https://www.youtube.com/watch?v=gf8GRfa ... XuwBotnU84
Spotify - https://open.spotify.com/album/39mHk6cA ... MiOZMqVW1Q
- ChaosRider
- Posts: 1506
- Joined: April 15th, 2012, 1:15 pm
Re: Is there a way to disable attacking certain units?
Change challanged units resistances (blade, pierce, impact, cold, fire, arcane) to 100% and for their weapons give damage type called "challange". So only challanged will be able to deal dmg to eachother.
Other option would be to give weapon special with chance to hit 0% to units that werent challanged when they try to attack challanged unit. Only unit that was challanged wouldnt get that 0% chance to hit weapon special.
Ofcourse there is weapon special berserk which makes fight 30 times longer so only one unit will survive it.
Other option would be to give weapon special with chance to hit 0% to units that werent challanged when they try to attack challanged unit. Only unit that was challanged wouldnt get that 0% chance to hit weapon special.
Ofcourse there is weapon special berserk which makes fight 30 times longer so only one unit will survive it.
Creator of WOTG (+6800 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
Re: Is there a way to disable attacking certain units?
Turn them into statues with
[petrify], and add a right-click menu to unpetrify, do a scripted attack, and petrify again. At end of turn, do the scripted attack if it hasn't happened yet.- Spannerbag
- Posts: 979
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: Is there a way to disable attacking certain units?
A thought: you could temporarily give the challenger the [berserk] melee special although that alone wouldn't absolutely guarantee that one combatant would die (even if you increased number of rounds of combat above the usual 30).
This could be added via [effect], maybe inside a 1 turn duration [object] so the
Assuming you're using v1.18 or later you could try using the pre attack event to add
Otherwise, (I think) you'll have to have
Presumably this will only happen when the challenger attacks and never when the challenger is attacked by an enemy on their turn?
If you want challenge to operate in retaliation also this is probably possible but more complicated.
Anyway, there are several ways to bolt these bit together depending on the finer details of exactly how you want this to work/look in-game.
If nothing else hopefully this might give you a few more ideas?
It's a good idea, hope you can get it working the way you want.
Good luck!
This could be added via [effect], maybe inside a 1 turn duration [object] so the
[berserk] goes away when the turn ends.Assuming you're using v1.18 or later you could try using the pre attack event to add
[berserk], but I haven't used pre attack so can't say.Otherwise, (I think) you'll have to have
[berserk] in place prior to actually attacking - not sure, haven't experimented.Presumably this will only happen when the challenger attacks and never when the challenger is attacked by an enemy on their turn?
If you want challenge to operate in retaliation also this is probably possible but more complicated.
Anyway, there are several ways to bolt these bit together depending on the finer details of exactly how you want this to work/look in-game.
If nothing else hopefully this might give you a few more ideas?
It's a good idea, hope you can get it working the way you want.
Good luck!
Re: Is there a way to disable attacking certain units?
Thank you all for answers. I think [disable] is the cleanest way. Didn't know I could just filter opponents inside the special.
I'm also a drummer. Checkout our new album:
YT - https://www.youtube.com/watch?v=gf8GRfa ... XuwBotnU84
Spotify - https://open.spotify.com/album/39mHk6cA ... MiOZMqVW1Q
YT - https://www.youtube.com/watch?v=gf8GRfa ... XuwBotnU84
Spotify - https://open.spotify.com/album/39mHk6cA ... MiOZMqVW1Q