Spotlights: Difference between revisions
m Cross-categories, wee |
|||
Line 50: | Line 50: | ||
=== Q: How do I make the light follow an enemy unit? === | === Q: How do I make the light follow an enemy unit? === | ||
A: You have to set up the building and triggers on the map from the start. First, place the building (and power plants if its a powered structure) and in its properties set the behaviour of spotlight to 1 'rules.ini settings'. Then create a repeating trigger that has event 35 'Enemy in spotlight and action' 52 'Change light behaviour' that has its parameter set to 3. Attach this trigger to the spotlight building and in game it will follow any enemy units. | A: You have to set up the building and triggers on the map from the start. First, place the building (and power plants if its a powered structure) and in its properties set the behaviour of spotlight to 1 'rules.ini settings'. Then create a repeating trigger that has event 35 'Enemy in spotlight and action' 52 'Change light behaviour' that has its parameter set to 3. Attach this trigger to the spotlight building and in game it will follow any enemy units. | ||
[[Category:Tutorials]] | |||
[[Category:TS]] | |||
[[Category:YR:RP]] |
Revision as of 18:56, 6 January 2006
Spotlights in TS
Note: This information applies only to Tiberian Sun or Yuri's Revenge when patched by the Rock Patch v1.06 or higher
Spotlights, a great visual effect, and simple to edit too.
The spotlight controls available in the INIs are as follows:
SpotlightSpeed=.015 SpotlightMovementRadius=2000 SpotlightLocationRadius=1000 SpotlightAcceleration=.0025 SpotlightAngle=.5 SpotlightRadius= ? (undocumented tag)
Now, many modders get confused by all those radii, angles and stuff. Well, it's easy to comprehend, if you know what an ellipse is. Let me quote: "An ellipse is the locus of points the sum of whose distances from two fixed points, called foci, is a constant."
Confused yet? :) See image:
http://www.1728.com/ellipse.gif source
Now that we know what an ellipse is, let's see how that relates to spotlights and what the controls do.
If you place the spotlight tower in one focus, say f1, and rotate the axis so that axis AB matches the line connecting NE and SW corners of your screen, then the moving spotlight will draw a certain part of the ellipse on the ground.
SpotlightSpeed - obvious, speed of the spotlight. SpotlightMovementRadius - the distance f1O (marked c) (in leptons).
Assuming the light itself is at point A at this moment,
SpotlightLocationRadius - the distance f1A (in leptons).
SpotlightAcceleration - obvious, the (de-)acceleration of the light.
SpotlightAngle - the angle (in radians), which will be drawn before the light stops and draws the same angle in the reverse direction.
SpotlightRadius - not sure, but it appears to control the width of the falling light beam (the blob on the ground remains unchanged, the part between the tower and the ground appeatrs to widen/thinnen according to this, btu the effect is incomplete and yields nothing useful whatsoever.
The spotlight starts drawing from point B, and goes through C, A, D and back to B. Note, the spotlights which are preplaced on maps can be rotated to face another direction. Then the axis f1f2 will also rotate to be in the smae line with AB.
Common Questions
Q: How do I make the light rotate in a circle instead of an ellipse?
A: Since the ellipse irregularity increases along with f1f2, the way to make the light rotate in a perfect circle is... correct, moving the second focus, f2, into the same spot as f1, which means changing the SpotlightMovementRadius to zero.
Q: How do I make the light draw a full circle?
A: The full circle is 360°, or 2*pi (2*3.14 = 6.28) radians. The angle is controlled by SpotlightAngle. Since it asks for a value in radians, you should provide a number close to 6.3 . However you can also use controls on pre-placed spotlight tower buildings to set the type of movement (that used by the rules.ini controls or a constant circle) or create triggers that change the type of movement.
Q: How do I make it sound an alarm when an enemy is spotted?
A: You can't make this flawlessly. You can attach a dummy weapon which has a Report=<warning alarm sound> attached, but then the tower will keep firing at the target and ignore other possible enemies around.
Q: How do I make the light follow an enemy unit?
A: You have to set up the building and triggers on the map from the start. First, place the building (and power plants if its a powered structure) and in its properties set the behaviour of spotlight to 1 'rules.ini settings'. Then create a repeating trigger that has event 35 'Enemy in spotlight and action' 52 'Change light behaviour' that has its parameter set to 3. Attach this trigger to the spotlight building and in game it will follow any enemy units.