kuplion

[Request] Help with an addAction script (Chemlights)

7 posts in this topic

Hey folks,

I'm currently using the 'Attach Chemlight' addon, but it works via a button press (F5) to attach the chemlight. Would anyone be able to help me/point me in the right direction for creating an Action when a player is holding a chemlight and add the option to attach it to the scroll menu rather than pressing F5.

Share this post


Link to post
Share on other sites
1 hour ago, kuplion said:

Hey folks,

I'm currently using the 'Attach Chemlight' addon, but it works via a button press (F5) to attach the chemlight. Would anyone be able to help me/point me in the right direction for creating an Action when a player is holding a chemlight and add the option to attach it to the scroll menu rather than pressing F5.

Try this:

null = player addAction ["<t color='#00a6eb'>Take Chemlight</t>", Path to script, Parameters to script, -10, true(to popup action when close), true(to hide action on use), "", "if (player distance chemLight < 1) then {true;} else {false;}"];

EDIT: You will need to make the chemLight name whatever the classname is for the chem light you are using.

Edited by Teh Dango
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Ah man! Dango you legend! Thank you.

Sorry to sound like a n00b though, but where am I putting this? Am I replacing part of the original addon with this?

Share this post


Link to post
Share on other sites
10 minutes ago, kuplion said:

Ah man! Dango you legend! Thank you.

Sorry to sound like a n00b though, but where am I putting this? Am I replacing part of the original addon with this?

Well first i edited a bunch cause I got lost lol. Aside from that you would want to put that in any part of the script that runs on the player, preferably something from the init.sqf file. I use an execution like this:

_nul = execVM "folder\file.sqf";

and the file looks like this:

waitUntil {sleep 0.5;!isNull (findDisplay 46);};

null = player addAction ["<t color='#00a6eb'>Take Chemlight</t>", Path to script, Parameters to script, -10, true(to popup action when close), true(to hide action on use), "", "if (player distance chemLight < 1) then {true} else {false}"];

Now dont hold me to this as I have not tested it lol but this is the idea to get it working. I use this for my dog companion script, yup, dogs ;) and it works only when they are around otherwise the action is gone. This is just one of many ways and honestly its a bit noob level but it works lol.

Edited by Teh Dango
  • Like 1

Share this post


Link to post
Share on other sites

Thank you, dude. That's how I call most of my custom stuff so I figured as much but just wanted to check. I'll give it a whirl and see how it works. Thank you again.

Share this post


Link to post
Share on other sites

I'm trying everything to get addActions to work but I can't get one to come up at all, I've disabled almost all of Infistar trying because I thought it might have been something in there. My code posted below, no idea why it doesn't work.

 

if (ExileClientPlayerIsBambi = true) then {
	_weaponoption = player addAction ["<t color='#FF0000'>Take out the gun stashed in your undies!</t>", "custom\PIU\doPIU.sqf"];
	sleep 5;
	};

Even tried this just to test and nothing:

if (true) then {
player addAction ["Tits", ""];
};

 

Edited by Havoc302

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.