[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
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Question about [move_unit]

Post by Ravana »

I think easiest way to do it is with [store_unit]side=2 kill=no and then with {FOREACH} move 1 kill 1 {NEXT}
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Question about [move_unit]

Post by Paulomat4 »

Thank you, and thanks to Adamant14 who helped me per PM.
This is the working result.

Code: Select all

[store_unit]
      [filter]
         side=2
      [/filter]
      variable=movers
      kill=no
   [/store_unit]
   {FOREACH movers i}
      [move_unit]
         id=$movers[$i].id
         to_x=44
         to_y=12
      [/move_unit]
      [kill]
         id=$movers[$i].id
         animate=no
      [/kill]
   {NEXT i}
   {CLEAR_VARIABLE movers}
You guys are great :D
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
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Question about [move_unit]

Post by Anonymissimus »

more elegant: use [move_unit]side=2 fire_event=yes and make an [event]name=moveto for said coordinates which [kill]s the unit with id=$unit.id.
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
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Question about [move_unit]

Post by Paulomat4 »

more elegant: use [move_unit]side=2 fire_event=yes and make an [event]name=moveto for said coordinates which [kill]s the unit with id=$unit.id.
I feel silly now. I should have thought of that. :roll:
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

Getting a Lua error without even using Lua???

Post by Paulomat4 »

I get this ingame error message:
Sans titre.jpg
when trying this scenario:

Code: Select all

[scenario]
  id=06_woodchoppers
  next_scenario=null
 
  name= _ "Woodchoppers"
  map_data="{~add-ons/Rise_of_the_second_sun/maps/06_woodchoppers.map}"
  {TURNS 32 26 20}
  victory_when_enemies_defeated=no

  {DUSK}
  {FIRST_WATCH}
  {SECOND_WATCH}
  {DAWN}
  {MORNING}
  {AFTERNOON}
  
  {MOOD_HUSHED}
  
    [story]
        [part]
            story= _ ""
            background=story/waterfall.png
        [/part]
        [part]
            story= _ ""
            background=story/forestgate.png
        [/part]
        [part]
            story= _ ""
            background=story/map.png
        [/part]
   [/story]
   {BIGMAP_WOODCHOPPERS}

[side]
    side=1
    controller=human
    team_name=1
    user_team_name= _ "Aethen's representants"

    type=Elvish Thunderer
    id=Fiannon
    name= _ "Fiannon"
	profile=portraits/Fiannon.png
    canrecruit=yes

    recruit=Elvish Fighter,Elvish Archer,Elvish Shaman,Elvish Scout

    {GOLD 150 100 50}
    {INCOME 2 0 -2}
	{FLAG_VARIANT long}
[/side]
[side]
    side=2
    controller=ai
    team_name=2
    user_team_name= _ "Elvish Ghosts"
	no_leader=yes

	recruit=Elvish Warrior Spirit
    {GOLD 250 350 450}
    {INCOME 5 10 15}
    {FLAG_VARIANT ragged}
    [ai]
    village_value=0
	[avoid]
        x,y=2-4,22-24
		radius=9
    [/avoid]
    [/ai]
  [/side]
  [side]
    side=3
    controller=ai
    team_name=3
    user_team_name= _ "Bandits"

	no_leader=yes
#ifdef EASY
        recruit=Ruffian,Thug
#endif

#ifdef NORMAL
        recruit=Ruffian,Thug,Poacher
#endif

#ifdef HARD
        recruit=Footpad,Thief,Poacher,Thug
#endif
        [ai]
            {ATTACK_DEPTH 4 5 6}
#ifdef EASY
            recruitment_pattern=fighter
#endif
#ifdef NORMAL
            recruitment_pattern=fighter,fighter,archer
#endif
#ifdef HARD
            recruitment_pattern=scout,fighter,archer,archer
#endif
    village_value=0
	[avoid]
        x,y=2-4,22-24
		radius=9
    [/avoid]
        [/ai]


    {GOLD 250 350 450}
    {INCOME 5 10 15}
    {FLAG_VARIANT ragged}
	

  [/side]
    [side]
    side=4
    controller=ai
    team_name=1
    user_team_name= _ "Guarrison of Aldril"

	type=Lieutenant
    id=Raief
    name= _ "Raief"
	profile=portraits/Raief.png
    canrecruit=yes

    {GOLD 100 100 100}
    {INCOME 0 0 0}
    {FLAG_VARIANT loyalist}
	
    {STARTING_VILLAGES 10 11}
	{STARTING_VILLAGES 12 11}
    {STARTING_VILLAGES 11 13}
	{STARTING_VILLAGES 8 12}
    {STARTING_VILLAGES 6 13}
	{STARTING_VILLAGES 7 15}
    {STARTING_VILLAGES 8 15}
	{STARTING_VILLAGES 5 15}
    {STARTING_VILLAGES 4 16}
	{STARTING_VILLAGES 7 17}
	{STARTING_VILLAGES 9 18}
	{STARTING_VILLAGES 11 19}
	{STARTING_VILLAGES 13 20}
	{STARTING_VILLAGES 14 18}
	{STARTING_VILLAGES 15 17}
	{STARTING_VILLAGES 13 16}
	{STARTING_VILLAGES 17 17}
	{STARTING_VILLAGES 19 16}
	{STARTING_VILLAGES 18 13}
	
    [ai]
	{MICRO_AI_GUARDIAN}
    [/ai]
  [/side]
  
    [event]
        name=prestart
		[time_area]
            x=5
            y=22
			radius=2
            {MORNING}
            {AFTERNOON}
            {AFTERNOON}
            {DUSK}
            {DAWN}
            {MORNING}
        [/time_area]
	    [item]
            x=5
            y=22
            image=scenery/lighthouse.png
            halo=halo/lighthouse-aura.png
        [/item]
	    [item]
            x=7
            y=15
            image=scenery/shop-sign.png~RC(magenta>purple)
        [/item]
	    [item]
            x=4
            y=18
            image=scenery/transport-galleon-se.png~RC(magenta>purple)
        [/item]
	    [item]
            x=7
            y=19
            image=scenery/galleon-se.png~RC(magenta>purple)
        [/item]
	    [item]
            x=9
            y=20
            image=scenery/transport-galleon-se.png~RC(magenta>purple)
        [/item]
		{PLACE_IMAGE (scenery/anvil.png) 9 16}
		{PLACE_IMAGE (scenery/log.png) 52 23}
		{PLACE_IMAGE (scenery/log.png) 54 21}
		{PLACE_IMAGE (scenery/log.png) 58 22}
		{PLACE_IMAGE (scenery/log.png) 58 25}
		{PLACE_IMAGE (scenery/logs.png) 55 24}
		{PLACE_IMAGE (scenery/boat-se.png) 11 21}
		{PLACE_IMAGE (scenery/hay.png) 4 7}
		{PLACE_IMAGE (scenery/signpost.png) 48 33}
		
    	[unit]
            type=Spearmen
			id=guard1
            side=4
            x=13
            y=21
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard1
            return_x,return_y=13,21
        [/micro_ai]
		
	    [unit]
            type=Spearmen
			id=guard2
            side=4
            x=16
            y=19
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard2
            return_x,return_y=16,19
        [/micro_ai]
		
	    [unit]
            type=Spearmen
			id=guard3
            side=4
            x=18
            y=17
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard3
            return_x,return_y=18,17
        [/micro_ai]
		
	    [unit]
            type=Spearmen
			id=guard4
            side=4
            x=20
            y=16
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard4
            return_x,return_y=20,16
        [/micro_ai]
		
	    [unit]
            type=Spearmen
			id=guard5
            side=4
            x=19
            y=13
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard5
            return_x,return_y=19,13
        [/micro_ai]

	    [unit]
            type=Spearmen
			id=guard6
            side=4
            x=16
            y=11
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard6
            return_x,return_y=16,11
        [/micro_ai]
		
		{GENERIC_UNIT 4 (Spearman) 12 10}
	    [unit]
            type=Spearmen
			id=guard7
            side=4
            x=12
            y=10
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard7
            return_x,return_y=12,10
        [/micro_ai]
		
	    [unit]
            type=Spearmen
			id=guard8
            side=4
            x=10
            y=10
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard8
            return_x,return_y=10,10
        [/micro_ai]
		
	    [unit]
            type=Spearmen
			id=guard9
            side=4
            x=7
            y=12
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard9
            return_x,return_y=7,12
        [/micro_ai]
		
	    [unit]
            type=Spearmen
			id=guard10
            side=4
            x=4
            y=13
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard10
            return_x,return_y=4,13
        [/micro_ai]
		
	    [unit]
            type=Spearmen
			id=guard11
            side=4
            x=3
            y=16
        [/unit]
		[micro_ai]
            side=4
            ai_type=guardian_unit
            action=add

            guardian_type=return_guardian
            id=guard11
            return_x,return_y=3,16
        [/micro_ai]

		
	    [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]
		

	[/event]
	
	[event]
        name=moveto
		first_time_only=yes
        [filter]
            x=48
            y=33
        [/filter]
		[message]
		image=portraits/signpost.png
		message= _ "Direction NE: Aldril
		Direction NW: woodchoppers lodge
		Direction SW: Midlands"
		[/message]
	[/event]
  [/scenario]
The thing is, that i don't understand Lua, and i don't use it.
It doesn't happens in other scenarios than 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
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Getting a Lua error without even using Lua???

Post by gfgtdf »

Paulomat4 wrote:I get this ingame error message:
Sans titre.jpg
when trying this scenario:
The thing is, that i don't understand Lua, and i don't use it.
It doesn't happens in other scenarios than this.

well the message says that there is no unittype called "Spearmen" wich is correct unless you have added such a unit.

since a lot of wml is handeled by lua, there are sometimes wml errors that appear as lua errors.
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.
User avatar
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Getting a Lua error without even using Lua???

Post by Paulomat4 »

well, i schould be the standard spearmen, which is already include in the game.
Okay, i see now, it should be spearman. Quite a silly question.
But why doesn't it shows an unknown unit type error?
now I get this lua error:
Sans titre.jpg
Sans titre.jpg (7.2 KiB) Viewed 3405 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
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Getting a Lua error without even using Lua???

Post by gfgtdf »

Paulomat4 wrote: now I get this lua error:
Sans titre.jpg
have you stated you game in debug mode or changed the debug mode during the game?

really don't know what that means but it seems to be related to the AI.
to find yout wich part causes that error you could remove all the AI stuff and readd it successively and test it to find out wich one causes that error.

i think "mattsc" knows more about the AI system.
Paulomat4 wrote: But why doesn't it shows an unknown unit type error?
but the message said "Unknown unit type"...
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: Getting a Lua error without even using Lua???

Post by Anonymissimus »

Yes, mattsc is the AI expert, you can pm him for instance.
AFAIK the Lua AI debug functionality are a few features (1 function at least) which can be called by lua code in order to emit debugging information. However, you shouldn't get it when not doing something with Lua AI or when not calling that function. Perhaps it's a bug in the engine.
And you *are* using Lua no matter what, since large parts of the wml action engine are implemented in Lua nowadays, that's why you get that "unknown unit type" Lua error. You probably only need to look at and understand the first line (the error message), as long as it's an error caused by wml. If you think you aren't using Lua, it is.
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
Paulomat4
Moderator Emeritus
Posts: 730
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Getting a Lua error without even using Lua???

Post by Paulomat4 »

but the message said "Unknown unit type"...
Sorry, i referred to the typical unknown unit error, which appears when loading a scenario. But i guess, it appears after loading the scenario because the false spearman unit are created in a prestart event, which is loaded after the scenario. That confused me, sorry.
have you stated you game in debug mode or changed the debug mode during the game?
Yeah, most time when testing scenario's i load the game with debug mode already opened, because I already had it opened. As far as i know i haven't changed anything to debug mode, and the error appears also when starting the scenario without debug mode.
And you *are* using Lua no matter what...
Yeah, i know, but what i meant was when using Lua active.

after investigated a bit more and after clicking end turn even more Lua errors appear.
Sans titre.jpg
I'll pm mattsc. Hopefully he knows what to do.
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:Lua Errors, placing multihex images

Post by Paulomat4 »

I still don't have an answer from mattsc, but he haven't online, so i don't give up the hope. In the meantime, if anyone has an idea, why i get these errors, please tell me :augh:

On another front, i want to place an image on the screen. The problem is, that the image is bigger than 72x72 px and so i can't use image= within an [item] tag. But i can't use halo= neither, because it would place the image on top of the unit. The wiki didn't really help, anyone an idea?
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
doofus-01
Art Director
Posts: 4128
Joined: January 6th, 2008, 9:27 pm
Location: USA

Re: Re:Lua Errors, placing multihex images

Post by doofus-01 »

Paulomat4 wrote:On another front, i want to place an image on the screen. The problem is, that the image is bigger than 72x72 px and so i can't use image= within an [item] tag. But i can't use halo= neither, because it would place the image on top of the unit. The wiki didn't really help, anyone an idea?
You may need to use terrain graphics, rather than [item]. Look at the "great tree" terrain & terrain-graphics for an example.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Re:Lua Errors, placing multihex images

Post by SkyOne »

doofus-01 wrote:
Paulomat4 wrote:On another front, i want to place an image on the screen. The problem is, that the image is bigger than 72x72 px and so i can't use image= within an [item] tag. But i can't use halo= neither, because it would place the image on top of the unit. The wiki didn't really help, anyone an idea?
You may need to use terrain graphics, rather than [item]. Look at the "great tree" terrain & terrain-graphics for an example.
I, too, recommend to install a custom terrain for the matter.
You can also refer doofus-01's campaigns for it. There are some amazing multi-hex terrains in them.:)

(if your image is on a hex, using a terrain-overlay (Xx^Yy) is easier.)
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
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 »

Okay, so that's what i got until now:
my terrain.cfg:

Code: Select all

[terrain_type]
	symbol_image=../terrain/watchtower-elven.png
	id=elven_watchtower
	name= _ "Elven Watchtower"
	string=^Cvw
	aliasof=^Cv
	editor_group=Rotss
	hidden=yes
[/terrain_type]
my terrain-graphics.cfg

Code: Select all


# scenery overlay

{OVERLAY *^Cvw  ../terrain/watchtower-elven.png}
The supposed tile is even marked ingame with the right name (elvish watchtower)
but it doesn't shows the right image (still only the base image) And is also marked as unwalkable. :hmm:


Edit: Okay, i found the error because of the unwalkable terrain. Still the image i wanted it to have isn't there.
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
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Re:Lua Errors, placing multihex images

Post by SkyOne »

For terrains, I think:

Code: Select all

{OVERLAY *^Cvw  ../terrain/watchtower-elven.png}
should be:

Code: Select all

{OVERLAY *^Cvw  watchtower-elven}
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.
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
Post Reply