thinking about petrify

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

Re: thinking about petrify

Post by beetlenaut »

Helmet wrote: November 15th, 2022, 1:22 pm It either works right out of the box, or it doesn't. If I have to figure-out what lines are missing, like beetlenaut expected me to do, the code will remain non-functional.
The problem is, none of the code you are using does exactly what you want, so you have to modify it. In order to do that, you need to understand what it's doing. I think you are typing random things and hoping for the best, which almost never works. (You invented $this_unit[$i] for example.) This is why I told you to read through the code to figure out why it works. It will take you a while I know, but you have many people here who would be happy to explain a part of it that you don't get. I don't tell you every line and character to type because I want to help you get to the level you want to be on, not write your add-on for you.
Helmet wrote: November 15th, 2022, 7:03 pm Thanks for helping. I looked in the deprecated code, and saw stuff about animated campfires and so forth.
The FOREACH and NEXT macros are second and third from the bottom of the file. I checked before I told you to look there.
Helmet wrote: November 15th, 2022, 7:03 pm It's not a modify_unit key.
It's a unit variable. In the wiki, it says that [modify_unit] works on anything that ends up stored with [store_unit] or can be seen with the :inspect command. You can see "resting" with :inspect, so I'm sure it can be changed with [modify_unit]. I'm just not sure when it gets checked for the healing. I would guess turn_refresh though. (I'm glad that you have learned that keys only work in a particular context, but it does more-or-less mention "resting" in this case.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: thinking about petrify

Post by Helmet »

Ravana wrote: November 15th, 2022, 7:36 pm id=$unit.id - who is $unit? Where you store it?
I thought $unit.id was the unit that was getting unpetrified.
Storing and unstoring units is something I rarely get right.
I basically referred to my notes and substituted parts for other parts.

My notes:

Code: Select all

#define STORE_BARAN
    [if]
        [have_unit]
            side=1
            id=Baran
            search_recall_list=yes
        [/have_unit]
        [then]
            [store_unit]
                [filter]
                    id=Baran
                [/filter]
                kill=yes
                variable=baran_store
            [/store_unit]
        [/then]
    [/if]
#enddef

Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: thinking about petrify

Post by Ravana »

In unit-related events you have access to unit and more autostored variables. This event however is side turn, so not related to one specific unit.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: thinking about petrify

Post by Helmet »

Ugh.

Coding wml is weird. Sometimes I expect something to be super-complicated and it turns out to be easy, and sometimes it's the exact opposite.

Different people have different learning styles. My style of learning is typically called by professionals in the field of education "visual."

And right now I'm visualizing deleting resting=no and "thawed" and using the code as is. :D
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Ravana
Forum Moderator
Posts: 2933
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: thinking about petrify

Post by Ravana »

Consider why the code works. How it knows which unit to unpetrify. That would be the same unit whose coordinate you want.
User avatar
beetlenaut
Developer
Posts: 2813
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: thinking about petrify

Post by beetlenaut »

Helmet wrote: November 15th, 2022, 8:12 pm And right now I'm visualizing deleting resting=no and "thawed" and using the code as is.
OK, I checked this. If you put [unpetrify] in turn_refresh event instead of new_turn event, the healing never happens, so there is no problem with text showing two things at once. The reason this works is that a turn_refresh event happens just after healing, and the unit was still petrified when the healing would have happened. Changing the event type shouldn't have any adverse effects.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Atreides
Posts: 1039
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: thinking about petrify

Post by Atreides »

Hey, just found this thread when searching on Beyond Southern Hells. It's funny you should have tried that old unpetrify code because I just remade it for the era. The old code had some limitations such as only working with standard healers (8) and nothing else. I went a different way, I just unstone them on side turn and restone them on turn refresh. That way they get healed by villages (really bad if a unit gets stoned on a critical village...) and regen and any level of healer.
Post Reply