enclave's WML Macros questions Thread
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.
Re: enclave's WML Macros questions Thread
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...
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,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?)
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:
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?)
Re: enclave's WML Macros questions Thread
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]
?Re: enclave's WML Macros questions Thread
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?
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
Re: enclave's WML Macros questions Thread
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
Re: enclave's WML Macros questions Thread
You might want [replace_schedule] for that instead.
Re: enclave's WML Macros questions Thread
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
I will try both versions, thanks you both!
Re: enclave's WML Macros questions Thread
No problem, but Ravana's right. I didn't know about that one, I guess in your case it would work better.enclave wrote: ↑June 26th, 2018, 11:33 amChoicerer 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.5DI will try both versions, thanks you both!
Re: enclave's WML Macros questions Thread
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
Thanks everyone in advance for any ideas, clues, hints, comments, and information..
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..
Re: enclave's WML Macros questions Thread
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
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.
I just wanted to say
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:enclave wrote: Also anyone knows what happens to [options][entry] values on loading replay, is same as with loading game?
Code: Select all
if wesnoth.game_config.mp_settings.savegame then
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.
Re: enclave's WML Macros questions Thread
Hello,
I have a question... about nested events inside events.. something like that..
I have [event] name=start
which has [if] variable=1 then
[event] name=die
inside die event it has 2 other events:
[event] name=moveto id=dead_king_moveto_side$unit.side
[event] name=side $unit.side turn
My question is how to make event
I tried different ways with delay variable substitution and with $| signs... i can't get it to work the way I want.. its either nothing or $unit.side (while inside die event everything else is working perfectly fine.. but the events appear corrupted..
please help!
I have a question... about nested events inside events.. something like that..
I have [event] name=start
which has [if] variable=1 then
[event] name=die
inside die event it has 2 other events:
[event] name=moveto id=dead_king_moveto_side$unit.side
[event] name=side $unit.side turn
My question is how to make event
name=side $unit.side turn
be shown in debug list of events as name=side 1 turn
(which is the side of dead unit)I tried different ways with delay variable substitution and with $| signs... i can't get it to work the way I want.. its either nothing or $unit.side (while inside die event everything else is working perfectly fine.. but the events appear corrupted..
please help!
Re: enclave's WML Macros questions Thread
I doubt you can change how it appears in debug list. Does the event work as expected?
Re: enclave's WML Macros questions Thread
hmm you think it will work as it is... thats interesting idea.. i was sure if its looking messed up in debug list then it wont work...
I will check to make sure it doesnt work or works... but it didn't work the first time.. i will just try some more things... maybe i try to change that die event into something like die $unit.side ... and if it appear fine in list then i will know where to look deeper...
hmm indeed it appears also corrupted with $ things... then it must be me doing other mistake in code somewhere possibly...
thanks for advice
Ok i have tested.. and it seems like (for now.. I will have to investigate more... and make tutorial for others.. because wiki is like always bloody short and has super basic example that nobody would ever use in real world)
if you would want to use $unit.side from die event inside moveto event, then you would have to use $unit.side
if you would want to use $unit.side from moveto event inside moveto event, then you would have to use $|unit.side
But it will only work if you make sure that your moveto event has
If you want to put
Hopefully I will later make a small tutorial with examples to make it clear for others, and including myself too... because I don't really 100% get it yet.. especially if there was more events inside events.. for now I haven't completed the code that I needed... once I done it maybe I could say that I understand it well..
Then it will appear as "side_2_turn" in the debug inspection list of events. So it will not have dollar signs "$" in it. It does not work with dollar signs as intended, they are treated like literals or similar. So if anyone see dollar signs in event list it most probably means u need to change your code as it wasnt translated properly.
I will check to make sure it doesnt work or works... but it didn't work the first time.. i will just try some more things... maybe i try to change that die event into something like die $unit.side ... and if it appear fine in list then i will know where to look deeper...
hmm indeed it appears also corrupted with $ things... then it must be me doing other mistake in code somewhere possibly...
thanks for advice
Ok i have tested.. and it seems like (for now.. I will have to investigate more... and make tutorial for others.. because wiki is like always bloody short and has super basic example that nobody would ever use in real world)
Code: Select all
if you have [event] start
then inside [event] die
then inside [event] moveto
if you would want to use $unit.side from moveto event inside moveto event, then you would have to use $|unit.side
But it will only work if you make sure that your moveto event has
delayed_variable_substitution=no
(default is yes, when it's absent)If you want to put
[event] name=side $unit.side turn refresh
(which would use $unit.side from die event, then you would also need to make sure that your turn refresh has delayed_variable_substitution=no
(while die event and start event has it set to "yes" or simply don't have it) Hopefully I will later make a small tutorial with examples to make it clear for others, and including myself too... because I don't really 100% get it yet.. especially if there was more events inside events.. for now I haven't completed the code that I needed... once I done it maybe I could say that I understand it well..
I have tested it and can say for sure that if you put:
Code: Select all
[event]
name=side $unit.side turn
first_time_only=yes
delayed_variable_substitution=no