URL:
  <http://gna.org/bugs/?16498>

                 Summary: Hitpoints getting dropped to 0 on
unstore...sometimes
                 Project: Battle for Wesnoth
            Submitted by: zookeeper
            Submitted on: Friday 08/20/10 at 13:13
                Category: Bug
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: WML
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: trunk r45895
        Operating System: win xp

    _______________________________________________________

Details:

The following event results in the unit's hitpoints ending up at 0, even
though they should simply be dropped to 75% of what they were:


    [event]
        name=moveto
        first_time_only=no

        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]

            kill=yes
            variable=foobar
        [/store_unit]

        [set_variable]
            name=foobar.hitpoints
            multiply=0.75
            round=ceil
        [/set_variable]

        # this reports the correct reduced hp amount
        {DEBUG_MSG "unit should have $foobar.hitpoints hp"}

        [unstore_unit]
            variable=foobar
        [/unstore_unit]

        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]

            kill=no
            variable=foobar2
        [/store_unit]

        # this message always reports 0 hp
        {DEBUG_MSG "but unit actually has $foobar2.hitpoints hp"}
    [/event]


However, if you change the [set_variable] to a simple value assignment, the
hitpoints end up getting whatever value you use:


        [set_variable]
            name=foobar.hitpoints
            value=7
        [/set_variable]


I have no idea how that can happen, because the first debug message indeed
reports the correct reduced hp amount, and foobar.hitpoints also ends up
having the correct value in the savefile. However, on unstore the hitpoints
either end up at 0 (foobar2.hitpoints also has the value of 0 in the
savefile). I've tried it by making the multiplier such that the resulting
value is exactly 25, and then by using value=25; doing the former results in
[unstore_unit] dropping the hitpoints to 0, but doing the latter works just
fine, even though the resulting values look identical in the debug message
and in the savefile.




    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?16498>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to