Delay / Wait / Pause?

The place to discuss scripting and game modifications for X4: Foundations.

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

Post Reply
Trajan von Olb
Posts: 545
Joined: Wed, 4. Feb 04, 21:39
x3tc

Delay / Wait / Pause?

Post by Trajan von Olb » Sat, 8. May 21, 04:17

Hi,

I've been trying to delay a command with "delay" or otherwise for at least two hours now! It's about a scripted process (specific scan), where first Betty says something, then a sound comes and only at the end, after 4-5 seconds, the action takes effect.
Unfortunately, neither "Delay" nor "Wait" works, although both are used by Egosoft in the MD scripts. Everything is actually explained well in the Mission Director Guide. Nevertheless, it does not work.
What am I doing wrong? Here is the code:

Code: Select all

				<do_if value="global.$mhklongrange == 'on'">
					<speak actor="player.computer" page="10002" line="[201, 432, 401]" priority="90" />
					<play_sound sound="'cpit_fight_screen_on'" type="ui"/>
					<delay exact="6s"/>
					<speak actor="player.computer" page="10002" line="203" priority="90" />
					<set_known object="$thing" known="true" />
				</do_if>
Thanks for answers

Schmollo aka Trajan from Olb


Translated with www.DeepL.com/Translator (free version)
Mein Traum vom Glück ist der Traum von einer anderen Menschheit. (S. Lem)

kuertee
EGOSOFT
EGOSOFT
Posts: 789
Joined: Sun, 14. Dec 03, 13:05
x4

Re: Delay / Wait / Pause?

Post by kuertee » Sat, 8. May 21, 04:27

I found delay to work only when in the same node as conditions and actions
e.g.

Code: Select all

<cue name="my_cue">
    <conditions>
        <event_what_ever />
    </conditions>
    <actions>
        <do_this />
    </actions>
    <delay exact="5s" />
    <actions>
       <then_do_this />
    </actions>
</cue>
Did add_npc_line work with player.computer (betty)? add_npc_line can play multiple dialogue lines one after another.
Mods: RPG: Reputations and Professions, Social Standings and Citizenships, Crime has Consequences, Alternatives to Death. Missions/NPCs: Emergent Missions, NPC Reactions, Mod Parts Trader, High-sec Rooms are Locked, Hacking Outcomes, More Generic Missions, Waypoint Fields for Deployment. Others: Auto-cam, Friendly Fire Tweaks, Teleport From Transporter Room, Wear and Tear. QoL: Trade Analytics, Loot Mining, Ship Scanner, Signal Leak Hunter, Station Scanner, Surface Element Targeting, etc.

Trajan von Olb
Posts: 545
Joined: Wed, 4. Feb 04, 21:39
x3tc

Re: Delay / Wait / Pause?

Post by Trajan von Olb » Sat, 8. May 21, 04:42

Oh. That's bad... I'll have to think of something :-( Are there any alternatives? Apparently there is also "wait", at least it is used in the AI scripts. But it doesn't work either...

Is it possible to write an independent subroutine (where you could use delay) that recognises a special value in a global variable as a trigger? I have to admit that I still don't understand the whole nesting of cues including variable exchange. Presumably I would have to both start a new cue here and then end the current one ("this"), right?

All right, I need to get some sleep first. See you then.

Greetings Trajan

Translated with www.DeepL.com/Translator (free version)
Mein Traum vom Glück ist der Traum von einer anderen Menschheit. (S. Lem)

Post Reply

Return to “X4: Foundations - Scripts and Modding”