[preload] [prestart] [start] events
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.
[preload] [prestart] [start] events
Hello,
I am a bit confused about [preload] [prestart] [start] events, like many probably . I would like someone knowledgeable to clearly explain why each exists, what actually happens, how all is done in fact. Here is my present best guess, as I wrote inside a scenario intended to explain WML usage in practice (also to myself!):
In a scenario, the major phases are defined more or less in chronology:
* general scenario information
* Story text
(switch from story telling to game construction)
* Definition of startup sides
(the map and its content are defined in memory)
* Prestart: define objectives, place or recall units, change map...
(the map and its content are drawn onto the screen)
* Start: initial action (eg dialog, movement)
(now the player can play)
* Other events specific to the scenario: eg, an ally or ennemy troop arrives
(the player wins or loses)
* End-of-scenario (called "endlevel")
(Note that "preload" is missing.)
Now, more precise guesses about predefined events (also text from my scenario, except for preload):
* preload:
Only for Lua? (I have only seen it used in Lua context.) If yes, I would like to understand why and how.
* prestart:
This event is triggered after the story is told,
but before the user interface is drawn, especially the map.
But the map and all what is contains is defined in memory,
so that we can add, change, or remove elements (ex. units) in this event.
Here we can place companions of the hero or manipulate the recall list.
This is also a good event to define objectives??? (why not at top scenario level?)
* start:
This event is triggered after the user interface is drawn,
but before the player can actually play.
Here we can write startup dialogues, as well as help or info texts.
This is also a good event for units that arrive or leave at startup.
What is right or wrong about my guesses?
I am a bit confused about [preload] [prestart] [start] events, like many probably . I would like someone knowledgeable to clearly explain why each exists, what actually happens, how all is done in fact. Here is my present best guess, as I wrote inside a scenario intended to explain WML usage in practice (also to myself!):
In a scenario, the major phases are defined more or less in chronology:
* general scenario information
* Story text
(switch from story telling to game construction)
* Definition of startup sides
(the map and its content are defined in memory)
* Prestart: define objectives, place or recall units, change map...
(the map and its content are drawn onto the screen)
* Start: initial action (eg dialog, movement)
(now the player can play)
* Other events specific to the scenario: eg, an ally or ennemy troop arrives
(the player wins or loses)
* End-of-scenario (called "endlevel")
(Note that "preload" is missing.)
Now, more precise guesses about predefined events (also text from my scenario, except for preload):
* preload:
Only for Lua? (I have only seen it used in Lua context.) If yes, I would like to understand why and how.
* prestart:
This event is triggered after the story is told,
but before the user interface is drawn, especially the map.
But the map and all what is contains is defined in memory,
so that we can add, change, or remove elements (ex. units) in this event.
Here we can place companions of the hero or manipulate the recall list.
This is also a good event to define objectives??? (why not at top scenario level?)
* start:
This event is triggered after the user interface is drawn,
but before the player can actually play.
Here we can write startup dialogues, as well as help or info texts.
This is also a good event for units that arrive or leave at startup.
What is right or wrong about my guesses?
Re: [preload] [prestart] [start] events
The difference between preload and prestart is that preload happens after reloading save. So you can use it to add check if reloading allowed at that time.
Re: [preload] [prestart] [start] events
There is afaik currently no real usecase for preload events, lua can be initialized in [lua] directly at [scenario], and ir you really want 'on-reload' events you must be extremely cautious since it is not synced. I reccomend simply not to use it for normal stuff.
Back in 1.10 preload events would be the way to initialize lua code.
Back in 1.10 preload events would be the way to initialize lua code.
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: [preload] [prestart] [start] events
[lua] is not supported in [era], so preload is needed there.
Re: [preload] [prestart] [start] events
At least in 1.14 and later, this is wrong
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: [preload] [prestart] [start] events
Thank you all!
Since there is no critic of my description (in first post) of these events and their uses, should I consider that it is correct anough? Others may read that, especially novice campaign authors, who I do not want to mislead...
Since there is no critic of my description (in first post) of these events and their uses, should I consider that it is correct anough? Others may read that, especially novice campaign authors, who I do not want to mislead...
Re: [preload] [prestart] [start] events
The main place for these docs would be the wiki's EventWML page. For the first message in this thread, I think (but I'm not sure) that the definition of sides takes place before the
[story]
.Re: [preload] [prestart] [start] events
Thank you Octalot. This last info is relevant for another task, namely defining player troops for a "trial mode", thank to which we'd jump to a given scenario. I need to know what, especially which hero or other special units, are defined or not before my jump event (which cant take place before the 1st [preload]). Ideally, they would be all defined or all undefined, so that I can process all the same way: by either creating or modifying them.