Make actor aim vertical: Difference between revisions
Mblackwell (talk | contribs) m New page: In this example, the actor will find the closest LIZTROOP actor within 2048 units and calculate the vertical angle it needs to aim at. This code is an example of how to use the [[zshoo... |
edited for grammar (mb) |
||
| Line 1: | Line 1: | ||
In this example, the [[actor]] will find the closest LIZTROOP actor within 2048 units and calculate the vertical angle it needs to aim at. This code is an example of how to use the [[zshoot]] command to create friendly bots and other similar effects. The | In this example, the [[actor]] will find the closest LIZTROOP actor within 2048 units and calculate the vertical angle it needs to aim at. This code is an example of how to use the [[zshoot]] command to create friendly bots and other similar effects. The following does not contain the [[gamevar]] definitions, which must be placed outside of the actor code. | ||
<pre> | <pre> | ||
Revision as of 14:28, 18 November 2008
In this example, the actor will find the closest LIZTROOP actor within 2048 units and calculate the vertical angle it needs to aim at. This code is an example of how to use the zshoot command to create friendly bots and other similar effects. The following does not contain the gamevar definitions, which must be placed outside of the actor code.
findnearactor LIZTROOP 2048 ACTOR2
ifvarn ACTOR2 -1
{
ldist TEMP THISACTOR ACTOR2
getactor[THISACTOR].z TEMP2
subvar TEMP2 8192 // Offset the Z. Assumes the center of the actor is the same as the player
getactor[ACTOR2].z TEMP3
subvar TEMP3 8192 // Offset the Z. assumes the center of the actor is the same as the player
subvarvar TEMP3 TEMP2
shiftvarl TEMP3 8
divvarvar TEMP3 TEMP
zshoot TEMP3 SHOTSPARK1
}