Spreading Poison

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.
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Spreading Poison

Post by JustNatan »

WhiteWolf wrote: December 11th, 2020, 5:44 pm Maybe it didn't work because the last side didn't have any poisoned units?
Could've been a reason, but they actually did (I just retestet it to make 100% sure).
I change the code. Start wesnoth. Start the scenario via loading the right .gz loadout. There are two sides.
Infecting an enemy unit. Ending turn. Opponent turn starts. Opponent makes a few moves. At the beginning and end of turn said poisoned unit stands next to a nonpoisoned unit (beginning shouldn't matter, but it should work so...). AI ends turn. Turn counter gets incremented. Poison did not spread.

I can give you the whole scenario code if you want me to ;)

Code: Select all

[event]
#THIS IS NONE WORKING CODE FAST READER!
    name="turn end" #change this to "side turn end" to make it work
    first_time_only=no

    [modify_unit]
            [filter]
                    side=$side_number
                    [not]
                            status=poisoned
                    [/not]
                    [filter_adjacent]
                            status=poisoned
                            is_enemy=no
                    [/filter_adjacent]
            [/filter]

            # Apply poisoned effect
            [effect]
                    apply_to=status
                    add=poisoned
            [/effect]
    [/modify_unit]
  [/event]
WhiteWolf wrote: December 11th, 2020, 5:44 pm If you run wesnoth in a terminal on linux, there's logs in it. It's also outputted to some log.txt on windows (I don't know where, someone will need to clarify the exact location). Those logs do contain these types of warnings. But there is no way for Wesnoth to tell you problems with stuff that is not syntactically wrong. No programming language compiler can do that.
Sure thing; that's not something I would expect (most make a clever guess though and throw warnings, just saying). If there is a pure logical mistake, it can't help of course (for example what I did here by using the wrong event name).
WhiteWolf wrote: December 11th, 2020, 5:44 pm There's a collection of syntax highlighters that people use for various editors in this topic.
cheers; it recommends the one I am currently using (but I didn' use the theme so it helps)
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Spreading Poison

Post by WhiteWolf »

JustNatan wrote: December 11th, 2020, 6:04 pm Could've been a reason, but they actually did (I just retestet it to make 100% sure).
I change the code. Start wesnoth. Start the scenario via loading the right .gz loadout. There are two sides.
Infecting an enemy unit. Ending turn. Opponent turn starts. Opponent makes a few moves. At the beginning and end of turn said poisoned unit stands next to a nonpoisoned unit (beginning shouldn't matter, but it should work so...). AI ends turn. Turn counter gets incremented. Poison did not spread.

I can give you the whole scenario code if you want me to ;)
It's a short enough fragment to drop into a test scenario - I tried it, but for me it works just fine, as "expected". Just to clarify again: you said your scenario has 2 sides. This code will only work when side 2 ends its turn, and it will poison units only belonging to side 2, if they have a poisoned unit next to them who is an ally of side 2 (in this case, this can only be another poisoned side 2 unit).
If you still think something's not right, attach a replay where you show what sided units are standing next to which others that are supposed to get the poison, so we can understand better what you mean ;)

What do you mean by "Start the scenario via loading the right .gz loadout."?
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Spreading Poison

Post by JustNatan »

I tried it on version 1.14 but I hope this is not the issue (in case you are using the dev version).
I am currently updating to the dev version and threw 1.14 of my harddrive (since there are some handy features in the dev version). So I can't test it right now. My download-speed is garbage so it will probably take a while before I can send you the replay. If it fixes itself by installing dev I will also report this of course.

Yes my scenario has 2 sides. And yes it should only work on adjacent units belonging to side 2 and yes it should only work when side 2 ends its turn. So yea I still think something isn't right (but it might be the version).

Till then :)
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Spreading Poison

Post by WhiteWolf »

I use 1.14 too. (Tried it on the steam release to be precise).
So that's very strange. It might indeed be a good idea to post your entire scenario file then :)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Spreading Poison

Post by JustNatan »

Beware of two things:
I changed "side turn end" => "turn end"
and I switched the leader of side=1 to "Orcish Slayer" so you have a poisonous unit (usually the player would pick himself a leader in the scenario before).

I did those two changes so you do not have to work on the code before you are able to play :)
I hope my changes are small enough that they are correct :p since I couldn't test them (wesnoth not installed atm, but downloading)

(file down below)
Attachments
dsa_intro.cfg
(3.14 KiB) Downloaded 161 times
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Spreading Poison

Post by WhiteWolf »

Your scenario has 3 sides, not 2.

Code: Select all

# Line 63 -> 66
  [side]
    side=3
    controller=ai
  [/side]
Even if you don't fill it in, it's there for the game. Therefore the turn end event runs when side 3 end its turn, trying to poison side 3 units, which don't exist ;)

EDIT:
Because of
and I switched the leader of side=1 to "Orcish Slayer" so you have a poisonous unit
Do you know about the in-game :debug command? It enables a series of shortcuts for debugging work, like creating units and etc. so changes like these are not necessary when you're just testing around.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Spreading Poison

Post by JustNatan »

WhiteWolf wrote: December 11th, 2020, 9:40 pm Your scenario has 3 sides, not 2.
:shock: in that case I apologize for wasting your time ^^ I totally forgot about the third side since I was only playtesting during the first rounds... thanks alot!
WhiteWolf wrote: December 11th, 2020, 9:40 pm Do you know about the in-game :debug command? It enables a series of shortcuts for debugging work, like creating units and etc. so changes like these are not necessary when you're just testing around.
Kinda, I know that it exists but haven't tried it yet. I thought it would only give some debug information, but no actual game control. Might be worth a try :)
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Spreading Poison

Post by WhiteWolf »

No worries, glad it's sorted out :)

Absolutely worth a try, it's a great help in speeding up your testing processes. The in-game help window's "Commands" section at the bottom contains the full "Debug Mode Commands" list that contains what each of them do. Typing help <command name> in the ingame console can also give a description for each command. Also check out your new right-click menu options, and some of those even have hotkeys for them.
For this example, creating a unit with poison literally takes 2 seconds. Just press shift+c (creates a unit at the position where the cursor is), start typing "Assa...", from the filtered window select Assassin and hit enter.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Spreading Poison

Post by JustNatan »

WhiteWolf wrote: December 11th, 2020, 11:08 pm Absolutely worth a try, it's a great help in speeding up your testing processes.
DAMN! Knowing the debug function is mandatory for development! Finally I get some feedback from the engine!

Thanks alot!
User avatar
lhybrideur
Posts: 369
Joined: July 9th, 2019, 1:46 pm

Re: Spreading Poison

Post by lhybrideur »

WhiteWolf wrote: December 11th, 2020, 5:44 pm If you run wesnoth in a terminal on linux, there's logs in it. It's also outputted to some log.txt on windows (I don't know where, someone will need to clarify the exact location). Those logs do contain these types of warnings. But there is no way for Wesnoth to tell you problems with stuff that is not syntactically wrong. No programming language compiler can do that.
It is normally in the wesnoth directory\logs. Typically in Documents\My Games\Wesnoth1.X\logs
Post Reply