⇐Index
⇐Tutorials
Getting Started With Beams in CW4
Working with beams may seem a bit overwhelming at first due to the number of properties to assign, but it's actually rather simple once you've whittled it down to the basics. Here are the minimum steps required to get a beam operational with 4RPL:
Create beam with
CreateBeam (Takes 3 arguments. string for color, float for brightness/intensity, float for thickness.) ID of newly created beam will be left on stack, export to a variable for later re-use.
(OPTIONAL) Attach beam to unit with
AttachBeam (Takes 3 arguments. Int for beam ID, int for ID of unit to attach to, string for name of sub-object within unit to attach to.)
Designate offset of beam's start point with
SetBeamStart (Takes 2 arguments. Int for beam ID, V3 for position.) If you did not use
AttachBeam, the position supplied is treated as an absolute world position. If you did use
AttachBeam, the position supplied is used as an offset relative to the position of the sub-object to which you've attached it.
Designate beam's end point with
SetBeamEnd (Takes 2 arguments. Int for beam ID, V3 for position of beam's end.) Beam's end seems to be treated as absolute world position, unless you use
SetBeamForceLocalEnd (Take 2 arguments. Int for beam ID, bool for state.)
(OPTIONAL) If you wish to make the beam invisible or restore its visibility, use
SetBeamVisible (Takes 2 arguments. Int for beam id, bool for state.)
(OPTIONAL) If you wish to destroy the creeper along the path of the beam as the sweeper does, you will want to use
ClipCreeperLine (Takes 5 arguments. V3 for start position, V3 for end position, int for width, bool for affects creeper, bool for affects anti-creeper.) The amount of creeper allowed to pass through the line is determined by the vertical height of the beam (in other words, the y components supplied for the start and end vectors.) If you set both y components to 0, it should clip all creeper passing over the line.
Additional beam related commands: IsBeam, SetBeamBrightness, SetBeamColor, SetBeamWidth, UnattachBeam, DestroyBeam, DestroyAllBeams, DestroyAllAttachedBeams