Jump to content
Sign in to follow this  
Charles Barkley

CfgVehicles EventHandlers "init" is not called properly

Recommended Posts

I have the following CfgVehicles.hpp where I have a backpack which should initialize my script

 

class CfgVehicles{
    class B_AssaultPack_Base;
    class ReconMod_Camp_Backpack: B_AssaultPack_Base{
      scope = 2;
      displayName = "Recon camp backpack";
      vechicleClass = "Recon Mod";
      icon = "reconmod\data\images\reconmod_icon.paa";

      class eventhandlers{
       init = "_null = this call ReconMod_fnc_backpackInit;";
      }

    };
};

 

This does not work. But when I have this

this call ReconMod_fnc_backpackInit;

 

Within the init line in the Eden Editor everything works as expected. What did I miss to make the init call through the CfgVehicles.hpp work?

 


Greetings

Charlie

Share this post


Link to post
Share on other sites

Most likely this is not defined in an init eventhandler, but _this is. See https://community.bistudio.com/wiki/Magic_Variables for some ideas which magic variables exist in which circumstances. Also it would be better to not overwrite the init eventhandler but to add a subclass to eventhandlers, here a sample from the Nimitz:

 

                class EventHandlers {
                        class jdg_carrier {
                                init = "_this call TTT_nimitz_fnc_init";
                        };
                };

Your example might look like

      class eventhandlers
      {
        class chba_backpackInit 
        {
          init = "(_this select 0) call chba_ReconMod_fnc_backpackInit;";
        };
      };

Given chba is your new OFPEC tag ;)

  • Thanks 1

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  

×