Programatically setting turret command

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
Hornet108
Posts: 343
Joined: Thu, 15. Nov 12, 13:46
x4

Programatically setting turret command

Post by Hornet108 » Sat, 19. Jan 13, 04:05

Hi All

Struggling with this one a little, looking for a way to programatically set a turrets command to missile defence.

There's the whole $turret -> set command: TURRET_MISSLE_DEFENCE but I'm struggling to find a command that will allow me to set $turret to be assigned to the turret in question.

Can someone help a scripting newbie out?

:D

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sat, 19. Jan 13, 05:37

Turret scripts use tasks 1-6 on the ship.

You
START SCRIPT on task 1-6, supplying the same number as "argument 1".
(the argument is some nonsensical legacy issue that my turret scripts don't have)


With setting turret COMMANDS you're probably referring to the default scripts that are assigned to turret commands at setup time.
That doesn't matter if you want to start a turret script when you want to.

But to be honest, I'm not entirely sure what your question is...
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Hornet108
Posts: 343
Joined: Thu, 15. Nov 12, 13:46
x4

Post by Hornet108 » Sat, 19. Jan 13, 05:49

Hmm, my question boils down to I have a script creating ships, and I would like to automatically set the turrets on those ships to missile defence as their created without the need to go through all of them manually.

User avatar
Jack08
Posts: 2993
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by Jack08 » Sat, 19. Jan 13, 05:54

Hornet108 wrote:Hmm, my question boils down to I have a script creating ships, and I would like to automatically set the turrets on those ships to missile defence as their created without the need to go through all of them manually.
Somthing along the lines of

Code: Select all

$turrets = $object->get number of turrets
while $turrets
   * always dec after the begin command in this situation, as 0 is the cockpit/autopilot
   $object->begin task $turrets with script 'TurretScript' and priority 0: arg1=$turrets arg2=null arg3=null arg4=null arg5=null
   dec $turrets
end
[ external image ]
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire

Post Reply

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