Blockland Forums > Modification Help

Help for BL RTS: Directional fireRelay code

Pages: (1/2) > >>

onesis:

Hey I posted a reply on one of my threads and forgot that I had to ask it here. So here it is:


--- Quote ---You know how I was saying the Events weren't working properly? Well take a look at this. Say I use this output in the direction of up. With the way this is written, it would only work if the target brick overlaps the center. In the case that the target brick is offset away from the center (which is my case all the time) the event doesn't even work.

The default events of fireRelayUp etc. use some sort of dynamic tracking system that tracks the nearest target brick no matter it's position along the original brick's edge. It also (surprise, surprise) can activate ALL the bricks along it's edge. So to everyone who thought I just sucked, go suck an egg. Anyhoo, how do I take a look at the default directional fireRelay events' code so I can edit/report this VCE event?


--- Code: ---function fxDtsBrick::VCE_relayCallFunction(%brick,%direction,%name,%args,%client)
{
%start = posFromTransform(%brick.getTransform());
%db = %brick.getDatablock();
%angle = %brick.getAngleID();
if(%angle == 1 || %angle == 3)
{
%addX = %db.brickSizeY * 0.55;
%addY = %db.brickSizeX * 0.55;
}
else
{
%addX = %db.brickSizeX * 0.55;
%addY = %db.brickSizeY * 0.55;
}
%addZ = %db.brickSizeZ * 0.22;
//Up Down North East South West
switch(%direction)
{
case 0:
%add = 0 SPC 0 SPC %addZ;
case 1:
%add = 0 SPC 0 SPC -%addZ;
case 2:
%add = 0 SPC %addY SPC 0;
case 3:
%add = %addX SPC 0 SPC 0;
case 4:
%add = 0 SPC -%addY SPC 0;
case 5:
%add = -%addX SPC 0 SPC 0;
}
%end = vectorAdd(%start,%add);
%ray = containerRaycast(%start,%end,$TypeMasks::FxBrickAlwaysObjectType,%brick);
%col = firstWord(%ray);
if(isObject(%col))
{
if(getTrustLevel(%col,%brick) < 2)
return;
%col.VCE_callFunction(%name,%args,%client);
}
}
--- End code ---

--- End quote ---


Amade:

ContainerRaycast will make a straight line searching for bricks. You'll probably want to use initContainerBoxSearch (the arguments are %center, %size (I'm not sure what exactly this is), %typemasks).

onesis:

Thanks that helps a lot. Now...how do I use it =P

Amade:

The fillcan uses it, you should be able to figure out how to use it from poking around with the fillcan.

onesis:

Thanks so much

Pages: (1/2) > >>

Go to full version