Problems with [object] and [remove_object]
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.
- Bob_The_Mighty
- Posts: 870
- Joined: July 13th, 2006, 1:15 pm
Re: Problems with [object] and [remove_object]
I am still having problems on 1.14.11 with [remove_object] causing changes to things like max movement being lost (as well as removing slow/poison). The wiki says:
However, I can't find any reference to this on the changelog. Does anyone know what was fixed and whether this tag is safe to use now? I am debating whether to rewrite a ton of code for the inventory system in Bob's RPG Era or to live with the bugs in the hope it will be fixed in 1.15.Note that some unit properties are not restored ideally, e.g. current unit's health reversion might not work as expected (max_hitpoints will though). (Version 1.15.0 and later only) This was fixed.
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
Re: Problems with [object] and [remove_object]
The bug was fixed was about remove_object sometimes changing current hitpoints/moves, even though the object did not change them.
If you are having problem with max hitpoints, i can tell you: [remove_object] will reset the units stats like max_hitpoints, it is reccomended to never change a units max hitpoints via for example [modify_unit] or set_variables, in particular if your addon uses [remove_object] its reccomended that you try to do all your unit modifications via [object]s/effect]s, even if you don't want to remove them afterwards.
To explain it a little more:
The units properties can be seperated in two types, lets call them 'persistent' and 'current', properties of type 'pertsistent' include max_hitpoints, movetype, attacks, abilities etc, basicially all attributes that are usually given by a unit type, properties of type 'current' include hitpoibnts, moves, status etc. that describe the current units. I really reccomend to change properties of the type 'persitent' always via [effect] and properties of the type 'current' always via direct unit modifications ([set_variable]/[modify_unit]), otherwise you will run into problems in certain situations like this, unless you know really well how the engine works.
EDIT: wait i just read the beginning of the tread and noticed that i already said this. maybe i misunderdtood your question.
If you are having problem with max hitpoints, i can tell you: [remove_object] will reset the units stats like max_hitpoints, it is reccomended to never change a units max hitpoints via for example [modify_unit] or set_variables, in particular if your addon uses [remove_object] its reccomended that you try to do all your unit modifications via [object]s/effect]s, even if you don't want to remove them afterwards.
To explain it a little more:
The units properties can be seperated in two types, lets call them 'persistent' and 'current', properties of type 'pertsistent' include max_hitpoints, movetype, attacks, abilities etc, basicially all attributes that are usually given by a unit type, properties of type 'current' include hitpoibnts, moves, status etc. that describe the current units. I really reccomend to change properties of the type 'persitent' always via [effect] and properties of the type 'current' always via direct unit modifications ([set_variable]/[modify_unit]), otherwise you will run into problems in certain situations like this, unless you know really well how the engine works.
EDIT: wait i just read the beginning of the tread and noticed that i already said this. maybe i misunderdtood your question.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- Bob_The_Mighty
- Posts: 870
- Joined: July 13th, 2006, 1:15 pm
Re: Problems with [object] and [remove_object]
Thanks for explaining. That's good to know about how to handle persistent/current stats.
The problem I am encountering is this: changes to max movement via objects are being lost somehow. I think it might be to do with using remove_object to change other stats, as if the unit is being rebuilt without the max movement object.
Do you mean this was fixed in 1.15 or before?
The problem I am encountering is this: changes to max movement via objects are being lost somehow. I think it might be to do with using remove_object to change other stats, as if the unit is being rebuilt without the max movement object.
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
Re: Problems with [object] and [remove_object]
Hmm this shouldn't happen, maybe you can give a example code to reproduce this issue?, without further information i have to assume that there is just a bug somewhere in your code.Bob_The_Mighty wrote: ↑April 3rd, 2020, 6:00 pm The problem I am encountering is this: changes to max movement via objects are being lost somehow. I think it might be to do with using remove_object to change other stats, as if the unit is being rebuilt without the max movement object.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- Bob_The_Mighty
- Posts: 870
- Joined: July 13th, 2006, 1:15 pm
Re: Problems with [object] and [remove_object]
I've just noticed that I've been using [filter] inside [remove_object] when the wiki explicitly says not to.
I guess this means without a filter the object is removed from all players who had it, thus causing odd behaviour.
I guess this means without a filter the object is removed from all players who had it, thus causing odd behaviour.
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves