Page 1 of 1

Bug or Feature? Kill Monster Scripting Problems

Posted: Wed Oct 20, 2010 9:18 am
by Phex
I was playing my old plugin Five Kingdoms recently and recognized that a major scripting bug appeared which i never noticed before. But I am totally sure that I have tested this issue thoroughly when making this plugin and I am totally sure that it has not occured back then. Its too bad that I cant run an older version of Myth on my vista machine to test if this bug really originates from an update. Therefore I will try to describe the problem as good as I can.

On all maps, one team (the so called undead) has a necromancer (a shade) on their side who is followed by some guards (stygian knights). When the necromancer dies, all his guards are killed too automatically by a script. This script is very simple and uses just two actions:
1. a test unit which tests for necromancers in a container
2. a unit control which is conditionally activated and kills the guard monsters with the kill monster( 0 ) command.
To no surprise this works well and the guards die when the necromancer is killed. But now comes the bug! The player percentage in the f7 menu does not change when the guards die. It stays constant although it can clearly be seen that the stygian knights fall to the ground in pieces spitting out green fumes. Also, the game will not end when the undead team has no units left, it seems as if it would assume that the stygians are still alive.

My assumption is that in a recent update some changes were made to the script processor which modified how the "kill monster"-command worked - maybe specifically for multiplayer maps? Or at least I have no idea what else could have happened. I hope someone can help me...

regards,
Phex

PS: To look at the script you can untag the plugin which I linked in the first paragraph of this post and open any of the new maps you want. Go to the section "------ NECRO & GHOSTS ---------" where the two responsible actions are placed.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Wed Oct 20, 2010 11:02 am
by Myrd
Can you make and post a test plugin that can reproduce this issue early on?

That way, we can easily try it out with earlier versions to see when the bug was introduced.

There were changes to related code in previous updates to fix other bugs with player percentages, so it is possible that this got broken. If we can figure out the cause, I will look at fixing this for 1.7.2.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Sun Oct 24, 2010 2:17 am
by Phex
Myrd wrote:Can you make and post a test plugin that can reproduce this issue early on?
Done. Just start the multiplayer TEST map in this plugin and wait 1-2 seconds after the planning time has expired. All your units except one are getting killed with a script but your counter still stays on 100%. I dont think that this behaviour is desired. There is also a single player TEST map within this plugin which works in the same way.
Myrd wrote:If we can figure out the cause, I will look at fixing this for 1.7.2.
That would be great!

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Mon Oct 25, 2010 5:51 pm
by Myrd
I get the same behaviour in 1.7.1, 1.7.0, 1.6.0, and 1.5.1. If it ever worked differently, it would have been a long time ago.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Oct 26, 2010 4:36 am
by Phex
That is really strange, I could have sworn it worked differently when I tested it back then... :?

Is there any reason why this map action is designed to not reduce the player's unit count like it does now? If not, is there any chance that you will chance it to work like I was expecting it to work? I mean, it does not seem reasonable at all right now! Didn't they have common sense when designing this? Why is it even possible to kill units with a script without changing the player's unit count? The unit count should reflect the count of units the player has on the map, no matter how they get killed, destroyed or teleported away!

I hope that this wrong behaviour could be easily fixed for my own maps by introducing a new script action that checks for units and eliminates the team if there are none left - if that still works for script-killed monsters, I'm not sure anymore. But I would really prefer a killing monster action that was more intuitive for mapmakers anyway.

Thank you for looking at this.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Oct 26, 2010 8:10 am
by Graydon
Try using the Delete flag, on the same subjects, in a subsequent control action after they've been killed off.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Oct 26, 2010 12:04 pm
by vinylrake
is there any chance that the reason the player unit count doesn't automatically go down when units are killed/teleported/whatever could be because the mapmaker might have further plans for the units after some some delay? so that during that delay when no player units are visible on the map ( before being raised/appearing-after-teleporting/whatever) an endgame condition that checks for player units=0 might be inadvertently triggered ending the game before the units are back/visible on the map?

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Oct 26, 2010 1:45 pm
by Phex
Graydon wrote:Try using the Delete flag, on the same subjects, in a subsequent control action after they've been killed off.
Thanks for that hint, I will try it out. I think you are not going to change the game code in any way concerning this, I suppose?
vinylrake wrote:is there any chance that the reason the player unit count doesn't automatically go down when units are killed/teleported/whatever could be because the mapmaker might have further plans for the units after some some delay?
What is the unit count good for then? You just have to consider that really rare case of "dead but alive" units in your endgame condition if you plan to use it like that. That should be obvious especially for single player maps. In any case its totally unintuitive that obviously killed units count to the number of alive units.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Oct 26, 2010 2:37 pm
by Chicken Berel
Maybe they were just....MOSTLY dead.
Thats how Mel Brooks put it.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Oct 26, 2010 7:50 pm
by Myrd
Phex wrote:
Graydon wrote:Try using the Delete flag, on the same subjects, in a subsequent control action after they've been killed off.
Thanks for that hint, I will try it out. I think you are not going to change the game code in any way concerning this, I suppose?
I think if you put the Delete Monster flag on the same map action as the Kill Monster flag, it will do what you want.

Unless you find something that was broken by some previous update, I don't see a reason to change the code.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Oct 26, 2010 8:27 pm
by vinylrake
Phex wrote:What is the unit count good for then? You just have to consider that really rare case of "dead but alive" units in your endgame condition if you plan to use it like that. That should be obvious especially for single player maps. In any case its totally unintuitive that obviously killed units count to the number of alive units.
it's good for keeping track of units that are actually dead? you are assuming teleported off the map / invisible means 'dead'? teleported units aren't 'obviously killed', and while i can see how that might often or even usually be the case, it doesn't seem any less intuitive to me that if you want a unit THAT HASN'T ACTUALLY BEEN KILLED to count as *dead* that you have to tell the game engine that the unit is 'dead', than your assumption that all units not currently visible are dead.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Oct 26, 2010 10:48 pm
by Graydon
I believe the reason it works the way it does is that Kill Monsters flag in the CTRL action were only ever designed to be used by Bungie on the Dark team... that is, campaign only, on a team that you'd never see a unit count for (in which case it simply wouldn't matter). Furthermore, the description for Delete Monsters is 'removes monsters for higher difficulties' or something along those lines... essentially doing the opposite of what setting monsters as timid--->legendary does. So if you tested for Legendary difficulty then if true deleted two of the 4 player dwarves, the player still has 100% units, and any TUNIs checking for player vitality less than X won't factor in the deleted units that you never had access to. It'd be pretty lame to go for a vidmaster and not be able to complete it with 100% due to the script killing your units at the start for the harder difficulty increment.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Wed Oct 27, 2010 3:51 am
by Phex
Graydon wrote:It'd be pretty lame to go for a vidmaster and not be able to complete it with 100% due to the script killing your units at the start for the harder difficulty increment.
"Delete Monster" and "Kill Monster" are two totally different actions though. Delete Monster should exactly do what you depicted here. For Kill Monster on the other hand you can even specify whether the desired unit should suffer a soft or a hard death - thats not at all designed to remove the player's units at the start. I'm not even entirely sure if an endgame condition would consider them dead (meaning "Unit Count = 0"). So it makes no sense to not change the unit count when using this action.

Or, if you really do not want to have script actions affect the unit count, then at least the netgame ending condition should check for monsters killed by a script and end the game if no monsters are left for a single player. That missing netgame condition is what actually annoys me, I just thought it would be tightly connected to the player unit count.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Tue Nov 02, 2010 3:04 pm
by Phex
If you are interested, I have attached a recording of a regular netgame with a bugged unit count. One team is assigned -3% towards the end of the game.

Re: Bug or Feature? Kill Monster Scripting Problems

Posted: Wed Nov 03, 2010 11:28 pm
by Myrd
Phex wrote:If you are interested, I have attached a recording of a regular netgame with a bugged unit count. One team is assigned -3% towards the end of the game.
Interesting, I'll have to investigate.

EDIT: Looks like a day-0 Myth bug where explosions are not ignoring monsters after they've teleported out. I'll fix it for 1.7.2.