Redefining Mainline Definitions

The place to post your WML questions and answers.

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.
Post Reply
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Redefining Mainline Definitions

Post by The_Gnat »

Hello (again ;) )

I am now wondering if their is a way to redefine mainline definitions for all mainline units? For example if i would like every unit's {AMLA_DEFAULT} to be changed when my add-on is installed how would this be done? Similarly if i want to modify the {WEAPON_SPECIAL_MAGICAL} definition, is their a way to override the current definitions when my add-on is installed, or override the definitions if a modification is choosen?

Thank you very much for answering all my questions! :D
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Redefining Mainline Definitions

Post by Ravana »

The_Gnat wrote:or override the definitions if a modification is choosen?
Runtime cannot affect preprocessing.
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: Redefining Mainline Definitions

Post by The_Gnat »

Ravana wrote:
The_Gnat wrote:or override the definitions if a modification is choosen?
Runtime cannot affect preprocessing.
Thank you, yes i realize that. Is their, however, a way to override the definitions on startup if a add-on is installed.
User avatar
Kwandulin
Art Contributor
Posts: 362
Joined: March 30th, 2014, 7:35 am
Location: Germany

Re: Redefining Mainline Definitions

Post by Kwandulin »

User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: Redefining Mainline Definitions

Post by The_Gnat »

Thanks for responding, yes i did not really expect to be able to override processor commands like these but was hoping ^_^

If anyone has any suggestions of hack ways to do this they would be appreciated!
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2358
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Redefining Mainline Definitions

Post by Lord-Knightmare »

I think someone already did something like that in their UMC. Forgot the name though...

Code: Select all

#ifdef AMLA_DEFAULT
#undef AMLA_DEFAULT
#endif

# Your new one
#define AMLA_DEFAULT

# Insert whatever code you want here in [advancement] tags 

#enddef
EDIT: this is my 1000th post
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Redefining Mainline Definitions

Post by Ravana »

This only works for units that are loaded after your addon, core should be before.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2358
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Redefining Mainline Definitions

Post by Lord-Knightmare »

This only works for units that are loaded after your addon, core should be before.

True, but he can make it work for core too by...well, making copies of ALL the existing mainline units (with new ID's)...
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
nuorc
Forum Regular
Posts: 582
Joined: September 3rd, 2009, 2:25 pm
Location: Barag Gor

Re: Redefining Mainline Definitions

Post by nuorc »

Lord-Knightmare wrote:making copies of ALL the existing mainline units (with new ID's)...
I think it sounds like a good idea if an add-on 'keeps to itself' and doesn't mess with core or other add-ons.
Spoiler:
I have a cunning plan.
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: Redefining Mainline Definitions

Post by The_Gnat »

Thanks for all the feedback!
True, but he can make it work for core too by...well, making copies of ALL the existing mainline units (with new ID's)...
I would rather not duplicate all the wesnoth units.
This only works for units that are loaded after your addon, core should be before.
Yes and that doesn't really help me.
I think it sounds like a good idea if an add-on 'keeps to itself' and doesn't mess with core or other add-ons.
Yeah, i would like my add-on only to mess around with stuff if a [modification] is selected which means anything i do needs to be after the game starts. Which means that i will probably be forced to use an [event] that modifies peoples AMLA.

I don't know how the actual game wesnoth was coded but maybe a feature could be added so that before loading all the definitions on the startup the game checks for any add-ons that have an override characteristic, if it finds them then it loads them instead. This would be helpful to a lot of add-ons but it's probably not at all possible.
Post Reply