This is an old revision of the document!
CreateBeam(<-color <-brightness <-width) ->beamUID
Creates a beam. Beams are laser like lines between two points in 3D space. A beam will persist once created. Call DestroyBeam to remove a beam. Don't call CreatBeam repeatedly unless you plan to make more than one beam. Each call creates a new beam that will persist until destroyed. If you are creating a beam for a unit, call CreateBeam in a once clause (or some other initialization function) then reference that beam in the unit. You can toggle the beam's visibility rather than creating, destroying, and recreating the beam. Toggling the visibility is more efficient that creating and destroying a beam. If you attach a beam to a unit, the beam will be destroyed if the unit is destroyed. CreateBeam pushes to the stack a unique ID for the created beam. Use this ID in other beam related calls to reference the beam. A value of -1 is pushed to the stack if the beam creation fails. A MAXIMUM OF 4096 BEAMS IS ALLOWED.
Important note: If you are planning to create a continuous beam on a unit that will be moving while firing, do not attach the beam to the unit. An attached beam will be unable to maintain the correct visual orientation and length. An unattached beam so long as its' start location is updated will retain a correct visual orientation.
once GetUnitPosition(self) ->unitPos #Fire a beam to extends off screen but is at the same height as the unit #We will attach the beam to ourselves, so that the start point is relative to our unit 3 ->brightness 4 ->width CreateBeam("orange" <-brightness <-width) ->beam AttachBeam(<-beam self "") SetBeamStart(<-beam V3(0 0 0)) SetBeamEnd(<-beam V3(10000 0 10000)) endonce
⇐ Index