OFPEC Forum

Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: 456820 on 26 Sep 2005, 18:03:08

Title: run scripts
Post by: 456820 on 26 Sep 2005, 18:03:08
okay im kind of creating an addon more like editing one but ive struck a problem
ive got an addon wich is just a few scripts how can i get one script called init.sqs for example to run straight away once ofp has started ?
secondly how can i run scripts through the init.sqs ?
for example the path to run the script like
addons/myaddon.pbo/folder/script.sqs
i think thats how its done but im not sure i dont know anything about addons im just editing it to suit my own needs

any help would be great
Title: Re:run scripts
Post by: Kyle Sarnik on 26 Sep 2005, 20:49:12
For any CfgVehicle entry in a config, you can add eventhandlers. Using the init eventhandler, the script will execute (locally of course) for each unit as soon as it is created (or at the start of the mission). It looks like this:

Code: [Select]
      class Eventhandlers
      {
         init="_this exec {\path\script.sqs}";
      };

The path will allways start with a "\" if it is inside of a .pbo file. The rest of the path is simple, just treat the .pbo file as a folder.
Title: Re:run scripts
Post by: 456820 on 27 Sep 2005, 17:58:59
thanks for that i think it seems to work so topic solved thanks
Title: Re:run scripts
Post by: 456820 on 28 Sep 2005, 21:34:17
little prob does what you suggested run the script on vechiles aswell or just units ?
Title: Re:run scripts
Post by: Kyle Sarnik on 29 Sep 2005, 03:20:54
little prob does what you suggested run the script on vechiles aswell or just units ?

Oh please, don't make me have to answer this for you, re-read my post and you'll be able to answer yourself...