Unit appearance causing the game to crash

The place to post your WML questions and answers.

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.
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Unit appearance causing the game to crash

Post by revansurik »

Hi folks! This is what happened: I have changed the coding for an unit in my campaign, and also the images for it. However, when the updated unit appears onscreen, the game simply crashes, without any error message. With the old coding, this prolem didn't happen.

This is the new coding for the unit:

Code: Select all

#textdomain wesnoth-A_Song_of_Fire

#define DRAGON_UNWALKABLE_TERRAINS
!,Wwf,*^B*,!,W*,W*^V*,Chs,Chw,S*,S*^V*,Q*#enddef

[unit_type]
    id=Sky Dragon
    name= _ "Sky Dragon"
    race=monster
    image="units/svarballi/gold-dragon-base.png"
    {DEFENSE_ANIM_RANGE "units/svarballi/gold-dragon-base.png" "units/svarballi/gold-dragon-base.png" {SOUND_LIST:DRAKE_HIT} melee}
    hitpoints=350
    movement_type=smallfly
    movement=12
    experience=3000
    level=7
    alignment=neutral
    advances_to=null
    {AMLA_DEFAULT}
    cost=300
    undead_variation=drake
    usage=archer
    die_sound=drake-die.ogg
    description= _ "The Sky Dragon Svarballi is the mightiest of the three ancient High Dragons. After being defeated by the other two, he was placed in a deep slumber that lasted millennia. Now that he has been awakened again, every single being of Irdya is at great danger.

Having been created by the hands of the so-called Ancient Ones themselves, Svarballi, by his power and nigh-invincibility, is the closest thing to a god any dweller of Irdya has ever seen."+{SPECIAL_NOTES}+{SPECIAL_NOTES_MARKSMAN}+{SPECIAL_NOTES_LEADERSHIP}+{SPECIAL_NOTES_REGENERATES}+{SPECIAL_NOTES_SKIRMISHER}+{SPECIAL_NOTES_DRAGONFIRE}

    [standing_anim]
        start_time=0
        terrain_type={DRAGON_UNWALKABLE_TERRAINS}
        submerge=0.01
        [frame]
            image="units/svarballi/gold-dragon-fly-[01~09].png:50"
        [/frame]
        [frame]
            sound=dragon-wing-beat.ogg
            image="units/svarballi/gold-dragon-fly-10.png:50"
        [/frame]
        [frame]
            image="units/svarballi/gold-dragon-fly-[11~27].png:50"
        [/frame]
    [/standing_anim]
    [pre_movement_anim]
        start_time=0
        terrain_type=!,{DRAGON_UNWALKABLE_TERRAINS}
        [frame]
            image="units/svarballi/gold-dragon-liftoff-[01~22].png:50"
        [/frame]
    [/pre_movement_anim]
    [movement_anim]
        start_time=0
        submerge=0.01
        [frame]
            image="units/svarballi/gold-dragon-fly-[01~09].png:50"
        [/frame]
        [frame]
            sound=dragon-wing-beat.ogg
            image="units/svarballi/gold-dragon-fly-10.png:50"
        [/frame]
        [frame]
            image="units/svarballi/gold-dragon-fly-[11~27].png:50"
        [/frame]
    [/movement_anim]
    [post_movement_anim]
        terrain_type=!,{DRAGON_UNWALKABLE_TERRAINS}
        start_time=0
        [frame]
            image="units/svarballi/gold-dragon-landing-[01~15].png:50"
        [/frame]
    [/post_movement_anim]

    [abilities]
        {ABILITY_LEADERSHIP_LEVEL_5}
        {ABILITY_REGENERATES}
        {ABILITY_SKIRMISHER}
	[/abilities]
    [resistance]
	    arcane=90
        blade=50
        fire=30
        cold=30
        impact=50
        pierce=50
    [/resistance]
    [attack]
        name=bite
        description= _"bite"
        icon=attacks/fangs-animal.png
        type=blade
        range=melee
        damage=50
        number=2
    [/attack]
    [attack]
        name=tail
        description= _"tail"
        icon=attacks/tail-dragon.png
        type=impact
        range=melee
        damage=70
        number=1
    [/attack]
    [attack]
        name=heavenly fire
        description= _"heavenly fire"
        icon=attacks/fire-breath-drake.png
        type=arcane
        [specials]
            {WEAPON_SPECIAL_MARKSMAN}
            {WEAPON_SPECIAL_DRAGONFIRE 100}
        [/specials]
        range=ranged
        damage=100
        number=1
    [/attack]
      [attack]
        name=heavenly wrath
        description= _"heavenly wrath"
        icon=attacks/divine-lightning.png
        type=fire
        [specials]
            {WEAPON_SPECIAL_MAGICAL}
        [/specials]
        range=ranged
        damage=40
        number=6
    [/attack]
	

	
	[attack_anim]
		[filter_attack]
			name=bite
		[/filter_attack]
		start_time = -700
        [frame]
            image="units/svarballi/gold-dragon-bite-s-[01~09].png:50"
        [/frame]
        [if]
        	hits=no
	        [frame]
	            sound=dragon-bite-miss.ogg
	            image="units/svarballi/gold-dragon-bite-s-10.png:50"
	        [/frame]
        [/if]
        [else]
	        [frame]
	            sound=dragon-bite-hit.ogg
	            image="units/svarballi/gold-dragon-bite-s-10.png:50"
	        [/frame]
        [/else]
        [frame]
            image="units/svarballi/gold-dragon-bite-s-[11~21].png:50"
        [/frame]
	[/attack_anim]
	
	[attack_anim]
		[filter_attack]
			name=tail
		[/filter_attack]
		start_time = -950
        [frame]
            image="units/svarballi/gold-dragon-tail-se-[01~12].png:50"
        [/frame]
        [if]
        	hits=no
	        [frame]
	            sound=dragon-tail-miss.ogg
	            image="units/svarballi/gold-dragon-tail-se-13.png:50"
	        [/frame]
        [/if]
        [else]
	        [frame]
	            sound=dragon-tail-hit.ogg
	            image="units/svarballi/gold-dragon-tail-se-13.png:50"
	        [/frame]
        [/else]
        [frame]
            image="units/svarballi/gold-dragon-tail-se-[14~29].png:50"
        [/frame]
	[/attack_anim]	
	
 #define DRAGON_LIGHTNING DIRECTION_NUMBER
    [attack_anim]
        [filter_attack]
            name=heavenly wrath
        [/filter_attack]

        {LIGHTNING_BOLT {DIRECTION_NUMBER} }
            [frame]
                begin=-600
                end=-400
                image="units/svarballi/gold-dragon-cast-[01~06].png:50"
            [/frame]
        [if]
            hits=yes
            [frame]
                begin=-400
                end=0
                image="units/svarballi/gold-dragon-cast-[07~22].png:50"
                sound=lightning.ogg
            [/frame]
        [/if]
        [else]
            hits=no
            [frame]
                begin=0
                end=200
                image="units/svarballi/gold-dragon-cast-[23~27].png:50"
                sound=lightning-miss.ogg
            [/frame]
        [/else]
    [/attack_anim]
 #enddef

     {DRAGON_LIGHTNING 1}
     {DRAGON_LIGHTNING 2}
     {DRAGON_LIGHTNING 3}


	[attack_anim]
		[filter_attack]
			name=heavenly breath
		[/filter_attack]

		start_time = -1900
        [frame]
            image="units/svarballi/gold-dragon-fire-se-[01~16].png:50"
        [/frame]
        [frame]
            sound=dragon-flames.ogg
            image="units/svarballi/gold-dragon-fire-se-17.png:50"
        [/frame]
        [frame]
            image="units/svarballi/gold-dragon-fire-se-[18~61].png:50"
        [/frame]
	[/attack_anim]	
	

[/unit_type]
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Unit appearance causing the game to crash

Post by zookeeper »

Well the obvious question is: what did you change?
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Unit appearance causing the game to crash

Post by Anonymissimus »

Apart from that, the engine should of course never crash to the desktop because of some wml code. You should probably report this
https://gna.org/bugs/?group=wesnoth
and include description/way of how to reproduce it.
I doubt there's really no error message; look in your stderr.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Unit appearance causing the game to crash

Post by revansurik »

Well, I just added the animations - and new sprites - and the weapon special dragonfire...
I looked at the stderr file, it shows a list of things, but nothing that seems to cause the game to crash.
The stderr right after the occurrence of the error:
Spoiler:
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Unit appearance causing the game to crash

Post by SkyOne »

revansurik wrote:and the weapon special dragonfire.
Not really sure, but sounds like that is what it is.
Is this one you just added?

Code: Select all

#define DRAGON_UNWALKABLE_TERRAINS
!,Wwf,*^B*,!,W*,W*^V*,Chs,Chw,S*,S*^V*,Q*#enddef
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Unit appearance causing the game to crash

Post by revansurik »

The dragonfire macros are in another file; the DRAGON_UNWALKABLE_TERRAINS is to make the dragon fly when standing on those types of terrain
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Unit appearance causing the game to crash

Post by SkyOne »

What I mean was: - I had a trouble before without quotations on SPECIAL_NOTES.
But it was some ago, maybe around BfW 1.8.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Unit appearance causing the game to crash

Post by Anonymissimus »

revansurik wrote:I looked at the stderr file, it shows a list of things, but nothing that seems to cause the game to crash.
The stderr right after the occurrence of the error:
Spoiler:
The most interesting part should be at the end, but better paste the complete stderr output. Even better, launch wesnoth from the command line with the --log-debug=all parameter. Then we get an idea at what work step problems happen.
I doubt the multiple unit types are fatal.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Unit appearance causing the game to crash

Post by revansurik »

Even better, launch wesnoth from the command line with the --log-debug=all parameter.
You mean, to start debug mode and type that command? I've just tried it, but it says unknown command...
BTW, the stderr I put above was the whole stderr, not just the final part...
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Unit appearance causing the game to crash

Post by JaMiT »

revansurik wrote:Well, I just added the animations - and new sprites - and the weapon special dragonfire...
You could try undoing those changes one at a time in an effort to determine which one is causing the crash....
revansurik wrote:
Anonymissimus wrote:Even better, launch wesnoth from the command line with the --log-debug=all parameter.
You mean, to start debug mode and type that command?
No, debug mode is not the command line. The command line is the line where you can give the command to start a program. This can be a property of the shortcut/menu item you use to start the game (right-click it), or it can be something you type at a text prompt (which goes by various names under different operating systems: "terminal", "command prompt", "DOS prompt", etc.).
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Unit appearance causing the game to crash

Post by Anonymissimus »

revansurik wrote:
Even better, launch wesnoth from the command line with the --log-debug=all parameter.
You mean, to start debug mode and type that command? I've just tried it, but it says unknown command...
No, but you can use the ingame command line. Activate debug mode and the command there is then
log debug all
Just do it before the problem happens.
That output can sometimes give a wml author an idea about what's wrong, in order to find a workaround. So not just for solving a bug.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Unit appearance causing the game to crash

Post by revansurik »

Well, I did that, and ther stderr showed a huge log, but the final part, which is related to the appearance of the unit, is this:
Spoiler:
The last line says that the unit for side 10 (the Sky Dragon) is inserted; when that happens, the game simply crashes. I see nothing wrong in those lines, but then again, I'm not good with wml... :(
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Unit appearance causing the game to crash

Post by mattsc »

I played with this a little. The line that makes things crash is this one:

Code: Select all

    !,Wwf,*^B*,!,W*,W*^V*,Chs,Chw,S*,S*^V*,Q*#enddef
which is then included later as terrain_type in the standing animation. If you delete either of the ! in the line, the game does not crash. Now, I understand neither terrains nor animations very well, but that should give those of you who do a starting point what to look into.

Hope this helps.

EDIT: I had copied the changed line above (one that didn't crash the game), not the original one. Fixed now.
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Unit appearance causing the game to crash

Post by revansurik »

It worked! :-D First I tried to remove the !, but it still didn't work, so I simply removed the entire macro and the standing animation.
Thanks everyone for the help! ^_^
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Unit appearance causing the game to crash

Post by mattsc »

I'm glad you got it to work!

Still, this is a bug that should be reported (and hopefully get fixed). Even if the WML is incorrect (I'm not sure that it is), Wesnoth should never crash to desktop on a WML error, as already stated above.
Post Reply