Custom Scenario make the game crash when loaded
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.
-
- Posts: 3
- Joined: September 20th, 2020, 4:02 pm
Custom Scenario make the game crash when loaded
I recently got into wml coding, but every time I want to test the first scenario of my campaign, the game crashes with the following error message:
Here is the main code :
And the scenario one :
thanks in advance for your help !
Spoiler:
Code: Select all
[textdomain] wesnoth-corrupted_elves
text="wesnoth-corrupted_elves"
path=data/add-ons/Corrupted_Elves/translations
[/textdomain]
[campaign]
#textdomain wesnoth-corrupted_elves
id=corrupted_elves
name=_"Corrupted Elves"
abbrev="CE"
define=CAMPAIGN_Corrupted_Elves
icon="units/elves-wood/avenger-sword-1.png~RC(magenta>purple)"
image="data/add-ons/Corrupted_Elves/images/Wohael.png~RC"
first_scenario="01_Shady_Battle"
description=_"Follow the story of Wohael and his troops, corrupted by a demonic magic.
Will their tale end as an epic or a tragedy?"
difficulties=Medium
difficulty_descriptions=_"Medium"
[/campaign]
[binary_path]
path=data/add-ons/Corrupted_Elves
[/binary_path]
{~add-ons/Corrupted_Elves/scenarios}
{~add-ons/Corrupted_Elves/maps}
Code: Select all
#textdomain wesnoth-corrupted_elves
[scenario]
id="01_Shady_Battle"
next_scenario=null
name=_"Shady Battle"
map_data="{~add-ons/Corrupted_Elves/maps/Battle.map}"
turns=20
[/scenario]
[side]
side=1
controller=player
team_name="elvish_squad"
user_team_name=_"Elvish Squad"
id="WohaelLeader"
name= "Wohael"
type= "Lord"
unrenameable=yes
canrecruit=yes
recruit="Archer, Fighter"
gold=100
[/side]
[side]
side=2
controller=ai
team_name="bad"
user_team_name= _ "Bad Guys"
id="EnemyLeader"
name= _ "Batta"
type= "Orcish Warrior"
unrenameable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Wolf Rider"
gold=100
[/side]
[event]
name=start
[message]
speaker=WohaelLeader
message= _ "Give me a report, soldier."
[/message]
[message]
speaker=Archer
message= _ "Orcs have set up their base north, Commandant Wohael."
[/message]
[objectives]
[objective]
description= _ "Defeat the enemy leader"
condition="win"
[/objective]
[objective]
description= _ "Death of your leader"
condition="lose"
[/objective]
[objective]
description= _ "Turns run out"
condition="lose"
[/objective]
[/objectives]
[/event]
Last edited by WhiteWolf on September 20th, 2020, 4:39 pm, edited 1 time in total.
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Custom Scenario make the game crash when loaded
To start with, [scenario] should surround all other tags you have there ([side], [event], etc).
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
-
- Posts: 3
- Joined: September 20th, 2020, 4:02 pm
Re: Custom Scenario make the game crash when loaded
Pentarctagon wrote: ↑September 20th, 2020, 4:41 pm To start with, [scenario] should surround all other tags you have there ([side], [event], etc).
Thanks you, it worked !
Re: Custom Scenario make the game crash when loaded
- Put your [/scenario] at the very end of the scenario file, so that all of the sides, events, etc. are between [scenario] and [/scenario]. (This may fix the crash, or it may reveal new errors. Hard to tell until you try it!) Looks like Pentarctagon beat me to it!
- As general good practice, when you post code on the forum, please put it inside
- As general good practice, your binary path and scenarios and stuff should be inside an ifdef statement. (Also, the CAMPAIGN_WHATEVER is traditionally all-uppercase. I'm not sure whether it's required to be, but it's easier to just go along with it.) That would make your main file look like this:
The difficulty definition you're using has also been "deprecated" (I think that means "try not to do this, but old stuff that does it will still work for a while"): try this instead:
I hope some of this helps, and if not, change these and come back with the new errors!
- As general good practice, when you post code on the forum, please put it inside
[code]...[/code]
tags. Okay, it looks fine now, not sure why it didn't when I first saw it.- As general good practice, your binary path and scenarios and stuff should be inside an ifdef statement. (Also, the CAMPAIGN_WHATEVER is traditionally all-uppercase. I'm not sure whether it's required to be, but it's easier to just go along with it.) That would make your main file look like this:
Code: Select all
[textdomain] wesnoth-corrupted_elves
text="wesnoth-corrupted_elves"
path=data/add-ons/Corrupted_Elves/translations
[/textdomain]
[campaign]
#textdomain wesnoth-corrupted_elves
id=corrupted_elves
name=_"Corrupted Elves"
abbrev="CE"
define=CAMPAIGN_CORRUPTED_ELVES
icon="units/elves-wood/avenger-sword-1.png~RC(magenta>purple)"
image="data/add-ons/Corrupted_Elves/images/Wohael.png~RC"
first_scenario="01_Shady_Battle"
description=_"Follow the story of Wohael and his troops, corrupted by a demonic magic.
Will their tale end as an epic or a tragedy?"
difficulties=Medium
difficulty_descriptions=_"Medium"
[/campaign]
#ifdef CAMPAIGN_CORRUPTED_ELVES
[binary_path]
path=data/add-ons/Corrupted_Elves
[/binary_path]
{~add-ons/Corrupted_Elves/scenarios}
{~add-ons/Corrupted_Elves/maps}
#endif
Code: Select all
# Other campaign stuff up here.
description=_"Follow the story of Wohael and his troops, corrupted by a demonic magic.
Will their tale end as an epic or a tragedy?"
[difficulty]
define=NORMAL # Standardized difficulties are EASY, NORMAL, and HARD
description="Medium"
[/difficulty]
[/campaign]
-
- Posts: 3
- Joined: September 20th, 2020, 4:02 pm
Re: Custom Scenario make the game crash when loaded
I wroted down and used your advice, and it worked well ! Slowly but surely i'm learning.
There is some things that I can't do now, but it's probably because I'm not looking hard enough into other campaigns.
Thank you for your answers and advices !
There is some things that I can't do now, but it's probably because I'm not looking hard enough into other campaigns.
Thank you for your answers and advices !