Detector (Finds Abandoned Ships, Tunings, Hidden Objects) [TC][AP][ALP]

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Detector (Finds Abandoned Ships, Tunings, Hidden Objects) [TC][AP][ALP]

Post by DrBullwinkle » Mon, 11. Jun 12, 19:08

.
Detector
[ external image ]
Finds Abandoned Ships, Engine and Rudder Tunings, Hidden Objects, and Nividium Rock Clusters.

Detector gives a repeating, audible, "tick" when there is a "bonus" object of interest in the current sector. The sound changes to a "blip" when your ship is pointed in the general direction of the target. The blip changes in tone as your aim improves. The blip also repeats more frequently as you approach the target ship.

The Detector Scanner Upgrade can be purchased at Argon Equipment Docks, Terran Orbital Defense Stations, and Pirate Bases. (Requires Cycrow's Ware Manager to add the ware to equipment docks and pirate bases.)

v1.18 for games with vanilla sounds. Minor update. Does not require the Ware Manager.
Most players should use this version.

v1.18 For Major Mods.
Does not require the Ware Manager.
(For use with XRM, XTC, CMOD4 and other mods that change types\Sounds.txt)


"Thank You" to alt3rn1ty for contributing the great new sounds!
"Thank You" to X2return for contributing the new German language file!


Features
  • :arrow: Makes hunting for abandoned ships more fun.
    :arrow: Makes hunting for Engine and Rudder Tuning Kits easier and more reliable.
    :arrow: Makes hunting for Nividium Rock Clusters possible (especially in TC).
    :arrow: It takes more work than scripts which simply find them for you, but it is less painstaking than mapping an entire sector before you know whether or not there is anything to find.
    :arrow: Artificial Life Plugin (ALP). Can be toggled On or Off in the Gameplay / Artificial Life Settings menu.
    :arrow: Based on an idea proposed by X-Plorer and X2-Illuminatus in the "Metal Detector" thread and inspired by the the prototype "radar" in the Balance of Power Plot (X3:Terran Conflict).

New Features
(since v1.08 )
  • Mute Button Hotkey. (Automatically Un-Mutes when player changes sector.) (Detector now stays Off if the Artificial Life Plugin is turned Off).
  • New sounds (thanks, alt3rn1ty!) (sounds can be changed in t file).
  • Pings faster as aim improves. Tighter Hot and Warm zones for easier aim.
  • Improved distance feedback (updates more often now).
  • Finds any hidden object. Visual hint displayed when near target (<5km).
  • New Custom Ware (optional). The ware is built into AP 3.0.
  • Ping sounds can be changed in t file.
  • Compatible with AP3.0. Detection can now be started or stopped under plot control (with optional override).
  • Stop pings after targeting the object.
  • Stop pings when in space suit.
  • Stop pings when docked.
  • Fewer subtitle updates at close range.
  • Mineral Scanner required only for Nividium.
  • All text is now in the language (t) file for easy translations.
  • Requires Cycrow's Ware Manager to add the ware to equipment docks and pirate bases.
About AP 3.0 (and above)
  • A special, limited, version of Detector is built into AP 3.0 (and higher). The limited version is only available during two missions in the Shady Business plot.

    To enable the full version of Detector, simply install this package.


Installation
  • The easy way to install Detector is with the Plugin Manager: Install Archive.

    The PM will automatically detect the numbered .cat and will install it as a fake patch. The PM will do the renumbering for you. You can then view and control fake patches from the PM's Advanced menu. Start the PM in Advanced Mode if you want to use the Advanced menu.

    If you want to install manually, then place the scripts and t folder in the X3TerranConflict folder (for TC) or the X3TerranConflict\addon folder for AP. You can also place the optional .cat and .dat files in the same folder; renumber them to the next-highest number after the existing .cats.

    If this is your first time installing a script, mod, or fake patch, then see: Installation Tips.

    Installing the new sounds into major mods (XRM, XTC, etc)
    • 1) Use the package for major mods.

      2) Detector Script: Install with Plugin Manager or manual install.

      3a) Sounds: If you do not use a mod that changes Sounds.txt, then install the "Optional Sounds for vanilla games" .cat/.dat as fake patch in the root X3TerranConflict folder (same for TC and AP).

      3b) If you *do* use a major mod that changes Sounds.txt, then use the "Optional Sounds for major mods" .cat/.dat pair.

      4) Please report any installation problems. Thank you!


Discussion Thread: http://forum.egosoft.com/viewtopic.php?t=324011
Bullwinkle's List: http://forum.egosoft.com/viewtopic.php?t=322735


.
Last edited by X2-Illuminatus on Sun, 23. Jun 19, 10:29, edited 50 times in total.
Reason: Adjusted download links to point to the direct download instead of the repository.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 11. Jun 12, 19:09

Change History
  • v1.17_Full (2013-05-15)
    - Enabled full version of Detector in AP3.0.
    - Added option to disable requirement for the custom ware (in case of ware conflicts).
    - Added waremanager message to t file.
    - Added setup script to load t file and stock ware at Equipment Docks and Pirate Bases.

    v1.17_RC4 (2013-05-12)
    - Add text ids for target.types. ID`s 211-215. Lines 78-82, 218-245 (-X2-Illuminatus)
    - New text ids on page 8552: 450-453 (no translation required).
    - New text ids on page 8552: 211-215 (OK to translate).
    - Fixed incorrect shut off when not under plot control. Lines 150-152
    - Beeps faster when warm or hot. Helps to improve aim. Lines 337-352 and 498-511.
    - Read sounds from language file . Lines 62-69.
    - al.plugin.bw.detector.event is the only script changed in this version.

    v1.16 (2013-04-16)
    *IMPORTANT*: Two changes to text page 17:
    Change:
    <t id="5853">(do not speak)Detector Scanner Upgrade</t>

    Add:
    <t id="5854">Detector is a specialized scanner upgrade used in the Shady Business plot. \n\nIt upgrades ship scanners to help find some objects that are normally undetectable by regular scanners. Detector's lack of pinpoint accuracy is offset by it's long range. \n\nWhen Detector finds an object it will sound a "tick" to let you know that there is something to search for. Gradually turn the ship to "seek" the correct direction. When the ship is close to facing the correct direction, the tick will change to a ping. As aim improves, the ping sound will change and the subtitle will display whether aim is cold, warm, or hot (meaning that the object is nearly in front of the ship). \n\nA Mute Button hotkey is available to silence Detector until you change sectors. </t>

    Minor changes to page 38552:
    <t id="401">Enable(Abandoned Ships)</t>
    <t id="402">Enable(Tunings)</t>
    <t id="403">Disable(Nividium)</t>
    <t id="404">Enable(Plot Control. Detector must be started and stopped by plugin.bw.detector.start/stop)</t>
    <t id="405">Enable(Detect only hidden objects. Plot support.)</t>
    <t id="406">Enable(Detect all hidden objects. Plot support.)</t>

    Scripts updated:
    al.plugin.bw.detector.event
    plugin.bw.detector.detect.ware

    Change Details:
    - Fixed bug in .detect.ware. Now finds all hidden wares before searching for any other floating wares (reported by eldyran).
    - Fixed bug that enabled Detector when loading old saved game (reported by dillpickle).
    - Added custom ware to solve future problem (Bonus Pack version). Used TWareT SS_WARE_SW_NEW11, page 17 ids 5853 and 5854.
    - Ping intermittently at short range (<16km) (less annoying). ~Line 275.
    - Add visual marker for hard-to-see objects at short range (<4km). ~Line 291.
    - Tightened "Hot" and "Warm" cones slightly near lines 269, 270.
    - Add mutex near lines 154, 110, 122 to prevent AL Pile-up when $Timer is very short (fail-safe).
    - Better fake floating point math near lines 236 and 257.
    - Added extra distance band at 6km near line 472.
    * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    v1.15 (-2013-03-27)
    - Fixed debugger error reported by Xenon_Slayer
    (near line 72 in al.plugin.bw.detector.event).

    v1.14 (2013-03-27)
    - Fixed bug: Detector was "On" by default (Thanks, Dillpickle).
    - Added more distance bands for better feedback to player.

    v1.13 (2013-03-07)
    - Bug Fix: Start and Stop commands were (incorrectly) toggling On/Off.
    - Please Fix t file: ID's 407 and 408 should be 209 and 210, respectively.

    v1.12 (2013-02-28 )
    - Moved hotkey registration to ALP Init.
    - Remove a.bw.detector.count.
    - Remove setup.plugin.bw.detector.hotkey
    - Removed blank lines at end of scripts.

    v1.11 (2013-02-28 )
    - Fixed "While $array.size" loop in .detect.ship.
    - Rewrote conditional block in .event.
    - Changed "target.ship" to "target" in .event for readability.
    - Tested and improved handling of hidden wares in .detect.ware and .event.
    - Clear Plot.State on reinit (prevents possible ability to start/stop ALP without MD).
    - Add Subtitle text for Mute and UnMute

    v1.10 (2013-02-26)
    - Finds *all* hidden flying objects (wares).

    v1.09 (2013-02-25)
    - Detection can be started or stopped from an MD script. Call plugin.bw.detector.start/stop.
    - Disable ALP toggle if started via MD. Means that *only* MD can start or stop Detector.
    - Find only hidden objects
    - Stop pings after targeting.
    - Stop pings when in space suit.
    - Mute Button Hotkey.
    - Un-Mute on ChangeSector.
    - Mineral Scanner required only for Nividium.
    - Move math libraries into main script.

    v1.08 (2012-09-10)
    - Improved subtitle accuracy for asteroids and some rock sizes. (Charon_A)
    - Detector is now turned off when docked.

    v1.07 (2012-09-07)
    Improved detection at long range (T3Lunaris):
    - Added two more sounds to better indicate correct direction.
    - Added subtitle text: Type of Object / Approximate Range / Direction Quality (Cool, Warm, Hot)
    - Frequency of ticks/pings now varies at "Power of 2" distances (Means easier detection in very large sectors).
    - Fixed a rare bug when a target object is near the outer edge of the sector.
    - Another bug fix to lib.bw.detector.count for better compatibility with ASS-AP.

    v1.06 (2012-08-15)
    - Includes minor bug fix to lib.bw.detector.count for compatibility with ASS-AP. (Nacroma)

    v1.05 (2012-08-15)
    - Fixes bug with detection of abandoned ships in non-English games. (Thanks, Nacroma!)
    - Adds script to write out abandoned ships to log. (Manually run lib.bw.detector.count from Script Editor)
    - Adds options to enable detection only for selected objects. For example, you can detect ships and tunings but not Nividium, if you prefer. Configurable in t file.

    v1.04 (2012-07-04)
    - More reliable and faster detection of tuning kits (Charon_A)

    v1.03 (2012-06-21)
    - Finds more Nividium clusters (Charon_A)

    v1.02 (2012-06-21)
    - Added tuning crates to the detector; first pass.
    - Now finds nearest target, if there is more than one.

    v1.01
    - Added Nividium Rock Clusters to the detector. (Argonaught)

    v1.00 Initial Release (Bullwinkle)
Last edited by DrBullwinkle on Thu, 16. May 13, 02:41, edited 2 times in total.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 11. Jun 12, 19:09

Reserved 2

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 11. Jun 12, 19:09

Reserved 3

User avatar
Argonaught.
Posts: 1827
Joined: Wed, 6. Nov 02, 20:31
x4

Post by Argonaught. » Mon, 11. Jun 12, 21:12

Nice.

If your stuck for a job then any chance you could look at the vanilla collect rocks command and add in Nvidium as a rock to collect?
Or create a new command to do it :D

Argo.
[MOD]X3TC No Fog / [MOD]X3AP No Fog / [MD]X3TC Menagerie Shipyard / [MD]X3AP Menagerie Shipyard
<==<<Argonaught>>==>

XBTF>XT>X2TT>X3R>X3TC>X3AP>X4F

I lurk alot for the most part now
:thumb_up:

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 11. Jun 12, 21:56

Argonaught. wrote:any chance you could look at the vanilla collect rocks command and add in Nvidium as a rock to collect?
Collect Rocks will already collect Nividium. In the vanilla game, the only way to find Nividium rock clusters is to collect rocks everywhere and hope that you are lucky enough to stumble upon a Nividium cluster. Of course, if your miners are working OOS, then they may have Nividium in their cargo holds but you will have no clue where they found it.

Mobile Mining is the command you are looking for. And it just so happens that I fixed that a long time ago. :)

However, it is completely untested. It should work, but I have never tried. So it is up to you, Argo, to try it and let me know whether it needs any adjustment.



* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mobile Mining Mk2
New Name: Mobile Mining Mk2
Last edited by DrBullwinkle on Sat, 23. Jun 12, 03:53, edited 3 times in total.

User avatar
Argonaught.
Posts: 1827
Joined: Wed, 6. Nov 02, 20:31
x4

Post by Argonaught. » Mon, 11. Jun 12, 22:45

Nice, I'll give it a test over a few days and let you know :)

Argo.
[MOD]X3TC No Fog / [MOD]X3AP No Fog / [MD]X3TC Menagerie Shipyard / [MD]X3AP Menagerie Shipyard
<==<<Argonaught>>==>

XBTF>XT>X2TT>X3R>X3TC>X3AP>X4F

I lurk alot for the most part now
:thumb_up:

User avatar
Charon_A
Posts: 105
Joined: Wed, 6. Nov 02, 20:31

Post by Charon_A » Tue, 12. Jun 12, 20:51

So far so good. Nv is being mined IS and OOS without problems :P Thanks!
One change I made - to get mineral type cyclically changing from Nv back to Ore you can use following code:

Code: Select all

    if $mineral == {Ore}
      $mineral = {Silicon Wafers}
    else if $mineral == {Silicon Wafers}
      $mineral = {Ice}
    else if $mineral == {Ice}
      $mineral = {Nividium 15_2}
    else
      $mineral = {Ore}
    end
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 12. Jun 12, 20:54

Yeah, I already made that change for the next version.

I am testing pause for shield restoration and automatic repairs now, before I post it.

Thanks for the report!

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24965
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Tue, 12. Jun 12, 21:24

Based on an idea proposed by X-Plorer and X2-Illuminatus in the "Metal Detector" thread.
Ah, nice. :) I will have a look at it, once I find the time.

Now I wonder, if this will work:
  1. Post an idea in a thread in the S&M forum.
  2. Make DrBullwinkle aware of it.
  3. Wait until the final script is released.

:gruebel:
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 12. Jun 12, 21:41

Well, if it's a good idea, then, sure!

Especially if it solves two problems with the game that have bothered me ever since my first few hours exploring X games.

(And if I can figure out how to do it.)

Probably.

Maybe.

:)

In any case, I am glad that you took the time to present the idea clearly. I almost passed over it at first. But the result adds a small challenge to two tasks that were previously almost impossible without cheating (and were too easy if you did cheat). So, Thanks!

User avatar
Charon_A
Posts: 105
Joined: Wed, 6. Nov 02, 20:31

Post by Charon_A » Thu, 21. Jun 12, 11:52

Thanks for updated version, DrBullwinkle!

EDIT: Now to potential bugs
Installed, confirm that it pings for abandoned ships and for some nividium.
Pings for nividium rocks from the asteroid that I thrashed in PS, but does not detect nividium rocks in KE no matter how close I am.

I can't make it ping for secret tuning crates so far. Jumped around the sectors that are supposed to have those containers, performed unfocused jumps - nothing.
(Btw. I edited the range in plugin.bw.detector.detect.ware.xml, multiplied it by 1000 - still no detections. )
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Fri, 22. Jun 12, 00:47

Charon_A wrote:does not detect nividium rocks in KE
Fixed.

I should have said that the Detector might find tuning kits. Maybe. I have not been able to find one to test it on. :)

Thanks for the report, Charon!



* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Update

Detector v1.03

- v1.03: Finds more Nividium clusters. (Charon_A)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

.
Last edited by DrBullwinkle on Thu, 5. Jul 12, 04:33, edited 3 times in total.

User avatar
Charon_A
Posts: 105
Joined: Wed, 6. Nov 02, 20:31

Post by Charon_A » Tue, 3. Jul 12, 17:35

Thanks, DrBullwinkle! I'm back, cheked out your update - looks great. Seems that all Nividium rocks are now pinging OK.
Can't test pings on the secret containers. Still searching for one to test on.
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

User avatar
Charon_A
Posts: 105
Joined: Wed, 6. Nov 02, 20:31

Post by Charon_A » Tue, 3. Jul 12, 20:21

Finally managed to test secret containers and found that detector ignores them.
Edited:
The fix looked simple at first, I set maxnum=99 and detector worked on scripted-in containers that I dropped. But when I tried it on the real hidden ones the game kept hanging...
Setting maxnum back to null prevents hanging but also stops the detector pings.
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

User avatar
Charon_A
Posts: 105
Joined: Wed, 6. Nov 02, 20:31

Post by Charon_A » Wed, 4. Jul 12, 17:18

DrBullwinkle, looks like I managed to make it work on the secret crates.
Removed $debris.array from your code. Detector now pings and game does not hang. Please take a look - since it was your code you might find more elegant fix.

Code: Select all

FindWare:
$method = 'Ware'
* $flags = [Find.Multiple] | [Find.Nearest]
$flags = null
$maintype = null
$subtype = null
* $debris.array = find flying ware: sector=$sector maintype=$maintype subtype=$subtype flags=$flags refobj=[PLAYERSHIP] maxdist=$range maxnum=null, refpos=null
$debris = find flying ware: sector=$sector maintype=$maintype subtype=$subtype flags=$flags refobj=[PLAYERSHIP] maxdist=$range maxnum=9, refpos=null
= wait 100 ms

* if is datatyp[ $debris.array ] == {DATATYPE_ARRAY}
* $debris.array.idx = size of array $debris.array
* $i = 0
* while $i < $debris.array.idx
* $debris = $debris.array[$i]
if $debris->exists
  $resource.found = $debris->get ware type code of object
  if $resource.found == $resource.to.search
    $retval = $debris
    gosub LogIt
    return $retval
  end
end
* end
* end

endsub
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 4. Jul 12, 18:32

Charon_A wrote:I set maxnum=99
Good catch, Charon. Maxnum is required with [Find.Multiple]. I will fix that in the next version, which will be after I find a couple of valid test cases.

Charon_A wrote:detector worked on scripted-in containers that I dropped. But when I tried it on the real hidden ones the game kept hanging...
Right. As you discovered, that is not a conclusive test. :)

Regarding the hang, I have never experienced a hang/lockup from the Detector.

I suppose that there is a possible case where there are many wares (and one is very near) that could cause a performance problem in the AL loop. I will make sure that cannot happen in the next version.

Charon_A wrote:Removed $debris.array from your code.
Without the array, the detector will find only one ware in the sector. If other wares exist then it may not find the ware that we are looking for.

Also, the array is required because I have never seen a complete list of maintypes and subtypes, so I cannot search for a specific ware.

I may be able to improve that part of the code *after* I find a couple of crates to test. If we knew the maintype and subtype then we could use [Find.Nearest] and eliminate [Find.Multiple].

Until then, the array is the only way that I can think of to test the ware type correctly. Your code might work under specific circumstances, but it will fail under others.


So I appreciate your reports, Charon, although I think your code suggestions are not yet complete.
.

User avatar
Charon_A
Posts: 105
Joined: Wed, 6. Nov 02, 20:31

Post by Charon_A » Wed, 4. Jul 12, 19:31

Somewhere around I saw:
engine is maintype=16 subtype=17
rudder is maintype=16 subtype=18

As for hanging - it was happening a few seconds after I jumped/flew into the sector that contained container.
Script showed that container was quite far away >30km and it was the only flying ware in the sector. Container had 5 engine tunings inside.
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 4. Jul 12, 19:40

Charon_A wrote:Somewhere around I saw:
engine is maintype=16 subtype=17
rudder is maintype=16 subtype=18
Thanks! That clue was enough for me to find a list that I could not previously locate: Maintype and Subtype Lists.

I can now write code around those, although I still need a good sample to test.

User avatar
Charon_A
Posts: 105
Joined: Wed, 6. Nov 02, 20:31

Post by Charon_A » Wed, 4. Jul 12, 20:59

Here is the script that I used to locate secret stashes for testing:
Find All Crates And Abandoned Ships

P.S. Just checked the case where more than 1 secret container is in the sector. (I had both engine & rudder in one sector). After I picked engine tunings, radar switched over to the rudder. So far I saw no problems caused by removal of the array.
Be careful about reading health books. You may die of a misprint.
---Mark Twain---

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”