dabber's questions: last breath

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
dabber
Posts: 383
Joined: April 2nd, 2014, 6:41 pm

Re: dabber's questions: check unit status

Post by dabber »

I cannot seem to check whether a unit is undead or not. What am I doing wrong? Truncated code below: (AoE drain attack)
Spoiler:
I can correctly check other information in the units variable, such as hitpoints and resistances, but I cannot seem to check not_living.

User avatar
Ravana
Forum Moderator
Posts: 2430
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: dabber's questions: check not living

Post by Ravana »

I believe you do not want the first $ for name=.

dabber
Posts: 383
Joined: April 2nd, 2014, 6:41 pm

Re: dabber's questions: check not living

Post by dabber »

Well I feel dumb. That fixed it.
I write C code for a living, so I'm used to pointer dereference, but the $ in WML constantly gets me.

dabber
Posts: 383
Joined: April 2nd, 2014, 6:41 pm

Re: dabber's questions: all terrain

Post by dabber »

Is there an easy way to make all terrain types unwalkable, and then make one terrain type cost 1 move? I don't want to have to individually list each type I want to set unwalkable. The goal is to let the unit move across only one type of terrain.
It seems like all I ask in this thread is dumb questions. :)

User avatar
Ravana
Forum Moderator
Posts: 2430
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: dabber's questions: all terrain

Post by Ravana »

Not really. Ideas might be
- switching movetype
- unwalkable overlay
but they all have limitations and side effects.

You can also iterate over movement_costs keys, but that would be more work than hardcoding existing terrain types.

User avatar
Pentarctagon
Forum Administrator
Posts: 4331
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: dabber's questions: all terrain

Post by Pentarctagon »

Would [terrain_defaults] help with this?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

dabber
Posts: 383
Joined: April 2nd, 2014, 6:41 pm

Re: dabber's questions: all terrain

Post by dabber »

If I create two last breath events for a unit, but one of the events kills the unit via [kill], will the second last breath always fire?
My second event doesn't seem to be firing and I'm trying to find a cause. I see both events in the save file looking correct.

User avatar
Adamant14
Posts: 905
Joined: April 24th, 2010, 1:14 pm

Re: dabber's questions: all terrain

Post by Adamant14 »

dabber wrote:
April 8th, 2019, 4:31 pm
If I create two last breath events for a unit, but one of the events kills the unit via [kill], will the second last breath always fire?
My second event doesn't seem to be firing and I'm trying to find a cause. I see both events in the save file looking correct.
If you kill the unit via [kill] tag in your first last breath event, then the unit does no longer exist, and the second last breath will never fire.

https://wiki.wesnoth.org/Eventwml#last_breath

https://wiki.wesnoth.org/Eventwml#die
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR

User avatar
Ravana
Forum Moderator
Posts: 2430
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: dabber's questions: last breath

Post by Ravana »

I believe you are not given any guarantee in which order the events would fire.

dabber
Posts: 383
Joined: April 2nd, 2014, 6:41 pm

Re: dabber's questions: all terrain

Post by dabber »

Adamant14 wrote:
April 9th, 2019, 5:27 pm
dabber wrote:
April 8th, 2019, 4:31 pm
If I create two last breath events for a unit, but one of the events kills the unit via [kill], will the second last breath always fire?
My second event doesn't seem to be firing and I'm trying to find a cause. I see both events in the save file looking correct.
If you kill the unit via [kill] tag in your first last breath event, then the unit does no longer exist, and the second last breath will never fire.

https://wiki.wesnoth.org/Eventwml#last_breath

https://wiki.wesnoth.org/Eventwml#die
I read that exact link, but I didn't think the wording was decisive, which is why I posted the question. Yet now that I think about it again, it can only be this way. Mentally I think of the event as tied to the unit, but structurally that's incorrect. Only the filter ties it to the unit, and the filter will fail after [kill]. I need to restructure.

Post Reply