Ship related to mission?

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

Ship related to mission?

Post by Joubarbe » Fri, 28. Jun 19, 18:29

Hi,

Is there a way to know if a ship is related to a mission? They don't seem to have a job, so it's kinda difficult (and flight time is too hazardous). A local variable maybe?
I'm interested in the Defend Object mission.

Thanks!

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: Ship related to mission?

Post by Joubarbe » Sat, 29. Jun 19, 16:33

The following on a [SIGNAL_CHANGESECTOR] seems to do the trick:

Code: Select all


$target = [THIS]-> get attack target
$flightTime = [THIS]-> get flight time
$plSector = [PLAYERSHIP]-> get sector
dim $defendObjectRaces = [Xenon], [Pirates], [Yaki]

if find [OWNER] in array: $defendObjectRaces
  if $target -> is of type [Station]
    if $sector == $plSector AND $flightTime <= 60
      $target = [THIS]-> get attack target
      if $target-> is of class [Station]
        * Cha-ching!
      end
    end
  end
end

return null
EDIT: modified the code, previous one was not affecting all ships.

Post Reply

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