You're thinking the right way, but your execution isn't the way you want it. First of all, you don't need multiple lang entries for all the doors; you can just use the same one for all the ones that use the same message.
For example:
<Entry Name="MsgDoorNoOpen">This door cannot be opened.</Entry>
<Entry Name="MsgDoorNeedKey">I need to find a key to open this door.</Entry>
And as Neelke said, you need to use if-statements to actually ask the game to test something. Without it, it will just run everything in order, from top to bottom. That's why all the doors showed the last message; it ran all the SetMessage scripts, but since the last message was at the bottom, it overlapped the other ones.
Since you're also running the same script for ALL the doors, that means all of this is ran every time you interact with any of them. It's easier to use a separate callback for the special door. It's still possible to do it this way, but you'll need a few more checks.
Here's an example of a script that should work fine:
void DoorLockedPlayer(string &in entity)
{
if(GetSwingDoorLocked(asEntity)) {
if(asEntity == "Locked_01" or asEntity == "Locked_02" or asEntity == "Locked_03") {
SetMessage("Sign", "MsgDoorNoOpen", -1);
}
if(asEntity == "Locked_04") {
SetMessage("Sign", "MsgDoorNeedKey", -1);
}
}
}
Tips:
If several questions return the same event (in this case the message MsgDoorNoOpen), you can use the same if-statement with the keyword
or or alternatively the symbols
||. This way you can ask "If this door is locked AND this door is named "Locked_01" or this door is named "Locked_02", or this door is named "Locked_03", then display this message."
Normally, you'll check what value the getters for the doors return, by doing what Neelke had:
if(GetSwingDoorLocked(asEntity) == true)
The
== true part will check if the door is indeed locked. False would check if it was unlocked. By default, a boolean will return true if nothing else is specified.
The first question here is asking if the door you're interacting with is locked. asEntity acts as a placeholder for that door's name.