This is a guide on how to detect and remove this thing: https://i.imgur.com/CMMLUJE.png
Basically this happens if you try to spawn something into the game that doesn't exist or it does not recognize. This virtually only happens if you utilize scripts. I am working on a script that is supposed to be cross-compatible with steam and previous versions of the game, but since Steam was updated with new items, creating certain objects will trigger the error block. I'm sure this can also be helpful for people who are developing scripts for Redux and people try to run it in steam. Below are two methods I figured out.
At first I wasn't sure it was an object at all, but in map editor if you hover over with mouse and press Alt_Gr, it will show the name ("error", ID: x).
https://i.imgur.com/AWCl6Un.png
First thing I tried was foreach(Iobject o in Game.GetObjectsByName("error")), and try to (o.)remove() it. This didn't work, for some reason it can't filter the name itself. Then I tried another method:
Method 1 - via CustomID (CheckForErrors)
If your script is set to create any Object from a list containing objects you know aren't existing in previous versions (For me it was WeaponItems), you can set the spawned item to have a CustomID, for example ("CreatedObject"). Then you can do foreach(Iobject o in Game.GetObjectsByCustomID("CreatedObject") ) { if o.name=="error" o.Remove(); } } This will work for some reason, you can also run if the name is not "error" set CustomID.StringEmpty.
Method 2 - via Area (CheckForErrors2)
With this method you will get all objects that are created within the camera area. This will make it so you don't have to assign a customID to objects. Else it's the same as above. I'm not sure how it will work for mulitple CameraAreaTriggers. It worked for at least one more.
For both these methods, i illustrated the effect with a Button trigger, you can basically copy what map i made in the pictures, set the Button to have Script method "Button".
Code: Select all
List<String> Object = new List<String>();
Random rnd = new Random();
public void OnStartup() {
Events.UpdateCallback.Start(CheckForErrors, 5000); //Reason i put this 5 seconds is so you have time to see it work by itself. Normally put this to 0.
Object.Add("Barrel00");
Object.Add("UnrealObject");
}
public void Button(TriggerArgs args) {
IObject c = Game.CreateObject(Object[rnd.Next(0,Object.Count)]);
IObject d = Game.CreateObject(Object[rnd.Next(0,Object.Count)], new Vector2(124,68));
Game.RunCommand("/MSG " + c.Name.ToString()); //See name is "error"
c.CustomID="CreatedObject";
d.CustomID="CreatedObject";
}
public void CheckForErrors(float ms) {
foreach(IObject a in Game.GetObjectsByCustomID("CreatedObject") ) if(a.Name=="error") { a.Remove(); } else { a.CustomID=String.Empty; }
Game.PlayEffect("CFTXT", new Vector2(0,0), "One cycle past");
}
public void CheckForErrors2(float ms) {
foreach(IObject a in Game.GetObjectsByArea(Game.GetCameraMaxArea())) if(a.Name=="error") { a.Remove(); } else { a.CustomID=String.Empty; }
Game.PlayEffect("CFTXT", new Vector2(0,0), "One cycle past");
}
Hopefully this will help some people in the future. It would be nice if one of these methods were included in any script (related to creation of objects) that people make, to ensure removal of "Error" block of versions script wasn't intended for.
Do you have a better way? I didn't find any on this forum (that's why i decided to share this), but if you do comment below!