enclave's WML Macros questions Thread

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
beetlenaut
Developer
Posts: 2813
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: enclave's WML Macros questions Thread

Post by beetlenaut »

I've never used image_mod myself, but you don't seem to be using it right according to the wiki. It adds image path functions, but it looks like you are adding an image with a path function. It looks like you have to start with "BLIT". That may be why it's not working right.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: enclave's WML Macros questions Thread

Post by zookeeper »

I was just about to post that it worked just fine for me (I saw one corner of a camp wall), but what beetlenaut said makes perfect sense. It's kind of weird that I saw any part of it working at all. Anyway, in stderr you should see an "error display: error parsing image modifications: misc/blank-hex.png".
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave »

Yeah, thank you both very much, for all your time and efford!

I forgot to use BLIT with image_mod because I was trying it with "[unit] overlays=" before trying image_mod (and [unit_overlay], but it's same..)
and for me it worked perfect without blit as well, thats why I forgot it :) maybe it was error in middle of my screen, maybe not.. :)

I was really sleepy that day and now I found my stupid mistake..
before I tried other things and one of them was this:

Code: Select all

{VARIABLE cg_temp_action_unit.modifications.object.effect[$cg_temp_action_unit.modifications.object.effect.length].apply_to image_mod}
{VARIABLE cg_temp_action_unit.modifications.object.effect[$cg_temp_action_unit.modifications.object.effect.length].add "misc/blank-hex.png~BLIT(terrain\castle\encampment\tall-keep-convex-br.png~CROP(22,43,30,35)~SCALE(30,30),17,40)~BLIT(terrain/castle/encampment/tall-keep-concave-tr.png~CROP(52,54,58,63)~SCALE(39,39)~FL(horiz),21,30)"}
and after that it was this:

Code: Select all

[unstore_unit]
variable=cg_temp_action_unit
[/unstore_unit]
and of course I forgot to delete the "[unstore_unit]" part when I tried other things instead of "{VARIABLE" part..
so what was happening was that [object] probably was working perfectly fine (or maybe with error.. deleted by my [options] messages) but then as soon as i closed the messages the overlay was disappearing after [unstore_unit] to it's previous state (without image_mod)..

my silly silly silly silly mistake.. im so sorry for wasting your time..
thanks for pointing out at BLIT mistake.. I hoped it would fix my previous method:

Code: Select all

{VARIABLE cg_temp_action_unit.modifications.object.effect[$cg_temp_action_unit.modifications.object.effect.length].apply_to image_mod}
{VARIABLE cg_temp_action_unit.modifications.object.effect[$cg_temp_action_unit.modifications.object.effect.length].add "BLIT(terrain\castle\encampment\tall-keep-convex-br.png~CROP(22,43,30,35)~SCALE(30,30),17,40)~BLIT(terrain/castle/encampment/tall-keep-concave-tr.png~CROP(52,54,58,63)~SCALE(39,39)~FL(horiz),21,30)"}
[unstore_unit]
variable=cg_temp_action_unit
[/unstore_unit]
but no, unfortunatey it doesnt work.. not sure what I do wrong about it :)
PS. found what I do wrong.. my code above has created 2 separate effects as if I wrote it like this:
Spoiler:
the fix would look like this:

Code: Select all

{VARIABLE cg_temp_arr_length $cg_temp_action_unit.modifications.object.effect.length}
{VARIABLE cg_temp_action_unit.modifications.object.effect[$cg_temp_arr_length].apply_to image_mod}
{VARIABLE cg_temp_action_unit.modifications.object.effect[$cg_temp_arr_length].add "BLIT(terrain\castle\encampment\tall-keep-convex-br.png~CROP(22,43,30,35)~SCALE(30,30),17,40)~BLIT(terrain/castle/encampment/tall-keep-concave-tr.png~CROP(52,54,58,63)~SCALE(39,39)~FL(horiz),21,30)"}
{CLEAR_VARIABLE cg_temp_arr_length}
[unstore_unit]
variable=cg_temp_action_unit
[/unstore_unit]
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave »

Anyone knows if there is a way to make separate [movement_costs] for road terrain type?
I mean for example so that unit on flat would have 3mp cost but only 1mp cost on road.?
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: enclave's WML Macros questions Thread

Post by Ravana »

Assuming mp-nodownload, no. But it might be possible to create such portals like teleport uses.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: enclave's WML Macros questions Thread

Post by zookeeper »

enclave wrote:Anyone knows if there is a way to make separate [movement_costs] for road terrain type?
I mean for example so that unit on flat would have 3mp cost but only 1mp cost on road.?
No, not possible.
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave »

Thanks very much Ravana and zookeeper, saved me a lot of time trying to find it somewhere in help.
I will try to workaround it using filter location and modifying moves then.. not sure how it will work, but time will tell.

A new question..
I have ability like this:

Code: Select all

[abilities]
[resistance]
active_on=defense
add=25
apply_to="blade"
description="Fortified unit has 25% Increased Resistance"
id="cg_fortified"
max_value=100
name="fortified"
[/resistance]
[resistance]
active_on=defense
add=20
apply_to="arcane"
description="Fortified unit has 25% Increased Resistance"
id="cg_fortified"
max_value=100
name="fortified"
[/resistance]
[/abilities]
and it shows ability 2 times on my unit.. but both resistances have same id.. shouldn't it only show 1? like leadership (level1, level2, level3.. etc)
What am I doing wrong?

PS. tried to put cumulative=yes and cumulative=no , no changes..
PPS. I still don't know what I did wrong, but i solved my problem just by removing all following name and description.. like so:
Spoiler:
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave »

I was playing with advance and post advance events and found wiki description a bit misleading.. or maybe I still havent figured out what I'm doing wrong..

I have advance event where I use store/unstore unit
in this case advance event is not happening, while unit actually levels.. I find it strange.. as wiki says:
advance

Triggers just before the primary unit is going to advance to another unit, or advance by AMLA. (This is after the player selects which advancement, if there is a choice). If this event removes the unit, changes the unit's type, or reduces the unit's experience below what it needs to advance, then the advancement is aborted. This also applies to advancement by AMLA.
I guess the author of wiki meant that post advance event is aborted (not advancement itself)? if the unit was removed via [unstore_unit]? Or I just have no idea what is going on.. my post advance just not happens at all.. in case of using [unstore_unit] in advance event on same unit.
According to author I select the advancement choice and then it is aborted.. is it? :D
I spent bloody ages looking for problem with my simple code.. and I still dont 100% get what I do wrong..
User avatar
beetlenaut
Developer
Posts: 2813
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: enclave's WML Macros questions Thread

Post by beetlenaut »

[unstore_unit] has advance= and fire_event=. I'm not sure if it's your problem, but check the information about those.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
gfgtdf
Developer
Posts: 1431
Joined: February 10th, 2013, 2:25 pm

Re: enclave's WML Macros questions Thread

Post by gfgtdf »

The worst part is that those default to a case that one usually never wants: The default is fire_event=no and advance=yes which means that the unit will advance but the advance events will not be fired. to get a useful behaviour you shodula dd fire_event=yes or advance=no to [unstore_unit].
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.
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave »

lol.. thanks so much beetlenaut and gfgtdf!
I already sorted my problem by changing the code and removing unstore from advance :D but the solution was so simple... silly me..

so i guess basically, these things are needed if you want to force unit to advance.. then you can just change his experience into max_experience and unstore it.. nice to know as well.. may be useful some day lol.. :) i just killed 3 hours of my life yesterday :D
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave »

Hi again! Some rather advanced questions:
1) anyone managed to make select event work in 1.12 ? (in multiplayer games) without OOS?
I mean is there way to synchronize the game state with lua or something..?

2) any wml to temporarily modify the cursor image during multiplayer game?
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: enclave's WML Macros questions Thread

Post by Ravana »

1) By only making UI changes, oos wont happen.
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

Re: enclave's WML Macros questions Thread

Post by enclave »

Sorry, Im very bad at abriviations.. "UI changes" means?

I want to make range attacks over couple hexes simplier than right-click unit (choose "select this unit to shoot") and then right click enemy unit.. (select "shoot")
for example just by selecting a unit via mouse click and then right click enemy unit to select "shoot"..
basically something that would always store a selected unit and then use it if needed..

so if I selected a unit he would be [store_unit] stored...
and then attack was performed via stored unit damage and strikes to right click menu unit..

Im quite sure it would change the game state... or am I wrong...

I would maybe also like an image near my mouse pointer.. of something related to shooting.. but I haven't decided what exactly I want.. it will all depend on what I actually can do.. trying to figure out the tools available first..
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: enclave's WML Macros questions Thread

Post by Ravana »

User Interface.
Post Reply