Command_turret?
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Command_turret?
first post ^^
im new to scripting but ive been looking through alot of the popular scripts that are on this site and i use alot of them too, my question is that i would like to make a script that automaticly sets the turrent command to - > attack all enemies. for all of the players m1 & m2 ships. is it even possible? so far when ive used the command COMMAND_TURRET_PROTECT but nothing happens, when set to attack all enemy the ship just starts cruising around if it had been given the order to attack enemies, rather than setting its turrets to that command
ive searched this forum but i havent been able to find out if anyones asked about this before sorry if it has been asked though
im new to scripting but ive been looking through alot of the popular scripts that are on this site and i use alot of them too, my question is that i would like to make a script that automaticly sets the turrent command to - > attack all enemies. for all of the players m1 & m2 ships. is it even possible? so far when ive used the command COMMAND_TURRET_PROTECT but nothing happens, when set to attack all enemy the ship just starts cruising around if it had been given the order to attack enemies, rather than setting its turrets to that command
ive searched this forum but i havent been able to find out if anyones asked about this before sorry if it has been asked though
thanks for the reply, with your bit of insight I have come up with(not sure if its right)
@ START $ship -> call script "!turret.killenemies.std" : ?0=1,
@ START $ship -> call script "!turret.killenemies.std" : ?0=2,
@ START $ship -> call script "!turret.killenemies.std" : ?0=3,
@ START $ship -> call script "!turret.killenemies.std" : ?0=4,
@ START $ship -> call script "!turret.killenemies.std" : ?0=5,
@ START $ship -> call script "!turret.killenemies.std" : ?0=6,
in the script, the ship will start attacking any enemies, but ive noticed if more than one ship is created , they will just stop attacking. and if the ship is given any other order the ship just goes back to normal :/
also is there any way to set the actual command console>turret commands>set all turret commands> to attack all enemies? with one of these scripts, since thats what i was wanting to do originally.
@ START $ship -> call script "!turret.killenemies.std" : ?0=1,
@ START $ship -> call script "!turret.killenemies.std" : ?0=2,
@ START $ship -> call script "!turret.killenemies.std" : ?0=3,
@ START $ship -> call script "!turret.killenemies.std" : ?0=4,
@ START $ship -> call script "!turret.killenemies.std" : ?0=5,
@ START $ship -> call script "!turret.killenemies.std" : ?0=6,
in the script, the ship will start attacking any enemies, but ive noticed if more than one ship is created , they will just stop attacking. and if the ship is given any other order the ship just goes back to normal :/
also is there any way to set the actual command console>turret commands>set all turret commands> to attack all enemies? with one of these scripts, since thats what i was wanting to do originally.
Code: Select all
@ START $ship -> call script "!turret.killenemies.std" :
to start the script on the rear turret of a Nova:
Code: Select all
$ship -> start task 1 with script "!turret.killenemies.std" and prio 0:...
adding on from moggy
Code: Select all
$turrets = get number of turrets
while $turrets
$ship -> start task $turrets with script "!turret.killenemies.std"
dec $turrets
end
Quick question about that:
Can you refer to the command with a variable?
ie:
I can only assume, not.
Can you refer to the command with a variable?
ie:
Code: Select all
$turrets = get number of turrets
$cmd == '!turret.killenemies.std'
while $turrets
$ship -> start task $turrets with script $cmd
dec $turrets
end
I can only assume, not.
nope, unfortuatlly you cant do that, as anything that requires you to select a script, ie the call script or start task functions, will only display the list of scripts, you cant actually select a varible, so you wont even be able to enter that.
unless u edit the xml files directly of course, but then ur prolly jsut end up curropting the script
unless u edit the xml files directly of course, but then ur prolly jsut end up curropting the script
Corrected the above code ....
G
Code: Select all
$turrets = get number of turrets
while $turrets > 1
dec $turrets
$ship -> start task $turrets with script "!turret.killenemies.std"
end
G
yeah if there is 6 turrets, then the tasks go from 1 to 6, not 0 to 5.
so what your doing, is getting the number of turrets, which would be 6, then decrementing it to 5, then running it on task 5, so you code actually does turrets 1 to 5, and misses the last turret.
by putting the dec after, the first task will be 6, which is the 6th turret, then when it gets to 0, it exits the loop before getting to the start task, so it only runnings task 1 to 6
so what your doing, is getting the number of turrets, which would be 6, then decrementing it to 5, then running it on task 5, so you code actually does turrets 1 to 5, and misses the last turret.
by putting the dec after, the first task will be 6, which is the 6th turret, then when it gets to 0, it exits the loop before getting to the start task, so it only runnings task 1 to 6
get max number of turrets ..
M2 == 7
turret ID 0 = main
1-6 = turrets
get max turrets (7)
while turret-id
start turret "7" ....
no, you guys are wrong
first decline the index than get the 1st turret ....
(in a loop with dec. its first dec. than the stuff, when using inc. first the stuff than the inc. ... now you guys are combining 2 methods ...)
G
M2 == 7
turret ID 0 = main
1-6 = turrets
get max turrets (7)
while turret-id
start turret "7" ....
no, you guys are wrong
first decline the index than get the 1st turret ....
(in a loop with dec. its first dec. than the stuff, when using inc. first the stuff than the inc. ... now you guys are combining 2 methods ...)
G
thats not actually true, dec doesn't always have to be first, it really depends what the loop is doing, the same with inc, it can be first, it can even be in the middle if you like, it just depends what the rest of the loop is doingRed Spot wrote:(in a loop with dec. its first dec. than the stuff, when using inc. first the stuff than the inc. ... now you guys are combining 2 methods ...)
I take it than that you still dont see the flaw in your logic ...
Whats that turret-script you start on task 7 going to do, except bug up the place ... ? with your coding/logic you will start an extra task on any ship with a turret wich never gets switched of as you basicly have no control over it (a regular player wont) and as this isnt an actual turret it may even cause it to run OOS adding even more presure to your game ..
G
Whats that turret-script you start on task 7 going to do, except bug up the place ... ? with your coding/logic you will start an extra task on any ship with a turret wich never gets switched of as you basicly have no control over it (a regular player wont) and as this isnt an actual turret it may even cause it to run OOS adding even more presure to your game ..
G
>< after acouple days of not touching the game, i started up x3 and the script isnt working like it used too :/ , the only turret that works is the front turret and i cant figure out why, even though all the commands are being used for every turrent and they are even set under the orders command.
right now i have this, but with the task# set to all the turrets too
$ship -> start task 1 with script "!turret.killenemies.std" and prio 0 : arg1= [TRUE] arg2= [TRUE] arg3= [TRUE] arg4= [TRUE] arg5= [TRUE]
ive even tried this with acouple different turret commands, only seems that the front turret wants to fire
$turrets = [THIS] -> get number of turrets
while $turrets > 1
dec $turrets =
$ship -> start task $turrets with script "turret.fighterdefense.std" and prio 0 : arg1= null arg2= null arg3= null arg4= null arg5= null
also when i commented out all the other turret ones and had it set to just work on the back or down turrets, the front turret was still the only one firing even though that command wasnt being sent to it
right now i have this, but with the task# set to all the turrets too
$ship -> start task 1 with script "!turret.killenemies.std" and prio 0 : arg1= [TRUE] arg2= [TRUE] arg3= [TRUE] arg4= [TRUE] arg5= [TRUE]
ive even tried this with acouple different turret commands, only seems that the front turret wants to fire
$turrets = [THIS] -> get number of turrets
while $turrets > 1
dec $turrets =
$ship -> start task $turrets with script "turret.fighterdefense.std" and prio 0 : arg1= null arg2= null arg3= null arg4= null arg5= null
also when i commented out all the other turret ones and had it set to just work on the back or down turrets, the front turret was still the only one firing even though that command wasnt being sent to it