Stupid Questions (see last post)

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.
User avatar
Ravana
Moderator
Posts: 2064
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Stupid Questions (see last post)

Post by Ravana » March 14th, 2019, 3:56 pm

No. Those are used for unit_type.

User avatar
TrashMan
Posts: 592
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan » March 15th, 2019, 9:05 am

I'm not sure I follow.

Basically I want for my campaign to have a bit finer control over how many traits a race has and what traits are available.

So for example - only humans and orcs can get the brawler trait, elves get 3 traits and only they can get reflexes.


Another problem is trait limited to specific types of units- let's say a trait only mage types should get. Is there a way to do it without overriding every stock mage unit?
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
beetlenaut
Developer
Posts: 2337
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Stupid Questions (see last post)

Post by beetlenaut » March 15th, 2019, 10:38 am

TrashMan wrote:
March 14th, 2019, 10:09 am
Would that require setting for every unit individually?
If you meant for every unit type, then yes. You are changing the types after all.
TrashMan wrote:
March 15th, 2019, 9:05 am
Is there a way to do it without overriding every stock mage unit?
You could write a macro with a recruit event and put it in all your scenarios. The event would remove all the traits of each new unit of a type that you want to control, then pick some random numbers and add traits based on the numbers. It would use [if] statements or a [switch] statement to see what unit type you are dealing with and act accordingly. You'd be rewriting the trait generation code basically. That's probably the way I would do it.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

User avatar
TrashMan
Posts: 592
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan » March 18th, 2019, 11:57 am

I think I'll just overwrite the units...

One more question:
Can my main file have both a [campaign] and a [modification] tag? Can I put the code that would normally go into the [modification] and put it under [campaign]?
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
TrashMan
Posts: 592
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan » March 19th, 2019, 9:53 am

More stupid questions. I used {IS_HERO} on my main characters, which is no longer necessary and messes up the elipses.

Now, it's an easy fix for a New Game, but how do I fix it in a running game?
Would a simply modify_unit with a new elipse path work? If so, what exactly is the new path? Where is the new elipse graphics?
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
josteph
Developer
Posts: 536
Joined: August 19th, 2017, 6:58 pm

Re: Stupid Questions (see last post)

Post by josteph » March 20th, 2019, 2:45 pm

IS_HERO is defined here: https://github.com/wesnoth/wesnoth/blob ... fg#L18-L22

To undo its effect I think you simply need to set those two keys to the empty string. (edit: CelMin says {UNMAKE_HERO} will do this.)

User avatar
TrashMan
Posts: 592
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan » March 21st, 2019, 10:48 pm

Very Important Question(s):

1) Can a campaign (I mean the _main.cgf file) have both a [campaign]block and a [modification] block?
I'm asking because my modifications aren't triggering - and I have the code outside and inside the [modification] block.

2) Also, can I add AMLAs to an unit in an event? Last time I tried they all gt instantly applied instead of added as options on levelup

3) Why is the game ignoring my units in favor of core ones? Shouldn't an active add-on/campaign override? For a simple test I had a Elvish Lady unit with an attack. In game she's doesn't have any.
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
Ravana
Moderator
Posts: 2064
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Stupid Questions (see last post)

Post by Ravana » March 21st, 2019, 11:04 pm

1) Yes. But it might not do what you expect it to do.
3) Unit types cannot be changed after they have been created. Either define new unit type or add attack during game.

User avatar
TrashMan
Posts: 592
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan » March 21st, 2019, 11:19 pm

Ravana wrote:
March 21st, 2019, 11:04 pm
1) Yes. But it might not do what you expect it to do.
Explain
3) Unit types cannot be changed after they have been created. Either define new unit type or add attack during game.
I didn't add the unit half-way trough. I started a new campaign after purging the cache, the campaign is still using core units.
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
beetlenaut
Developer
Posts: 2337
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Stupid Questions (see last post)

Post by beetlenaut » March 21st, 2019, 11:41 pm

TrashMan wrote:
March 21st, 2019, 10:48 pm
Can I put the code that would normally go into the [modification] and put it under [campaign]?
I have the code outside and inside the [modification] block.
It sounds like you haven't realized that each tag has a very specific list of tags and keys that it can contain, and it can't contain anything else. Maybe you should just post your _main.cfg.
TrashMan wrote:
March 21st, 2019, 11:19 pm
I didn't add the unit half-way trough. I started a new campaign
Core units are loaded first, then your campaign units are added when you start the campaign. It sounds like you used the same type ID's as the core units. Ravana is saying that your units will be ignored because units with those ID's already exist. You need to use different ID's on your units.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

User avatar
Ravana
Moderator
Posts: 2064
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Stupid Questions (see last post)

Post by Ravana » March 22nd, 2019, 6:13 am

1) When you put [modification] and [campaign] as top level tags to _main.cfg, it is almost as if they were separate addons, they do not affect each other.

User avatar
TrashMan
Posts: 592
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan » March 22nd, 2019, 9:55 am

beetlenaut wrote:
March 21st, 2019, 11:41 pm
Core units are loaded first, then your campaign units are added when you start the campaign. It sounds like you used the same type ID's as the core units. Ravana is saying that your units will be ignored because units with those ID's already exist. You need to use different ID's on your units.
So what you're saying that I NEED new ID's and a copy of every single unit I want to tweak?
There is no way to tell the game to take my files over the core ones (for this campaign only)?

That seems incredibly impractical and requires re-writing every single scenario, changing every unit placed on maps and all recruitment lists. Compared to many other games I modded, this feels backwards.

I guess I could do it as a modification that alters units on recruitment/recall/placement/levelup, but that's a whole lot of WML code that just slows everything needlesly.


Ravana wrote: 1) When you put [modification] and [campaign] as top level tags to _main.cfg, it is almost as if they were separate addons, they do not affect each other.
So in other words, campaign will be loaded, but modification will be ignored/not loaded?
Would it work if I moved the code/events inside the campaign tags?
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

User avatar
josteph
Developer
Posts: 536
Joined: August 19th, 2017, 6:58 pm

Re: Stupid Questions (see last post)

Post by josteph » March 22nd, 2019, 11:48 am

TrashMan wrote:
March 22nd, 2019, 9:55 am
Ravana wrote: 1) When you put [modification] and [campaign] as top level tags to _main.cfg, it is almost as if they were separate addons, they do not affect each other.
So in other words, campaign will be loaded, but modification will be ignored/not loaded?
You need to understand how the system works. When wesnoth starts it parses a certain set of WML files with certain macros predefined. Whenever wesnoth sees a [campaign] or [modification] tag at the top level it parses a campaign or a modification and makes them available in the respective dialogs. So, yes, if you put a [modification] tag after the [campaign] tag, the mod would be parsed, but it would be independent of the campaign, just like it would be if they'd been defined in different files.
TrashMan wrote:
March 22nd, 2019, 9:55 am
Would it work if I moved the code/events inside the campaign tags?
Partly. You can see on https://wiki.wesnoth.org/CampaignWML and https://wiki.wesnoth.org/ModificationWML that not all tags recognized under [modification] are also recognized under [campaign]: for example, [event] tags do but [lua] tags do not.

gfgtdf
Developer
Posts: 1153
Joined: February 10th, 2013, 2:25 pm

Re: Stupid Questions (see last post)

Post by gfgtdf » March 22nd, 2019, 12:51 pm

josteph wrote:
March 22nd, 2019, 11:48 am
Partly. You can see on https://wiki.wesnoth.org/CampaignWML and https://wiki.wesnoth.org/ModificationWML that not all tags recognized under [modification] are also recognized under [campaign]: for example, [event] tags do but [lua] tags do not.
This is wrong, the wiki is probably just missing iformation here. The code that adds the [campaign] content to each [scenario] is exactly the same that handles [modification], see https://github.com/wesnoth/wesnoth/blob ... e.cpp#L366
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

User avatar
TrashMan
Posts: 592
Joined: April 30th, 2008, 8:04 pm
Contact:

Re: Stupid Questions (see last post)

Post by TrashMan » March 23rd, 2019, 10:43 pm

josteph wrote:
March 22nd, 2019, 11:48 am
TrashMan wrote:
March 22nd, 2019, 9:55 am
Would it work if I moved the code/events inside the campaign tags?
Partly. You can see on https://wiki.wesnoth.org/CampaignWML and https://wiki.wesnoth.org/ModificationWML that not all tags recognized under [modification] are also recognized under [campaign]: for example, [event] tags do but [lua] tags do not.
All the code is just on recruitment/recall/placement events anyway that adds abilities or attacks to units.

So basically, if I just put all the code at the bottom, just before [/campaign], it should work?
Off, because I started a new campaign after clearing cache and it didn't work.


And just to re-cap - for every CORE unit I want to tweak in my campaign, I basically have to make completely new units with new ID's, OR trough WML to modify units at runtime?
Light travels much faster than sound, that's why some people seem bright until you hear them speak.

>>> MY LITTLE LAB! <<<

Post Reply