A couple of questions

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
MrEPIC
Posts: 103
Joined: June 9th, 2009, 12:20 am
Location: GMT-6/-5

Re: A couple of questions

Post by MrEPIC »

melinath wrote:Did you ever figure out the problem with the illuminate halo? I don't see anything that's obviously wrong in the code that would cause the effect you were getting.
No, I still haven't figured that out yet... :(
Sapient wrote:Note, if you have already deleted an object/modification from a unit, then you can force the unit to be rebuilt from its base type using the TRANSFORM_UNIT macro.

For example:

Code: Select all

{TRANSFORM_UNIT id=$unit.id $unit.type}
This essentially levels the unit up into itself, then sets its hitpoints, experience, and status variables back.
Thank you for this advice, it should help.
3 player co-op campaign: The Haunted Woods (v1.6.19)
1v1 campaign: Tug of War (v0.4.0)
User avatar
MrEPIC
Posts: 103
Joined: June 9th, 2009, 12:20 am
Location: GMT-6/-5

Re: A couple of questions

Post by MrEPIC »

Hello again, I have another question:
How can I make the AI send units to a specific place on the map?
I know that I can use leader_goal to tell the leader to go somewhere and use protect_location to tell the AI to send units somewhere if there's an enemy nearby but I'm just wondering if there's any way to tell the AI to send units to a place on the map to do something like try to get to an item before the player.

Thanks for any help!

Oh, and by the way, if anybody has any answers to my first question about giving a unit the illuminates aura, please answer :!:
3 player co-op campaign: The Haunted Woods (v1.6.19)
1v1 campaign: Tug of War (v0.4.0)
dvormann
Posts: 51
Joined: July 24th, 2009, 11:33 am

Re: A couple of questions

Post by dvormann »

Regardinghe the illuminate halo. Does [object] work, i.e. the unit gains magical arcane?

What does {ABILITY_ILLUMINATES_THW} do? Can you post that? I guess there is a differnce to standard {ABILITY_ILLUMINATES}.

I'd like to find out if {ABILITY_ILLUMINATES_THW} uses variables X or Y in any way?

Can you place a debug message between [/object] and [unit_overlay] that displays values of X any Y? Should read:

Code: Select all

[/object]
{DEBUG_MSG "{X} {Y}"}
[unit_overlay]
"m" is the key used most in Wesnoth.
User avatar
MrEPIC
Posts: 103
Joined: June 9th, 2009, 12:20 am
Location: GMT-6/-5

Re: A couple of questions

Post by MrEPIC »

dvormann wrote:Regardinghe the illuminate halo. Does [object] work, i.e. the unit gains magical arcane?

What does {ABILITY_ILLUMINATES_THW} do? Can you post that? I guess there is a differnce to standard {ABILITY_ILLUMINATES}.

I'd like to find out if {ABILITY_ILLUMINATES_THW} uses variables X or Y in any way?

Can you place a debug message between [/object] and [unit_overlay] that displays values of X any Y? Should read:

Code: Select all

[/object]
{DEBUG_MSG "{X} {Y}"}
[unit_overlay]
The object works, and ABILITY_ILLUMINATES_THW is just illuminates with a changed description. The DEBUG_MSG works too.
3 player co-op campaign: The Haunted Woods (v1.6.19)
1v1 campaign: Tug of War (v0.4.0)
dvormann
Posts: 51
Joined: July 24th, 2009, 11:33 am

Re: A couple of questions

Post by dvormann »

What does the debug message say? Do X and Y have the correct coordinates?
"m" is the key used most in Wesnoth.
User avatar
MrEPIC
Posts: 103
Joined: June 9th, 2009, 12:20 am
Location: GMT-6/-5

Re: A couple of questions

Post by MrEPIC »

dvormann wrote:What does the debug message say? Do X and Y have the correct coordinates?
The Debug message says the coordinates of the shop.
3 player co-op campaign: The Haunted Woods (v1.6.19)
1v1 campaign: Tug of War (v0.4.0)
dvormann
Posts: 51
Joined: July 24th, 2009, 11:33 am

Re: A couple of questions

Post by dvormann »

The ways I understand it you have the following:

Code: Select all

                                    {DEBUG_MSG "{X} {Y}"}
                                    [unit_overlay]
                                        x={X}
                                        y={Y}
                                        image=halo/illuminates-aura.png
                                    [/unit_overlay]
The message prints one set of coordinates and the halo appears somewhere else. Something is wrong with {X} and {Y}.

For debugging, you can try:

a) replace x={X} y={Y} with the actual coordinates of the shop. Does the halo appear in the right place? (I hope it does but maybe there's something wrong with your version of Wesnoth.)
b)

Code: Select all

                                    {DEBUG_MSG "{X} {Y}"}
                                    [unit_overlay]
                                        x={X}
                                        y={Y}
                                        {DEBUG_MSG "{X} {Y}"}
                                        image=halo/illuminates-aura.png
                                    [/unit_overlay]
                                    {DEBUG_MSG "{X} {Y}"}
Do all three messages print the same set of coordinates?

Another idea: Perhaps unit_overlay does not like {}.

In that case try

Code: Select all

                                    [set_variable]
                                        name=usex
                                        value={X}
                                    [/set_variable]
                                    [set_variable]
                                        name=usey
                                        value={Y}
                                    [/set_variable]
                                    [unit_overlay]
                                        x=$usex
                                        y=$usey
                                        image=halo/illuminates-aura.png
                                    [/unit_overlay]
"m" is the key used most in Wesnoth.
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: A couple of questions

Post by silene »

dvormann wrote:Do all three messages print the same set of coordinates?
That's not how WML works. You can't put things in random places and expect them to work. In particular, the debug message inside the [unit_overlay] won't have any effect.
dvormann wrote:Another idea: Perhaps unit_overlay does not like {}.
Brackets are preprocessor symbols, which are expanded only once (usually the first time you run a campaign). By the time [unit_overlay] is run, the brackets have long disappeared and their content been replaced. If it doesn't work with [unit_overlay], it won't work either with [set_variable].
dvormann
Posts: 51
Joined: July 24th, 2009, 11:33 am

Re: A couple of questions

Post by dvormann »

The problem is unsolved for two weeks. Most people seem to agree that the code as published _should_ work. So I am looking for unlikely solutions. Like WML not working in exactly the way one expects it to.

However, I have yet another idea:

It is a moveto event, right? If the wiki can be trusted (of which I am not sure) then the loaction the unit moved to is stored in x1 and y1. So, in theory, {X} and x1 should have the same value. Try replacing {X} and {Y} with $x1 and $y1.
"m" is the key used most in Wesnoth.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: A couple of questions

Post by zookeeper »

dvormann wrote:The problem is unsolved for two weeks. Most people seem to agree that the code as published _should_ work. So I am looking for unlikely solutions. Like WML not working in exactly the way one expects it to.
He's trying to use an image bigger than 72x72, that's the problem apparently. It don't work.
User avatar
MrEPIC
Posts: 103
Joined: June 9th, 2009, 12:20 am
Location: GMT-6/-5

Re: A couple of questions

Post by MrEPIC »

zookeeper wrote:
dvormann wrote:The problem is unsolved for two weeks. Most people seem to agree that the code as published _should_ work. So I am looking for unlikely solutions. Like WML not working in exactly the way one expects it to.
He's trying to use an image bigger than 72x72, that's the problem apparently. It don't work.
I also tried this with the cave beam from the map editor (images/terrain/cave/beam.png), which shouldn't be larger than 72x72 because it fits on one hex, and it also doesn't work, and appears on a different part of the map. Or am I thinking wrong and this image is also too large?
3 player co-op campaign: The Haunted Woods (v1.6.19)
1v1 campaign: Tug of War (v0.4.0)
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: A couple of questions

Post by Iris »

Note that for adding the illuminates ability aura you should be setting the unit's halo as in:

Code: Select all

[store_unit]
    [filter]
        ...
    [/filter]
    variable=stored_unit
[/store_unit]

{VARIABLE stored_unit.halo path/to/illuminates/aura.png}

[unstore_unit]
    variable=stored_unit
    find_vacant=no
[/unstore_unit]
However I believe this doesn't currently work - IIRC the engine automatically resets the halo to the unit type's default, or none if it does not have one.

Your cave beam overlay won't work for two reasons:

a) the leading images/ ; the engine will try to locate it in paths like /data/core/images/images/... instead.
b) beam.png is 180x216 pixels in 1.6 and 1.7.

The terrain builder engine does some magic to center it on a single hex; the same magic that is used with other terrain graphics which are larger than 72x72 or aren't even centered by themselves.
Last edited by Iris on August 19th, 2009, 2:42 pm, edited 2 times in total.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
MrEPIC
Posts: 103
Joined: June 9th, 2009, 12:20 am
Location: GMT-6/-5

Re: A couple of questions

Post by MrEPIC »

Although almost 10 months have passed since the last post here, I decided to continue to use this as my workshop help thread.
Now I arrive with a new question about lua:
Spoiler:
Thanks for all help, I'm still learning lua so don't be surprised if I made an obvious mistake.
3 player co-op campaign: The Haunted Woods (v1.6.19)
1v1 campaign: Tug of War (v0.4.0)
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: A couple of questions

Post by silene »

MrEPIC wrote:However, when I use :inspect to check "lua_side_info," it shows a number of empty [lua_side_info] containers(is that the right term?).
WML doesn't have arrays, it only has sequence of containers. So the following should fill the [lua_side_info] containers with a name= attribute.

Code: Select all

table.insert(team_names, { name = t.team_name })
MrEPIC wrote:Another question: Are seperate lua files (for example wesnoth.dofile(file.lua)) transmitted over multiplayer?
Only the content of scenarios is sent over the network. Everything else (separate lua files, unit types, unit graphisms, and so on) has to be installed locally, for instance through an era.
Post Reply