Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Stormprooter on July 21, 2016, 04:41:37 am

Title: Changing a ship's $Autoaim FOV value during a mission
Post by: Stormprooter on July 21, 2016, 04:41:37 am
Hi,

I'd like to disable the autoaim feature at the start of a mission, but I don't want to have to change the $Autoaim FOV setting in ships.tbl - is there anyway to do this in FRED? Could I use something like script-eval to acheive it.

I am working with somebody else's mod, and I'd rather not have to change the ships settings if possible.

Thanks
Title: Re: Changing a ship's $Autoaim FOV value during a mission
Post by: niffiwan on July 21, 2016, 04:59:03 am
In LUA there's a ship object variable called AutoaimFOV; if you set this to zero it effectively disables autoaim.  Something like this to disable it for all ships:

 (warning, I haven't tested this!)

Code: [Select]
$On Gameplay Start: [

    local num_ships = #mn.Ships
    for i=1,num_ships do
        local ship = mn.Ships[i]

        if ship ~= nil and ship:isValid() then
            ship.AutoaimFOV = 0
        end
    end

]
Title: Re: Changing a ship's $Autoaim FOV value during a mission
Post by: Stormprooter on July 21, 2016, 05:01:58 am
Many thanks for the pointer - I will give this a try.

I am quite new to Fredding so this is a bit of a learning curve at the moment.

Thanks again
Title: Re: Changing a ship's $Autoaim FOV value during a mission
Post by: Stormprooter on July 21, 2016, 05:36:40 am
Also, do you have a link to where I can get started finding out about thins like #mn and it's properties, and where I can find things like ship properties?

I just need somewhere to start :D

Thanks
Title: Re: Changing a ship's $Autoaim FOV value during a mission
Post by: niffiwan on July 21, 2016, 07:19:41 am
If you run FSO with the "-output_scripting" command line parameter, it'll create a scripting.html file which documents all the scripting commands.  This wiki page (http://www.hard-light.net/wiki/index.php/Scripting.tbl) will also help, especially the "Useful references" section.
Title: Re: Changing a ship's $Autoaim FOV value during a mission
Post by: Stormprooter on July 21, 2016, 07:36:19 am
If you run FSO with the "-output_scripting" command line parameter, it'll create a scripting.html file which documents all the scripting commands.  This wiki page (http://www.hard-light.net/wiki/index.php/Scripting.tbl) will also help, especially the "Useful references" section.

Again, many thanks for the info - page bookmarked and now lots of experimenting to get on with :D

Cheers