You could make a brick the size of the room that is a zone
datablock fxDTSBrickData(RoomBrickData : brick64xCubeData)
{
category = "Special";
subCategory = "Rooms";
uiName = "Room1 Brick";
alwaysShowWireFrame = false;
isWaterBrick = true;
};
datablock TriggerData(RoomTrigger)
{
tickPeriodMS = 100;
};
function fxDtsBrick::createRoomTrigger(%this,%data)
{
%t = new Trigger()
{
datablock = %data;
polyhedron = "0 0 0 1 0 0 0 -1 0 0 0 1"; //this determines the shape of the trigger
};
missionCleanup.add(%t);
%boxMax = getWords(%this.getWorldBox(), 3, 5);
%boxMin = getWords(%this.getWorldBox(), 0, 2);
%boxDiff = vectorSub(%boxMax,%boxMin);
%boxDiff = vectorAdd(%boxDiff,"0 0 0.2");
%t.setScale(%boxDiff);
%posA = %this.getWorldBoxCenter();
%posB = %t.getWorldBoxCenter();
%posDiff = vectorSub(%posA, %posB);
%posDiff = vectorAdd(%posDiff, "0 0 0.1");
%t.setTransform(%posDiff);
%this.trigger = %t;
%t.brick = %this;
return %t;
}
package Room
{
function RoomBrickData::onAdd(%this,%brick)
{
%brick.scheduleNoQuota(0,"createRoomTrigger","Room");
Parent::onAdd(%this,%brick);
}
function RoomBrickData::onRemove(%this,%brick)
{
if(isObject(%brick.trigger))
%brick.trigger.delete();
Parent::onRemove(%this,%brick);
}
function Room::onEnterTrigger(%this,%trigger,%obj)
{
messageClient(%obj.client,'',"Entered the room");
%obj.client.isInRoom = 1;
}
function Room::onLeaveTrigger(%this,%trigger,%obj)
{
messageClient(%obj.client,'',"ExetedRoom");
%obj.client.isInRoom = 0;
}
};
activatePackage(ShopTrigger);