Jump to content
Sign in to follow this  
dontknowhow

I made an addon with a script for onTeamSwitch. How do I put it in all missions?

Recommended Posts

I wanted something that allowed me to be leader when I switch. This has been fairly easy:

onTeamSwitch ( {_group = group _from; _group selectLeader _to;} )

I put this in my switchLeader.sqf file, and I put this file in a pbo, which should be a separate addon, so that I can use it from every mission I play. I think a better name for this would be replacement.

However, I can use the script from a whatever mission only if I call it explicityly, otherwise nothing happens. I tried the following in the config cpp of my addon:

teamSwitchScript = "switchLeader.sqf";

But it doesn't work. I think I could use some help.

TIA

By the way, is it normal that people ask for every single issue? I did solve a few problems by myself, but I'm finding that often the solution is quite hard to find, and I'm afraid I will ask a lot of questions, if I don't give up. Unfortunately the documentation is very poor. It's kind of frustrating, and quite demanding

Share this post


Link to post
Share on other sites

try to use Extended_EventHandlers

if you make you own addon

create first yours config.cpp

put in something like this

class CfgPatches
{
class you_TAG_team_switch_addon
{
	units[]={};
	requiredVersion = 0.1;
	requiredAddons[] = {"Extended_EventHandlers"};
};
};

class Extended_Init_EventHandlers
{
class Man
{
	you_TAG_Init ="(_this select 0) execVM ""\you_TAG_addon_name\switchLeader.sqf"";";
};
};

required a little bit more scripting then now

ok???

just forgot CBA

Share this post


Link to post
Share on other sites

that does work, thank you.

Now, can you explain me what I just did? Even better, can you point me to some documentation that explains it? That would be great.

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  

×