Page MenuHomeFeedback Tracker

Attributes are not removed from mission.sqm if they are reset to default value
New, NormalPublic

Description

By default, attributes whose value is equal to the default value will not be written to the mission.sqm. However, once the value of the attribute was changed and saved and then reset to its default value. The attribute code remains in the mission.sqm and is executed when the mission is started.

This causes unnecessary code to be executed at mission start and increasing the mission.sqm size

Details

Severity
Tweak
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Eden Editor
Steps To Reproduce
  1. Create a new mission, place a soldier and save it.
  2. Open the mission.sqm. Class Mission should look like this:
class Mission
{
	class Intel
	{
		//....
	};
	class Entities
	{
		items=1;
		class Item0
		{
			dataType="Group";
			side="West";
			class Entities
			{
				items=1;
				class Item0
				{
					dataType="Object";
					class PositionInfo
					{
						position[]={3987.0815,5.0014391,4180.2354};
					};
					side="West";
					flags=7;
					class Attributes
					{
						isPlayer=1;
					};
					id=9;
					type="B_W_Crew_F";
				};
			};
			class Attributes
			{
			};
			id=8;
		};
	};
};
  1. Disable Stamina for the soldier; -> Attributes -> Special states -> Stamina and save the mission
  2. Check the mission.sqm again. A new entry was added
class Attribute2
{
	property="enableStamina";
	expression="_this enablestamina _value;";
	class Value
	{
		class data
		{
			class type
			{
				type[]=
				{
					"BOOL"
				};
			};
			value=0;
		};
	};
};
  1. Reset the stamina attribute back to it's default value and save the mission.
  2. Open the mission.sqm. The attribute code is still there, but with value=1; now.
Additional Information

For custom attributes, this means that every attribute expression needs an additional check if the _value passed to it is different from the default value.

if !(_value # 0 isEqualTo '') then
//...

Event Timeline

R3vo created this task.Oct 13 2020, 6:46 PM
R3vo updated the task description. (Show Details)
R3vo edited Steps To Reproduce. (Show Details)
R3vo updated the task description. (Show Details)Oct 13 2020, 6:48 PM
R3vo renamed this task from Attribute are not removed from mission.sqm if they are reset to default value to Attributes are not removed from mission.sqm if they are reset to default value.
R3vo removed a subscriber: R3vo.Jul 21 2021, 6:11 PM