Attack variants

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
Posts: 17
Joined: December 28th, 2007, 7:14 pm
Location: A tesseract

Attack variants

Post by Wurmish »

I've been wanting to develop my own era for some time now, and recently got around to getting statistics and lovely other things down on paper, but I have a few questions that I couldn't seem to find an answer to (due to either not knowing what to search for or possibly blindness).
I want to know if some of my ideas are possible before I get really into WML (besides looking at code other people post).

Is it possible to have an attack hit for one value, then if the first attack misses, have a second attack go through? I'm looking for a Fragmentation Missile effect. The first attack is one powerful one, if it hits, then the attack is over, but if it misses, the fragments are a secondary attack and must all be dodged accordingly (preferably a different damage type, but I was looking at the other thread on random damage types and don't know if it's feasible).
While at work I had the idea that maybe I could create an attack-specific ability, call it Fragment X, where X is the number of attacks if the main attack misses. If the first way isn't easily programmable, would the ability be easier to define and work with?

Secondly, is it possible to have an effect that requires X hits on the attack? Specifically I'm looking for a penalty I call Stall, if you get hit 3 times in one attack, then the target loses 1 MP on its next turn.

Third, does the game deal in 5% values? I have several effects in mind that increase/decrease CtH and increase/decrease Evasion, but in an unlucky scenario, all the effects could stack up and create a less-than-0 CtH or over 100% Evasion chance. Does the game just flat-line at 0% and 100%, will I need to move things into 5% values/alter terrain defenses to avoid it (if feasible), or will I need to change my effects around?

Fourth, I realize you can program in extra attacks and everything, but I have not seen the ability to SWITCH attack types. Such as having a 3-4 impact melee attack, but using a right click menu to change weapons and move to a 5-2 blade melee attack. The reason I want them to be switchable is because I currently have 15 weapons for human players to utilize, so that could get messy, and furthermore I want players to have the chance of being caught with a bad weapon out in some circumstances.

And finally, I want every unit to have an Energy statistic that is used in most attacks and can be recharged, is it *relatively* easy to program the AI to understand a nonstandard variable?

Off topic sort of, I realize I'm jumping into a huge project with what I WANT to do (Currently 5 player units, probably will have around 30 enemy units, 15 player weapons, probably around 10 to 15 enemy-unique weapons; I want to create my own art obviously, if I CAN I want to do terrains as well [But I will be using current terrain aliases to make it easier to test and play around, and avoid programming in those movetypes/defense stats for the extra terrains]; and I'm working on a backstory for all sides involved).
Currently quietly developing a small faction as part of my master plan to develop an entire era independently. Art is the only concerning point for me.

User avatar
Project Manager
Posts: 4361
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Attack variants

Post by Pentarctagon »

Wurmish wrote:Third, does the game deal in 5% values?
yes, 1% values too.
Wurmish wrote:Does the game just flat-line at 0% and 100%, will I need to move things into 5% values/alter terrain defenses to avoid it (if feasible), or will I need to change my effects around?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

User avatar
Moderator Emeritus
Posts: 2176
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Attack variants

Post by Ken_Oh »

The answer from me is "yes" to everything except the last question (the AI one). I wouldn't know one way or another if it is possible, but it certainly won't be easy relative to everything else you want to do (except for the artwork).

For a lot of the attack event stuff (like changing the number of attacks or changing the number of MPs a unit has based on a weapon special), you'll want to look up

There are some out-dated examples of event-driven abilities that might help here:

I have done a lot of what you're asking (changing weapons, event-driven weapon specials, having chances to hit increments less than 10%) in my multiplayer campaign Wesband which can be found on the 1.6.x add-ons server, if you want to see some it in action.

Good luck.

Posts: 2130
Joined: November 6th, 2007, 1:38 pm

Re: Attack variants

Post by Mabuse »

Wurmish wrote: if I CAN I want to do terrains as well [But I will be using current terrain aliases to make it easier to test and play around, and avoid programming in those movetypes/defense stats for the extra terrains]
using already existing terrain aliases is imo no good idea, as it really wont bring any benefit.
(but only disadvantages, and the less worst of it is that you must change it anyway when you want somebody else to play it)

because: once you know how to implement new terrain you really dont need to use existing terrain alliases (its no big deal to implement new ones), that will just mess up your wesnoth (and you want to change it anyway in order to make it playable for others).

using existing movetypes and def stats is possible with new terrain, you can just make new terrain be aliases of "whatever" and def and movecost will be used by it


maybe i just understood something, and what you mean is already what i wrote down there :lol2:

in any case it should be clear that you should not use existing terrain-CODES

btw, making your own terrainID (which also defines the movementtype) and make an entry into a movement-list for your new units isnt terribly difficult either though

Code: Select all

name= _ "Asteroids Field"

name= _ "Asteroids"
for example here are two new terrains, one of them has the "ID: asteroids field", and the other is "just" an alias of it.
in the unit data you simply set (you can use any already existing movetype)


and thats it. (ok you have to set defense for the terrain aslo)

in most cases the standard terrain-aliases are ok (for "earthbound units"), but if you want to make a space battle then it woudl be better if you make new terrain ID's for the paces and astroids for example. flying through space and hiding in "woods" woudl be a disturbing detail kinda.

in most other cases existing terrain aliases may cover most things.

for example if you make "acid slime" terrain, you may name it "acid slime" but give it swamp/wood aliases (and make it that the "worst" def and movetype is chose among the two (to make water units also dont like the acid slime terrain) ... but thats juat a quick idea, spending more thoughts on the special case wil turn out better results
The best bet is your own, good Taste.

Post Reply