[Scripting] Vanilla signals

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
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

[Scripting] Vanilla signals

Post by Joubarbe » Wed, 26. Jun 19, 16:06

Hi,

!init.ship.globalscriptmap.std:

Code: Select all

global script map: set: key=[SIGNAL_ATTACKED], class=[Ship], race=$race, script=`!ship.signal.attacked`, prio=100
This signal is supposed to be triggered about everytime a ship receives a hit. But it's not. A simple "display subtitle" would confirm that: a few shots only trigger it. Now, if I replace the above by the following:

Code: Select all

global secondary signal map: remove signal=[SIGNAL_ATTACKED] race=$race class=[Ship] name='!ship.signal.attacked'
global secondary signal map: add signal=[SIGNAL_ATTACKED] race=$race class=[Ship] script='!ship.signal.attacked' prio=100 name='!ship.signal.attacked'
The amount of event triggered is a lot higher, giving me the impression that the first command is not working as intended.
What I did, among other things, is to force all carriers to eject their fighters and interrupt their current task to attack the carrier's target when he's under attack. And the second set of commands gives much better result than the first one.

However, I recently encountered several freezes I cannot explain. It may be totally unrelated, but maybe someone here knows about signals and if there's something to avoid, like what I've just explained here?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Re: [Scripting] Vanilla signals

Post by Cycrow » Thu, 27. Jun 19, 10:58

SIGNAL_ATTACKED is actually when the ship is attacked not when its hit.
there are a number of conditions to determine if a hit is actually an attack, including number of hits, or if the ship is an enemy, etc

Once triggered, it wont trigger again for a certain amount of time. This was mainly done like this for performance reasons, and not designed to just detect hits.

SIGNAL_DAMAGE is the same, as its connected to SIGNAL_ATTACKED, but triggers only when theres hull damage as well

Post Reply

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