<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.hard-light.org/index.php?action=history&amp;feed=atom&amp;title=Script_-_Proximity_Trigger</id>
	<title>Script - Proximity Trigger - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.hard-light.org/index.php?action=history&amp;feed=atom&amp;title=Script_-_Proximity_Trigger"/>
	<link rel="alternate" type="text/html" href="https://wiki.hard-light.org/index.php?title=Script_-_Proximity_Trigger&amp;action=history"/>
	<updated>2026-11-15T10:39:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.hard-light.org/index.php?title=Script_-_Proximity_Trigger&amp;diff=28829&amp;oldid=prev</id>
		<title>TopAce: unnecessary header</title>
		<link rel="alternate" type="text/html" href="https://wiki.hard-light.org/index.php?title=Script_-_Proximity_Trigger&amp;diff=28829&amp;oldid=prev"/>
		<updated>2010-04-16T19:40:55Z</updated>

		<summary type="html">&lt;p&gt;unnecessary header&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:40, 16 April 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==Function==&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;After certain activation time the script detonates set weapons if there are non&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-&lt;/ins&gt;friendly ships (neutral, hostile, traitor etc.) within certain radius. Can be used as proximity trigger for weapons or for example as proximity trigger for mines.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;After certain activation time the script detonates set weapons if there are non friendly ships (neutral, hostile, traitor etc.) within certain radius. Can be used as proximity trigger for weapons or for example as proximity trigger for mines.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Example below uses Helios as the weapon having proximity trigger that activates 5 seconds after the weapon launch (This particular Helios has lifetime of 30 s). The script detonates the weapon if target approaches to closer than 1000 m (&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE:&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;unlike ingame&amp;#039;&amp;#039;&amp;#039; distances this one is measured &amp;#039;&amp;#039;&amp;#039;from the centerpoint&amp;#039;&amp;#039;&amp;#039; of the weapon &amp;#039;&amp;#039;&amp;#039;to the centerpoint&amp;#039;&amp;#039;&amp;#039; of the target)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Example below uses Helios as the weapon having proximity trigger that activates 5 seconds after the weapon launch (This particular Helios has lifetime of 30 s). The script detonates the weapon if target approaches to closer than 1000 m (&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE:&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;unlike ingame&amp;#039;&amp;#039;&amp;#039; distances this one is measured &amp;#039;&amp;#039;&amp;#039;from the centerpoint&amp;#039;&amp;#039;&amp;#039; of the weapon &amp;#039;&amp;#039;&amp;#039;to the centerpoint&amp;#039;&amp;#039;&amp;#039; of the target)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>TopAce</name></author>
	</entry>
	<entry>
		<id>https://wiki.hard-light.org/index.php?title=Script_-_Proximity_Trigger&amp;diff=7257&amp;oldid=prev</id>
		<title>Wanderer: initial commit</title>
		<link rel="alternate" type="text/html" href="https://wiki.hard-light.org/index.php?title=Script_-_Proximity_Trigger&amp;diff=7257&amp;oldid=prev"/>
		<updated>2006-08-17T10:56:36Z</updated>

		<summary type="html">&lt;p&gt;initial commit&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Function==&lt;br /&gt;
After certain activation time the script detonates set weapons if there are non friendly ships (neutral, hostile, traitor etc.) within certain radius. Can be used as proximity trigger for weapons or for example as proximity trigger for mines.&lt;br /&gt;
&lt;br /&gt;
Example below uses Helios as the weapon having proximity trigger that activates 5 seconds after the weapon launch (This particular Helios has lifetime of 30 s). The script detonates the weapon if target approaches to closer than 1000 m (&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE:&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;unlike ingame&amp;#039;&amp;#039;&amp;#039; distances this one is measured &amp;#039;&amp;#039;&amp;#039;from the centerpoint&amp;#039;&amp;#039;&amp;#039; of the weapon &amp;#039;&amp;#039;&amp;#039;to the centerpoint&amp;#039;&amp;#039;&amp;#039; of the target)&lt;br /&gt;
&lt;br /&gt;
==Table Entry==&lt;br /&gt;
&amp;lt;pre&amp;gt;#Global Hooks&lt;br /&gt;
&lt;br /&gt;
$Simulation:&lt;br /&gt;
&lt;br /&gt;
[&lt;br /&gt;
&lt;br /&gt;
--Get all weapons&lt;br /&gt;
for i=1,mn.getNumWeapons() do&lt;br /&gt;
   weapon = mn.getWeaponByIndex(i)&lt;br /&gt;
   weapontype = weapon.Class.Name&lt;br /&gt;
&lt;br /&gt;
   --Select only mines&lt;br /&gt;
   if weapontype == &amp;quot;Helios&amp;quot; then&lt;br /&gt;
      weaponlife = weapon.LifeLeft&lt;br /&gt;
&lt;br /&gt;
      --Select only those mines that have been activated (time activation)&lt;br /&gt;
      if weaponlife &amp;lt; 25 then&lt;br /&gt;
         weaponteam = weapon.Team&lt;br /&gt;
&lt;br /&gt;
         --Start building distance array&lt;br /&gt;
         for m=1,mn.getNumShips() do&lt;br /&gt;
            ship = mn.getShipByIndex(m)&lt;br /&gt;
            shipteam = ship.Team&lt;br /&gt;
            weaponposition = weapon.Position&lt;br /&gt;
            shipposition = ship.Position&lt;br /&gt;
            shipdistance = weaponposition:getDistance(shipposition)&lt;br /&gt;
&lt;br /&gt;
            if shipteam ~= weaponteam and shipdistance &amp;lt; 1000 then&lt;br /&gt;
               weapon.LifeLeft = 0&lt;br /&gt;
            end&lt;br /&gt;
         end&lt;br /&gt;
      end&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
]&lt;br /&gt;
&lt;br /&gt;
#End&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting Examples|Proximity Trigger]]&lt;/div&gt;</summary>
		<author><name>Wanderer</name></author>
	</entry>
</feed>