Difference between revisions of "DCS func setPoint"
From DCS World Wiki - Hoggitworld.com
m (1 revision imported) |
|||
| Line 36: | Line 36: | ||
[[DCS_Class_Spot|'''Spot Functions:''']] {{listofScriptingSpotFuncs}} | [[DCS_Class_Spot|'''Spot Functions:''']] {{listofScriptingSpotFuncs}} | ||
| − | |examples= | + | |examples= The following will create a laser point and update the point of the ray every half a second. Once the target unit is destroyed it will remove the laser. |
| + | local jtac = Unit.getByName('jtacBob') | ||
| + | local target = Unit.getByName('BMPAirDefenseSystemGroup1_unit1') | ||
| + | local ray = Spot.createLaser(jtac, {x = 0, y = 1, z = 0}, target:getPoint(), 1337) | ||
| + | local function updateRay() | ||
| + | if target:getLife() > 0 then | ||
| + | ray:setPoint(target:getPoint()) | ||
| + | timer.scheduleFunction(updateRay, {}, timer.getTime() + 0.5) | ||
| + | else | ||
| + | ray:destroy() | ||
| + | end | ||
| + | |||
| + | end | ||
| + | timer.scheduleFunction(updateRay, {}, timer.getTime() + 0.5) | ||
|notes= | |notes= | ||
}} | }} | ||
[[Category:Class Functions|setPoint]] | [[Category:Class Functions|setPoint]] | ||
