I need to make it so when a player enters a bricks zone, or touches the brick, whichever is easier, something happens:
datablock fxDTSBrickData(DDRPSmith : brick8x8FData)
{
category = "DDRP";
subCategory = "Job Plates";
uiName = "Smithing";
};
datablock TriggerData(DDRPTrigger)
{
tickPeriodMS = 200;
};
function zoneTrigger::onEnterTrigger(%this,%trigger,%obj)
{
echo("Hi!");
}
deactivatepackage(smithplant);
package smithplant
{
function fxdtsbrick::onplant(%brick)
{
if(%brick.getDatablock().getID() == DDRPSmith.getID())
{
Parent::onplant(%brick);
echo("Adding trigger.");
%zoneXa = getWord(%brick.getWorldBox(), 0) - 1/10;
%zoneYa = getWord(%brick.getWorldBox(), 1) - 1/10;
%zoneZa = getWord(%brick.getWorldBox(), 2) - 1/10;
%polySuffA = 0;
%zoneShape = "0.0 0.0 0.0 1.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0";
%pz = new PhysicalZone()
{
position = %zoneXa SPC %zoneYa SPC %zoneZa;
velocityMod = "1";
gravityMod = "1";
extraDrag = "0";
isWater = "0";
waterViscosity = "40";
waterDensity = "1";
waterColor = "0.200000 0.600000 0.600000 0.300000";
appliedForce = 1;
polyhedron = %zoneShape;
};
missionCleanup.add(%pz);
//Create a new trigger
%tr = new trigger()
{
position = %zoneXa SPC %zoneYa SPC %zoneZa;
polyhedron = %zoneShape;
dataBlock = DDRPTrigger;
};
missionCleanup.add(%tr);
%pz.setScale("5 5 5");
%tr.setScale("5 5 5");
%brick.IsZoneBrick = 1;
%brick.physicalZone = %pz;
%brick.trigger = %tr;
%brick.trigger.Active = 1;
%tr.istriggerBricktrigger = 1;
%tr.triggerBrick = %brick;
}
}
};
activatepackage(smithplant);
I have also tried things with adding an onActivate->self->fireRelay when a brick is planted to put one event in it, so the onPlayerTouch function is called for that brick, but I can't seem to get events put into a brick though script.
And no, this can not be done though events.
And it dosn't work as of yet.