[7.6] MODDING - set_object_scanned

Ask here if you experience technical problems with X4: Foundations.

Moderator: Moderators for English X Forum

z1ppeh
Posts: 673
Joined: Sat, 8. May 04, 21:19
x4

[7.6] MODDING - set_object_scanned

Post by z1ppeh »

Obscure and not exactly a technical issue but it has confused a few of us as to 'why' and there are erroneous results in the game for a plotline and timelines scenarios using this.

set_object_scanned object="$whatever" 'should' according to the xsd should set the scanlevel to the players scanner. This is used throughout the base game files in various places. However this does not work. It scans the components but NOT the ship itself.

set_object_scanned object="$whatever.parent" DOES work and sets the revealpercentage to the appropriate scanlevel vs the ships secrecy. Not a clue why.



All I originally wanted was a simple script to scan things when I fired a long range scan. attached is the code for the mod.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<mdscript name="longrangescanplayer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
    <cues>
        <cue name="longrangescanplayer" instantiate="true">
            <conditions>
                <event_long_range_scan_sent group="global.$PlayerShipsGroup" />
            </conditions>
            <actions>
                <find_ship groupname="$foundships" class="[class.ship_xl, class.ship_l, class.ship_m, class.ship_s]" space="player.sector" multiple="true">
                    <match_distance object="player.entity" max="200km" />
                    <match owner="faction.player" negate="true" />
                </find_ship>
                <debug_text text="'ZIPSCAN Foundships count: ' + $foundships.count" />

                <set_value name="$playerscanlevel" exact="player.scanlevel" />
                <debug_text text="'ZIPSCAN Player Scan level: ' + $playerscanlevel" />
                <do_for_each name="$operatingship" in="$foundships">
                    <do_if value="$operatingship.scannedlevel lt $playerscanlevel">
                        <debug_text text="'ZIPSCAN Scanning ' + $operatingship.knownname + ' from objectscanlevel ' + $operatingship.scannedlevel + ' to ' + $playerscanlevel" />
                        <set_value name="$foundtargetstoscan" operation="add" exact="1" />
                        <set_known object="$operatingship" known="true" />
                        <set_scan_target target="$operatingship" />
                        <set_object_scanned object="$operatingship.parent" />
                        <debug_text text="'ZIPSCAN scanned ship ' + $operatingship.knownname + ' is now scanlevel ' + $operatingship.scannedlevel + ' with revealed % ' + $operatingship.revealedpercentage" />
                    </do_if>
                    <do_else>
                        <set_value name="$foundtargetsnoscan" operation="add" exact="1" />
                    </do_else>
                </do_for_each>
                <show_notification text="'Ships found: ' + $foundships.count + '. Scanning: ' + $foundtargetstoscan + '. Not scanning: ' + $foundtargetsnoscan" />
                <remove_value name="$foundships" />
                <remove_value name="$foundtargetstoscan" />
                <remove_value name="$foundtargetsnoscan" />
                <remove_value name="$playerscanlevel" />
            </actions>
        </cue>
    </cues>
</mdscript>
User avatar
ChemODun
Posts: 436
Joined: Mon, 12. Feb 07, 21:58
x4

Re: [7.6] MODDING - set_object_scanned

Post by ChemODun »

Thanks for investigation and sharing! :thumb_up:
Multiply entropy by absolute zero

Freedom in space

Return to “X4: Foundations - Technical Support”