A couple questions regarding to WML coding
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.
A couple questions regarding to WML coding
Hi,
I am trying to make a new multiplayer map with completely new units and have a few questions regarding to some of the problems I have encountered:
1. Is there anyway to overwrite the default units without having to rename the unit ID? I copied a unit, let's say elvish fighter, into the add-on folder, and changed a couple stats, it seems like without messing with the ID, the game uses the original stats instead of the new stats given in the add-on folder.
2. How do I add a new attack/resistance type? The default only has pierce, blade, impact, fire, cold, and arcane. If I want more, how do I define it?
3. Is there a way to make a portal on the map that once a unit steps on it, it gets teleported to a different location? I think it might be possible to do it with an [event] tag, but would AI be smart enough to use it to get to places?
4. Is there a way to make the map wrap around itself like a globe? For example, if I reached the eastern most square, and if I keep moving to the right, the unit will appear on the western side of the map.
5. Caution seems to be acting weird. Is there any known bug with this setting? I set the aggression to 0, and caution to 1, AI is committing suicide left and right. Bumped it up to 3-4, no significant changes were noticed. When I finally bumped it to something around 100, the AI finally started to act cautiously from time to time and not committing as much suicide.
I am trying to make a new multiplayer map with completely new units and have a few questions regarding to some of the problems I have encountered:
1. Is there anyway to overwrite the default units without having to rename the unit ID? I copied a unit, let's say elvish fighter, into the add-on folder, and changed a couple stats, it seems like without messing with the ID, the game uses the original stats instead of the new stats given in the add-on folder.
2. How do I add a new attack/resistance type? The default only has pierce, blade, impact, fire, cold, and arcane. If I want more, how do I define it?
3. Is there a way to make a portal on the map that once a unit steps on it, it gets teleported to a different location? I think it might be possible to do it with an [event] tag, but would AI be smart enough to use it to get to places?
4. Is there a way to make the map wrap around itself like a globe? For example, if I reached the eastern most square, and if I keep moving to the right, the unit will appear on the western side of the map.
5. Caution seems to be acting weird. Is there any known bug with this setting? I set the aggression to 0, and caution to 1, AI is committing suicide left and right. Bumped it up to 3-4, no significant changes were noticed. When I finally bumped it to something around 100, the AI finally started to act cautiously from time to time and not committing as much suicide.
Re: A couple questions regarding to WML coding
1. AFAIK, no. Anyways it's not really the best idea to actually redefine core stuff if you want your add-on to play nicely with other add-ons. Normally what people do is just add new unit ids for units with the changes they need.
(If you really want to, there might be some voodoo way that you can do this using the insert-tag syntax at top level of your scenario WML, like
2. Punt
3 and 4:
Option 1: Use a tunnel tag. Vold made a map recently like this in the mp dev forum, he found that the AI is smart enough to use the teleports he made this way.
However I must warn you, tunnel is not really a completely "finished" feature right now, it has some bugs, and it's not terribly efficient right now, I think if you made a large map with hundreds of tunnels between various hexes, it will scan through the list of tunnels almost any time it checks if two hexes are adjacent. There are several feature requests related to this right now. If you only have a few tunnels / a small map then it's probably fine but I think if you want to do really elaborate things with tunnels you should wait until version 1.14 hopefully.
Option 2: Use moveto events. However the AI won't be able to understand these.
5. Punt
(If you really want to, there might be some voodoo way that you can do this using the insert-tag syntax at top level of your scenario WML, like
[+units] ...
or something but I don't remember the specifics, you can find it in the forums somewhere I think.)2. Punt
3 and 4:
Option 1: Use a tunnel tag. Vold made a map recently like this in the mp dev forum, he found that the AI is smart enough to use the teleports he made this way.
However I must warn you, tunnel is not really a completely "finished" feature right now, it has some bugs, and it's not terribly efficient right now, I think if you made a large map with hundreds of tunnels between various hexes, it will scan through the list of tunnels almost any time it checks if two hexes are adjacent. There are several feature requests related to this right now. If you only have a few tunnels / a small map then it's probably fine but I think if you want to do really elaborate things with tunnels you should wait until version 1.14 hopefully.
Option 2: Use moveto events. However the AI won't be able to understand these.
5. Punt
Re: A couple questions regarding to WML coding
You just give the attacks type=whatever, and similarly just add whatever=80 to a unit's resistances to give it 20% resistance to it. Units should default to 100 (no resistance/vulnerability) for damage types they have no defined resistance to (better to check and make sure though).jeeree wrote:2. How do I add a new attack/resistance type? The default only has pierce, blade, impact, fire, cold, and arcane. If I want more, how do I define it?
However, you'll also need to add the user-visible string for the damage type name into the top-level [language] tag:
Code: Select all
[+language]
type_whatever= _ "whatever"
[/language]
Re: A couple questions regarding to WML coding
I suggest using [base_unit] to define your new unit type. It will still need to have its own unit type ID. But, this makes the whole process simpler and cleaner.jeeree wrote: 1. Is there anyway to overwrite the default units without having to rename the unit ID? I copied a unit, let's say elvish fighter, into the add-on folder, and changed a couple stats, it seems like without messing with the ID, the game uses the original stats instead of the new stats given in the add-on folder.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."