enclave's WML Macros questions Thread

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
enclave
Posts: 835
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave » June 14th, 2018, 8:05 pm

Hi everyone..
I could google or browse wiki and forums for some hours to find what I need, so I'm asking here rather, as I'm not in a rush with this..
My question may be too obvious and simple, or too complicated idk.. I just never happen to do it before.

Can I add a new side to the game, after game started, during the game?
like... [event] name=turn 5 {ADD_NEW_SIDE 6 teal bla bla bla bla} [/event]

My problem is that I want to add survival elements to a random generated map created with generator.. And in generator there is set amount of sides..
I mean so that it would work on any amount of players map randomly generated.. or on any existing default map without dedicating 1 of the sides to ai when hosting game.. bzzzzz.. hard to explain, better just ignore my reasons with the explanation.. Just imagine that I want to use the [scenario] without specifying any separate side for ai,
Spoiler:
or that I would want some AI units spawn and attack on some default 1v1 map

Just please give me all ideas you have on how it could be done? Thanks!
PS. (creating [unit] side=3 would work to the best of my memory but that unit would be passive... or somebody could confirm that after creating unit of non existing side 3 I could just [modify_side] controller=ai and everything will start to happen?)

User avatar
zookeeper
WML Wizard
Posts: 9734
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: enclave's WML Macros questions Thread

Post by zookeeper » June 14th, 2018, 11:25 pm

enclave wrote:
June 14th, 2018, 8:05 pm
Can I add a new side to the game, after game started, during the game?
No, there's no way to do that. However, you can of course make some sides invisible and empty initially.

enclave
Posts: 835
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave » June 15th, 2018, 12:23 am

zookeeper wrote:
June 14th, 2018, 11:25 pm
enclave wrote:
June 14th, 2018, 8:05 pm
Can I add a new side to the game, after game started, during the game?
No, there's no way to do that. However, you can of course make some sides invisible and empty initially.
Yeah, but unfortunately that's not the way I would like it to work.. ideally it would be an addon that would work separately like a modification and could be used to add extra side to any default map.. (it's just to explain the complexity.. it's not really what I want from it..)

Anyone else could confirm that it's impossible? No alternative ideas/thoughts?

PS. Another question... is there a way to change time of day during the game?
like [event] name=turn 5 {CHANGE_TIME_OF_DAY_TO dusk} [/event] ?

User avatar
vultraz
Community Manager
Posts: 933
Joined: February 7th, 2011, 12:51 pm
Location: Dodging Daleks

Re: enclave's WML Macros questions Thread

Post by vultraz » June 16th, 2018, 4:13 am

I'm afraid adding new sides after they game has begun is indeed impossible.
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: enclave's WML Macros questions Thread

Post by Choicerer » June 25th, 2018, 10:07 pm

enclave wrote:
June 15th, 2018, 12:23 am
PS. Another question... is there a way to change time of day during the game?
like [event] name=turn 5 {CHANGE_TIME_OF_DAY_TO dusk} [/event] ?
I guess you probably found out about it, since this question is a bit old, but in case you didn't:
https://wiki.wesnoth.org/DirectActionsW ... me_area.5D

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

Re: enclave's WML Macros questions Thread

Post by Ravana » June 25th, 2018, 10:17 pm

You might want [replace_schedule] for that instead.

enclave
Posts: 835
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave » June 26th, 2018, 11:33 am

Choicerer wrote:
June 25th, 2018, 10:07 pm
I guess you probably found out about it, since this question is a bit old, but in case you didn't:
https://wiki.wesnoth.org/DirectActionsW ... me_area.5D
Ravana wrote:
June 25th, 2018, 10:17 pm
You might want [replace_schedule] for that instead.
I will try both versions, thanks you both!

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: enclave's WML Macros questions Thread

Post by Choicerer » June 26th, 2018, 1:17 pm

enclave wrote:
June 26th, 2018, 11:33 am
Choicerer wrote:
June 25th, 2018, 10:07 pm
I guess you probably found out about it, since this question is a bit old, but in case you didn't:
https://wiki.wesnoth.org/DirectActionsW ... me_area.5D
Ravana wrote:
June 25th, 2018, 10:17 pm
You might want [replace_schedule] for that instead.
I will try both versions, thanks you both!
No problem, but Ravana's right. I didn't know about that one, I guess in your case it would work better.

enclave
Posts: 835
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave » June 28th, 2018, 1:13 pm

Hi, this one will be quite advanced question, yet nothing complicated...

Could somebody explain in at least a little bit details what is the difference between loading a game and loading replay, is preload event behaving the same way for both? How exactly is it different? What differences are in storing and reloading variables and how they get reloaded, in which events, when?
Also anyone knows what happens to [options][entry] values on loading replay, is same as with loading game?

Anyone knows if there is a way to modify some kind of global variable for saving replays? For example on turn 3 I would modify some global variable and when loading replay on turn 1 it would show replay according to that global variable (not from turn 3, when the change took place)?

Also for example wesnoth.game_events.on_save reacts to saving game, but does Not react to saving replay, is there any function (even undocumented) that would react to saving replay action?

Thanks everyone in advance for any ideas, clues, hints, comments, and information..

Choicerer
Posts: 238
Joined: April 29th, 2017, 11:37 pm

Re: enclave's WML Macros questions Thread

Post by Choicerer » June 28th, 2018, 6:34 pm

Hi, I've been quite busy programming some other thing the 2 past days, but I'm going to look into this soon, as promised.
I just wanted to say
enclave wrote: Also anyone knows what happens to [options][entry] values on loading replay, is same as with loading game?
This part must surely be referring to my hack. Actually, yesterday, while browsing through the wiki, I found out the hack's redundant, because there's a much easier way to do this, namely:

Code: Select all

if wesnoth.game_config.mp_settings.savegame then
https://wiki.wesnoth.org/LuaWML/Misc#we ... ame_config

EDIT: Read your private messages, this solution could very well fix our problem.
EDIT2:[censored]. Disregard this post. The key actually only refers to whether a Multiplayer game that was hosted was a reloaded game or a new game.
EDIT3:Nice auto-censoring feature, I think that's new!


EDIT4:Check your mail. I've actually found some time and managed to get it to work.

Post Reply