Jump to content
Sign in to follow this  
dontknowhow

Event scripts for addons?

Recommended Posts

On the wiki I saw that it's possible to write event scripts for some specific events. I was wondering if it's possible to use them for an addon as well. They don't seem to work, and that's a bit unfortunate.

I'm sure someone will be able to answer. Thank you

---------- Post added at 07:11 PM ---------- Previous post was at 06:11 PM ----------

uhmmm... it seems that I have to use DefaultEventhandlers in the config.cpp, but that doesn't work either.

---------- Post added at 07:46 PM ---------- Previous post was at 07:11 PM ----------

it does work, it's just not completely clear how. I guess I just have to understand how default events work.

Share this post


Link to post
Share on other sites

in your config.cpp add

example!

class CfgVehicles 
{
      ....
      code
      ....
      class EventHandlers
      {
           Init = "blah execvm 'somescript.sqf';";
           Dammaged = "blah execvm 'somescript.sqf';";
           Hit = "blah execvm 'somescript.sqf';";
       };
};

there are more eventhandler. check the wiki for the full list.

Share this post


Link to post
Share on other sites
in your config.cpp add

example!

class CfgVehicles 
{
      ....
      code
      ....
      class EventHandlers
      {
           Init = "blah execvm 'somescript.sqf';";
           Dammaged = "blah execvm 'somescript.sqf';";
           Hit = "blah execvm 'somescript.sqf';";
       };
};

there are more eventhandler. check the wiki for the full list.

yeah, that's similar to what I wrote, isn't it? It just applies to vehicles. And I think it's not the same as the event script files. I tested a bit the init.sqf, and I saw that in a mission it's called when the mission is started, whereas the init event handler isn't. It's called only when a vehicle is created. I think.

I guess there is not a real solution. I'll live with it.

Share this post


Link to post
Share on other sites
yeah, that's similar to what I wrote, isn't it?

I don't see anything in your first post like that?

I tested a bit the init.sqf, and I saw that in a mission it's called when the mission is started

Init.sqf is a specific script called by the engine, it's not an event as such.

Config Init events are called, as you say, when a vehicle is created. If you have a vehicle in your mission with an init event, that init event will be called when the mission starts and creates the vehicle.

If you add an init event using addEventHandler, then it will only activate for infantry getting out of vehicles.

Share this post


Link to post
Share on other sites
I don't see anything in your first post like that?

You're right, I didn't really write it. What I meant is that it is the same as using the DefaultEventhandlers, just with a less broad scope

Init.sqf is a specific script called by the engine, it's not an event as such.

well, no, it's not an event, but it's kind of an event handler, isn't it? It's called when the mission starts. The thing is that this init works differently from the init in the config, which is a bit confusing

Config Init events are called, as you say, when a vehicle is created. If you have a vehicle in your mission with an init event, that init event will be called when the mission starts and creates the vehicle.

If you add an init event using addEventHandler, then it will only activate for infantry getting out of vehicles.

But I can use it also in other cases, right? I can specify in the config other classes with an init, like man, and in addEventHandler I give the unit I attach the event to.

Man, learning to write scripts in this environment is really hard, but I'm kind of getting into it :)

Share this post


Link to post
Share on other sites

An init.sqs processes something to whole the mission at the mission beginning.

An init event processes something to the unit at the unit creation.

The purposes used, respectively differ.

Share this post


Link to post
Share on other sites
An init.sqs processes something to whole the mission at the mission beginning.

An init event processes something to the unit at the unit creation.

The purposes used, respectively differ.

yeah, that's what I thought. As I said it's a bit confusing, even because the documentation is probably not correct: for the init in the config.cpp I read "Triggered on mission start", which is wrong.

Anyway, something learned. Thanks for your time guys

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×