---------------------------------------------------------------------------------------------------------------
Adding Beacons with deployables Tutorial
---------------------------------------------------------------------------------------------------------------
This tutorial will automaticially add a beacon to a deployable when you deploy them, so teamates can easily find them. This is a workaround to not being able to specify beacons in the deployables datablock since the last patch.
Step #1
// ------------------------------------------
// NameofDeployable.cs
// ------------------------------------------
function NameofDeployableImage::onDeploy(%item, %plyr, %slot)
{
%deplObj = Parent::onDeploy(%item, %plyr, %slot)
%pos = posFromTransform(%deplObj.getTransform());
%deplObj.beacon = new BeaconObject() {
dataBlock = "BomberBeacon";
position = %pos;
};
%deplObj.beacon.playThread($AmbientThread, "ambient");
%deplObj.beacon.team = %deplObj.team;
%deplObj.beacon.sourceObject = %deplObj;
%deplObj.beacon.setTarget(%deplObj.team);
MissionCleanup.add(%deplObj.beacon);
}
function NameofDeployable::onDestroyed(%this, %obj, %prevState)
{
$TeamDeployedCount[%obj.team, NameofDeployable]--;
%obj.beacon.schedule(490, "delete"); //<--Part being added
%obj.schedule(500, "delete");
}
Example using Deployed Inventory Station:
function InventoryDeployableImage::onDeploy(%item, %plyr, %slot)
{
%deplObj = Parent::onDeploy(%item, %plyr, %slot);
%pos = posFromTransform(%deplObj.getTransform());
%deplObj.beacon = new BeaconObject() {
dataBlock = "BomberBeacon";
position = %pos;
};
%deplObj.beacon.playThread($AmbientThread, "ambient");
%deplObj.beacon.team = %deplObj.team;
%deplObj.beacon.sourceObject = %deplObj;
%deplObj.beacon.setTarget(%deplObj.team);
MissionCleanup.add(%deplObj.beacon);
}
function DeployedStationInventory::onDestroyed(%this, %obj, %prevState)
{
Parent::onDestroyed(%this, %obj, %prevState);
$TeamDeployedCount[%obj.team, InventoryDeployable]--;
%obj.beacon.schedule(490, "delete");
%obj.schedule(500, "delete");
}