[remove_shroud] and [terrain] question

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.
Post Reply
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Re:Lua Errors, placing multihex images

Post by Paulomat4 »

should be

Code: Select all

{OVERLAY *^Cvw  watchtower-elven}
Thanks, now everything works as expected.
Anyway, as your image is a watchtower, creating its unit is another way, like the Orcish Watchtower on SotBE. You can add a weapon(s) in the case.
This wasn't my goal, since its for decoration purposes only.
Thank for your help! :D
I still have the Lua errors, thought :annoyed:
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

[move_unit] to a certain kind of terrain, no coordinates

Post by Paulomat4 »

I want to move a unit to the next hex of a certain terrain type.
I looked at [move_unit] in the wiki but apparently it can only be coordinates.
I thought i found a workaround but it doesn't seem to work. It shows the error
<Invalid WML found> invalid coordinate in [move_unit]
Anybody an idea?

Code: Select all

[store_locations]
		    [filter]
			    x=$x1
				y=$y1
				radius=20
				terrain=*^Fet,*^Fetd
			[/filter]
		    variable=great_trees_to_teleport
		[/store_locations]
		[move_unit]
		    to_x=great_trees_to_teleport.x
			to_y=great_trees_to_teleport.y
		[/move_unit]
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: [move_unit] to a certain kind of terrain, no coordinates

Post by Dugi »

Replace this:

Code: Select all

          to_x=great_trees_to_teleport.x
         to_y=great_trees_to_teleport.y
By this:

Code: Select all

          to_x=$great_trees_to_teleport.x
         to_y=$great_trees_to_teleport.y
If something is not specifically made to accept variable names as arguments, you have to write the $ symbol before the variable name if using a variable, otherwise the variable name is regarded as an argument instead of its content, and because its name is not a number...
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: [move_unit] to a certain kind of terrain, no coordinates

Post by Paulomat4 »

Dugi wrote:Replace this:

Code: Select all

          to_x=great_trees_to_teleport.x
         to_y=great_trees_to_teleport.y
By this:

Code: Select all

          to_x=$great_trees_to_teleport.x
         to_y=$great_trees_to_teleport.y
If something is not specifically made to accept variable names as arguments, you have to write the $ symbol before the variable name if using a variable, otherwise the variable name is regarded as an argument instead of its content, and because its name is not a number...
(blushing for shame :oops: ) I feel so silly. Thanks. I should have checked that myself.
I corrected it but then wesnoth crashes and gives me this error. I'm using bfw 1.11.6 on windows.
Sans titre.jpg
Sans titre.jpg (22.13 KiB) Viewed 3777 times
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: [move_unit] to a certain kind of terrain, no coordinates

Post by trewe »

terrain is not an unit attribute so it can't be used in a SUF. Move it outside of the filter block (along with radius).

Code: Select all

[store_locations]
   terrain=*^Fet*
   [and]
      [filter]
         x,y=$x1,$y1
      [/filter]
      radius=20
   [/and]
   variable=great_trees_to_teleport
[/store_locations]
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: [move_unit] to a certain kind of terrain, no coordinates

Post by Dugi »

You are right that the standardLocationFilter in [store_locations] doesn't use a [filter] tag, unlike [store_unit]. But your code is pretty strange, using way too many tags without any reason, especially the [and] tag that causes the filter to run twice and look for intersections and the [filter] tag that makes the game also filter for a unit.

This could do the same without any problems:

Code: Select all

[store_locations]
   terrain=*^Fet*
   x,y=$x1,$y1
   radius=20
   variable=great_trees_to_teleport
[/store_locations]
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: [move_unit] to a certain kind of terrain, no coordinates

Post by Paulomat4 »

well, i didn't believed i'd ever say that, but dugi's one doesn't work. Again it shows the error
<Invalid WML found> invalid coordinate in [move_unit]
trewe's one works perfectly though.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

wesnoth crashing after event

Post by Paulomat4 »

okay, soduring the execution of either this event

Code: Select all

	[event]
	    name=last_breath
		[filter]
		    id=Maeblie
		[/filter]
		[message]
		    speaker=Maeblie
			message= _ "Ha, think you can get me? You're thinking wrong!"
		[/message]
		[move_unit]
		    id=Maeblie
		    to_x=56
			to_y=19
		[/move_unit]
		[animate_unit]
		    flag=pre_teleport
			[filter]
			    id=Maeblie
			[/filter]
		[/animate_unit]
		[kill]
		    animate=no
			fire_event=no
			id=Maeblie
		[/kill]
	[/event]
or this event:

Code: Select all

	[event]
	    name=last_breath
		[filter]
		    id=Maeblie
		[/filter]
		[message]
		    speaker=Maeblie
			message= _ "Ha, think you can get me? You're thinking wrong!"
		[/message][store_locations]
   terrain=*^Fet*
   [and]
      [filter]
         x,y=$x1,$y1
      [/filter]
      radius=20
   [/and]
   variable=great_trees_to_teleport
[/store_locations]
		[move_unit]
		    id=Maeblie
		    to_x=$great_trees_to_teleport.x
			to_y=$great_trees_to_teleport.y
		[/move_unit]
		[animate_unit]
		    flag=pre_teleport
			[filter]
			    id=Maeblie
			[/filter]
		[/animate_unit]
		[kill]
		    animate=no
			fire_event=no
			id=Maeblie
		[/kill]
        {CLEAR_VARIABLE great_trees_to_teleport}
	[/event]
wesnoth crashes repeatedly and gives this error message:
Sans titre.jpg
Sans titre.jpg (22.13 KiB) Viewed 3718 times
anyone an idea what could cause that? I heard somewhere, that wesnoth should not completely crash, from wml errors, but i'm not sure where :hmm:

this would be line 492 which is mentioned in the error message:

Code: Select all

	    [micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

 --->      guardian_type=coward
            id=Raief
            distance=7
            seek_x,seek_y=8,15
        [/micro_ai]
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: wesnoth crashing after event

Post by gfgtdf »

first of all the message points to line 492 of unit_map.hpp wich is part of the core and not part of you addon source.

i know nothing about that part of the source but some other informaiosn are always helpful:
1) does that problem appears with other versions of wesnoth (10.6, or 11.5 for example) as well?
2) could you make a very simple addon that replicates this error?
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.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: wesnoth crashing after event

Post by Anonymissimus »

anyone an idea what could cause that? I heard somewhere, that wesnoth should not completely crash, from wml errors, but i'm not sure where
Doesn't matter where, it is correct. Assertions failures as here are always such bugs. So, the way to go is to make a reproduction addon as gfgtdf says and report the issue. This may also get you a workaround in the process (for as long as the issue stays unfixed).
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
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: wesnoth crashing after event

Post by trewe »

Paulomat4 wrote:anyone an idea what could cause that? I heard somewhere, that wesnoth should not completely crash, from wml errors, but i'm not sure where :hmm:
Your location filter most likely returns an array (or do you have only one great tree on the map?). You may specify the index of the tree the unit should move to, 0 for the first match. Without this the variable would be threatened as simple scalars.

Code: Select all

# move to the first tree found
x,y=$great_trees_to_teleport[0].x,great_trees_to_teleport[0].y

# or, for example
# move to a random tree in range
{RANDOM 1..$great_trees_to_teleport.length}
{VARIABLE_OP random sub 1}
x,y=$great_trees_to_teleport[$random].x,great_trees_to_teleport[random].y
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: wesnoth crashing after event

Post by JaMiT »

Paulomat4 wrote:anyone an idea what could cause that?
You would be in the best position to narrow down the cause, since you are able to reproduce the crash. An example of something you could do is try trimming stuff out of your events. Does it still crash when you remove the [kill] tag? If you remove the [filter] (and change "id=Maeblie" to "id=$unit.id")? Try to get the event as simple as possible so others don't end up following red herrings.

Then (getting back to gfgtdf's advice) try putting the simplified event into an addon consisting of a single scenario, something along the lines of:

Code: Select all

[scenario]
    id=01_Assertion_Failure
    name=_"Assertion Failure"
    next_scenario=null

    map_data="usage=map
border_size=1

Gg          , Gg          , Gg          , Gg
Gg          , 1 Gg        , 2 Gg        , Gg
Gg          , Gg          , Gg          , Gg
Gg          , Gg          , Gg          , Gg
"
    turns=10
    {DEFAULT_SCHEDULE}

    [side]
        side=1
        controller=human

        type=Ancient Lich # Has a good number of magical attacks, so will often trigger the event.
        canrecruit=yes
    [/side]

    [side]
        side=2
        controller=ai

        type=Walking Corpse
        canrecruit=yes
        hitpoints=1
    [/side]

    # ##################################

    [event]
        # Fill in your simplified event here.
    [/event]

[/scenario]
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: wesnoth crashing after event

Post by Paulomat4 »

I'm still on this, i just hadn't really time to work on it.
You would be in the best position to narrow down the cause, since you are able to reproduce the crash. An example of something you could do is try trimming stuff out of your events. Does it still crash when you remove the [kill] tag? If you remove the [filter] (and change "id=Maeblie" to "id=$unit.id")? Try to get the event as simple as possible so others don't end up following red herrings.

Then (getting back to gfgtdf's advice) try putting the simplified event into an add-on consisting of a single scenario, something along the lines of:
Ok, so i tried filtering which part of the wml caused that error, and removed them one for one. It's actually the [kill] tag. without it, it worked good. I then changed the id=Maeblie to id=$unit.id and then the [kill] tag worked fine without an error. I still hadn't time do make a new add-on,which replicates it, but i'll do think of doing it.
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: wesnoth crashing after event, Moving unkown units back

Post by Paulomat4 »

Okay this is another thing i'm working on.
The code move all units to a certain location. After this (and some talking) I'd like to move them back where they come from. How would I do this? I know that i would need to store the location they come from somehow and after this move them back. The problem is that i don't know how to store the locations as they would not be x1,y1 or x2,y2 and there's no other standard location filter who include's coordinates as far as i know. http://wiki.wesnoth.org/StandardLocationFilter

Code: Select all

        {FOREACH moving_guards i}
        [move_unit]
            id=$moving_guards[$i].id
            to_x=17
            to_y=16
        [/move_unit]
        {NEXT i}
        {CLEAR_VARIABLE moving_guards}
EDIT:solved
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Firing event all x turns

Post by Paulomat4 »

Okay, so it has been quite some tie since I posted in this topic, i guess i'm getting a bit more used to wml :D
I am now trying to fire an event all x turns. for example all 2 turns. How would I do this?
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl
Post Reply