Check for campaigns being loaded using [lua]
Moderator: Forum Moderators
Check for campaigns being loaded using [lua]
Hi, i am not familiar with
Basically i want to create [lua] code that is part of my umc era that checks if any campaigns are being loaded and if a campaign is being loaded does an action, if multiplayer is being loaded does a different action and if neither are being loaded (for example if the unit database is being loaded) does a third action.
Thanks a lot!!!
[lua]
tags but i have encountered a problem that i think using lua would be solvable:Basically i want to create [lua] code that is part of my umc era that checks if any campaigns are being loaded and if a campaign is being loaded does an action, if multiplayer is being loaded does a different action and if neither are being loaded (for example if the unit database is being loaded) does a third action.
Thanks a lot!!!
Last edited by The_Gnat on November 12th, 2016, 5:16 am, edited 1 time in total.
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Check for campaigns being loaded using [lua]
You can easily chacke which units are being 'loaded' by checking wesnoth.unit_types[unit_id] ~= nil. wesnoth.game_config.mp_settings can also give you information about the currently playing mp game and active mods.
Note that in mp making code depdnent on whether a specific unit type is loaded might casue OOS since its posible that a type is onyl loaded one one clients (becaue others don't have the corresponding addons installed)
Note that in mp making code depdnent on whether a specific unit type is loaded might casue OOS since its posible that a type is onyl loaded one one clients (becaue others don't have the corresponding addons installed)
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.
Re: Check for campaigns being loaded using [lua]
Thanks gfgtdf, i was more wondering though if there was a way to check if a campaign was being loaded. This would be great because i want a modification to be loaded ONLY in the unit database! I can #ifndef MULTIPLAYER to make it not load into multiplayer, but i want to do IF NOT CAMPAIGN using [lua] code to make sure it doesn't load into any campaigns! (i know it sounds silly but this would be real helpful )
Thanks again, hopefully this can be done!
Thanks again, hopefully this can be done!
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Check for campaigns being loaded using [lua]
in mp you can use
wesnoth.game_config.mp_settings.mp_campaign ~= ""
t check whether this is a campaign or just a regular [multiplayer]
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.
Re: Check for campaigns being loaded using [lua]
I dont think database looks any of your Lua.
Re: Check for campaigns being loaded using [lua]
Thanks yeah this is what i would want to do , i'll give it a try!gfgtdf wrote:in mp you can usewesnoth.game_config.mp_settings.mp_campaign ~= ""
t check whether this is a campaign or just a regular[multiplayer]
That actually isn't a problem.Ravana wrote:I dont think database looks any of your Lua.
EDIT: Hmm... can you put a [lua] check for campaign type code into a [unit]? I don't think you can, but i ask because i want to change the advancements for this unit if any campaign is being loaded, Thanks!
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Check for campaigns being loaded using [lua]
you can put a [lua] in a [event] in a [unit]EDIT: Hmm... can you put a [lua] check for campaign type code into a [unit]? I don't think you can, but i ask because i want to change the advancements for this unit if any campaign is being loaded, Thanks!
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.
Re: Check for campaigns being loaded using [lua]
Great idea, what I'll do is set my units togfgtdf wrote:you can put a [lua] in a [event] in a [unit]
[advance_from]
the people i want, but then if a campaign is being loaded then i will modify there advancements using a [event]!Should i run my [lua] code as a
name=turn refresh
or a name=new turn
[event], to make sure all the units have their advancements properly modified?Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Check for campaigns being loaded using [lua]
Not been reading, not sure what you're wanting to do or why, but it seems to me there's almost certainly a better place to handle a unit advancement issue than checking every turn.
I forked real life and now I'm getting merge conflicts.
Re: Check for campaigns being loaded using [lua]
Yeah after looking into [lua] a little bit i have much more respect for the developers of wesnoth! and have decided to postpone this thing i am working on until i have more time to devote to learning [lua]. Thanks a lot to everyone on this thread who tried to help!Tad_Carlucci wrote:Not been reading, not sure what you're wanting to do or why, but it seems to me there's almost certainly a better place to handle a unit advancement issue than checking every turn.
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.