How to Prevent Rest Healing in Artificially Induced Poisoned

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.
Post Reply
User avatar
gweddeoran
Posts: 136
Joined: December 19th, 2014, 6:03 am
Location: Estmark Hills

How to Prevent Rest Healing in Artificially Induced Poisoned

Post by gweddeoran » August 2nd, 2019, 1:35 pm

In a scenario, there is a need to keep the player leader incurably poisoned throughout. It works, there is no curing whatsoever, but rest healing still takes place. How does one stop this from happening?

Here is the WML:

Code: Select all

[event]
        name = "turn refresh"
        first_time_only="no"

        [store_unit]
            [filter]
                id = "Typhon"
            [/filter]
            variable = "stored_typhon"
            kill = yes
        [/store_unit]

        [set_variables]
            name = "stored_typhon.modifications.object"
            [value]

                [effect]
                    apply_to = status
                    add = poisoned
                [/effect]

            [/value]
        [/set_variables]

# Not sure how it happened
# but Typhon can recover HP
# even while being poisoned
# however this should fix it

# Edit: It did not fix anything

#        [set_variables]
#            name = "stored_typhon.modifications.object"
#            [value]
#
#                [effect]
#                    apply_to = status
#                    add = unhealable
#                [/effect]
#
#            [/value]
#        [/set_variables]

#        [set_variables]
#             name = "stored_typhon.status.poisoned"
#             value = "yes"
#        [/set_variables]

        [unstore_unit]
            variable = "stored_typhon"
            find_vacant = yes
        [/unstore_unit]
        {CLEAR_VARIABLE stored_typhon}
    [/event]
Last edited by Pentarctagon on August 2nd, 2019, 2:03 pm, edited 1 time in total.
Reason: [c] -> [code]

Soliton
Site Administrator
Posts: 1581
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by Soliton » August 2nd, 2019, 6:21 pm

The "turn refresh" event happens after healing so that doesn't really help. The unhealable status should do what you want though so you need to set that properly. Probably just once somewhere at the start since I don't think anything resets it.
"If gameplay requires it, they can be made to live on Venus." -- scott

User avatar
Xalzar
Posts: 290
Joined: April 4th, 2009, 10:03 pm
Location: New Saurgrath

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by Xalzar » August 2nd, 2019, 8:17 pm

Like Soliton said, if the leader needs to have the unhealable status for the whole scenario, use a first_time_only=yes event, no need to refresh the effect.

Try to use this in your event:

Code: Select all

[object]
	[filter]
		id="Typhon"
	[/filter]
	id=artificial_poison #or whatever you want, you need this if you want to remove this object later with a [remove_object]
	take_only_once=yes
	duration=forever #or scenario, I usually use forever because I find it works better in my complex code
	[effect]
		apply_to=status
		add=poisoned
	[/effect]
	[effect]
		apply_to=status
		add=unhealable
	[/effect]
[/object]
or - if you really want to use stored variables - you were quite near to get it right I think... Try this after the store:

Code: Select all

[set_variable]
             name = "stored_typhon.status.poisoned"
             value = "yes"
[/set_variable]
[set_variable]
             name = "stored_typhon.status.unhealable"
             value = "yes"
[/set_variable]
Also, no need to kill poor Typhon (it could be detrimental if his death triggers events), you can safely store and unstore units without killing them.
Last edited by Xalzar on August 7th, 2019, 7:31 am, edited 1 time in total.

User avatar
gweddeoran
Posts: 136
Joined: December 19th, 2014, 6:03 am
Location: Estmark Hills

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by gweddeoran » August 3rd, 2019, 2:37 am

Thanks a lot for the remarks everyone!
@Xalzar- the first solution worked, the second didn't- I guess turn refresh and stored variables are too cumbersome and don't do the job anyway. :P
Also, is your location (New Saurgrath) by any chance from my campaign 'The Thelien Attack' (just wondering how many people here on the forums played it)?

User avatar
Xalzar
Posts: 290
Joined: April 4th, 2009, 10:03 pm
Location: New Saurgrath

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by Xalzar » August 3rd, 2019, 10:46 am

Glad it worked for you!
gweddeoran wrote:
August 3rd, 2019, 2:37 am
@Xalzar- is your location (New Saurgrath) by any chance from my campaign 'The Thelien Attack' (just wondering how many people here on the forums played it)?
Unluckily I've had no time to play campaigns in nearly a year, so since your campaign is recent I've certainly not played it. But since it's a Saurian campaign, I'll correct that as soon as possible! :mrgreen:
New Saurgrath is mostly an idea, is the hope that one day the scattered Saurian tribes - now reduced to mainly mercenaries and thieves - will reunite and rebuild their capital and the glorious Saurian Empire! 8)

(that said, I may have had some ideas for an unreleased campaign by me about this subject, but alas nothing came from it since I was very unexperienced in WML at the time - and now I'm not so much better either :P )

Xalzar - Saurian aficionado :D

User avatar
gweddeoran
Posts: 136
Joined: December 19th, 2014, 6:03 am
Location: Estmark Hills

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by gweddeoran » August 4th, 2019, 5:15 am

Oof, doesn't work entirely- the poison does show up, but doesn't do any loss of HP.

User avatar
Xalzar
Posts: 290
Joined: April 4th, 2009, 10:03 pm
Location: New Saurgrath

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by Xalzar » August 4th, 2019, 11:05 am

gweddeoran wrote:
August 4th, 2019, 5:15 am
Oof, doesn't work entirely- the poison does show up, but doesn't do any loss of HP.
You're right! :o
I really thought the poison effect to be part of the status, all defined by the game engine...but clearly I was wrong.
At least unhealable works correctly.

I'd say you should use a [harm_unit] in a turn refresh event to simulate the poison effect then. :whistle:

EDIT: or! Use directly [harm_unit] with poisoned=yes and 0 amount of damage and see if it works that way. :D

User avatar
gweddeoran
Posts: 136
Joined: December 19th, 2014, 6:03 am
Location: Estmark Hills

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by gweddeoran » August 4th, 2019, 3:24 pm

I tried that, but it didn't work. Instead, I have now done a compromise- rest-healing when next to a healer or on a village is now a mechanic of this affliction (with some story text relating to the properties of the poison as a justification). :P

Soliton
Site Administrator
Posts: 1581
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by Soliton » August 6th, 2019, 2:49 pm

Indeed unhealable also means no poison damage since that is part of the healing logic.
"If gameplay requires it, they can be made to live on Venus." -- scott

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

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by Ravana » August 6th, 2019, 3:14 pm

There is unit attribute which shows whether unit is resting. If you update it at right times you should be able to decide if resting should happen.

User avatar
Xalzar
Posts: 290
Joined: April 4th, 2009, 10:03 pm
Location: New Saurgrath

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by Xalzar » August 7th, 2019, 7:30 am

Soliton wrote:
August 6th, 2019, 2:49 pm
Indeed unhealable also means no poison damage since that is part of the healing logic.
What logic is that? How should anyone guess that's how it works? :augh: :P
Ravana wrote:
August 6th, 2019, 3:14 pm
There is unit attribute which shows whether unit is resting. If you update it at right times you should be able to decide if resting should happen.
Oooh...yeah!
A

Code: Select all

[set_variable]
             name = "stored_typhon.resting"
             value = "no"
[/set_variable]
in a side turn event should do the trick! :D

Soliton
Site Administrator
Posts: 1581
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: How to Prevent Rest Healing in Artificially Induced Poisoned

Post by Soliton » August 7th, 2019, 6:18 pm

Xalzar wrote:
August 7th, 2019, 7:30 am
Soliton wrote:
August 6th, 2019, 2:49 pm
Indeed unhealable also means no poison damage since that is part of the healing logic.
What logic is that? How should anyone guess that's how it works? :augh: :P
Yeah, I suppose that's up for debate what unhealable exactly means. Intuitively I would agree that it does not follow that poison does nothing. Not sure how much would break when changing that. Might be a good idea.
"If gameplay requires it, they can be made to live on Venus." -- scott

Post Reply