OFPEC Forum

Addons & Mods Depot => ArmA - Addons & Mods Discussion => Topic started by: OliverPA on 07 Jul 2007, 16:46:41

Title: init script for addons
Post by: OliverPA on 07 Jul 2007, 16:46:41
Hi,

I've been trying for days to create an addon that executes a script whenever a mission starts.
So far I've searched many forums, unpbo'd many addons to get some ideas, ... with no luck.
The addon I'm trying to create adds no units, but simply consists of a script that runs in the background and needs to be called whenever a mission is started. Also the script should be called for any mission without having to edit the mission itself.

Thanks for your help!
Oliver.
Title: Re: init script for addons
Post by: h- on 07 Jul 2007, 17:12:06
An addon so it must be present in a mission before it can execute any scripts because the vehicle has to be 'initialized' before the init eventHandler (which you undoubtedly are using) is triggered, so what you're trying to achieve is impossible to do, with an addon or having to edit the mission itself.
Title: Re: init script for addons
Post by: OliverPA on 14 Jul 2007, 13:51:59
Thanks, your answer helped me find a solution:

Code: [Select]
class CfgVehicles {
  class Land;
  class Man : Land {};

  class CAManBase : Man {
    class eventhandlers {
      init = "[] execVM ""\SightAdjustment\scripts\SightAdjustmentInit.sqf"";";
    };
  };
};

The script itself checks whether it's called the first time or not, so it will get called quite often but always exits quickly except for the first call.
regards, Oliver.