Jump to content
Sign in to follow this  
ss2180

My addon isnt working

Recommended Posts

My addon isn't working the action isn't appearing on the scroll wheel. In my .pbo file i have a config.cpp,init.sqf,melee.sqf the code for each of the files are below.

config.cpp:

#include "init.sqf"

class CfgPatches {

class Melee {

units[] = {};

weapons[] = {};

requiredVersion = 1.0;

requiredAddons[] = {};

};

};

init.sqf:

_meleeAct = player addAction["Melee","melee.sqf"]

melee.sqf:

if(player distance cursorTarget < 3) then {[cursorTarget,600] call ace_blackoutall;}

else {hint "You are too far away!"}

If someone could help me i would appreciate it plus i am using the ace mod and ace wound system module.:)

Edited by ss2180

Share this post


Link to post
Share on other sites

#include "init.sqf" i dont think that needs to be in the PBO file bud, thats like part of the mission stuff, and seperate to the PBO of the add-on.

you do not need to make an addon, just to do a small melee script.

just use the editor, and put in the init field of the player the "addAction" command. Like,

XX addaction ["<t color='#FF0000'>**TEST ABILITY**</t>","SCRIPT NAME HERE.sqf",[],1,true,true,"",""];

where XX is the UNIT NAME or "PLAYER" or "THIS".

TEST ABILITY is the txt that will show.

SCRIPT NAME is the name of the script in the mission folder, (C:\Users\XXXXX\Documents\ArmA 2 Other Profiles\XXXXXX\missions\MISSIONNAME.ISLANDNAME

you can add arguments like,

XX addaction ["<t color='#FF0000'>**TEST ABILITY**</t>","SCRIPT NAME HERE.sqf",[],1,true,true,"","ADD ARGUMENT"];

an example of an argument is,

"cooldown < 1"

in the init of the player, just before addAction, if you put "COOLDOWN = 0", and at the start of your script you put "COOLDOWN = 1", then at the end of your script put a sleep of how long you want to wait, before the ability comes back again. "SLEEP 20;"

then after that, put the cooldown back to 0. "Cooldown = 0";

----------------------------------------------------------------

so as an overview, the cooldown is set to to 0 and is therefor available (<less than 1), you use the ability, that activates the script. the first thing it does is change the cooldown to 1, so the ability cant be used over-and-over, then the MELEE is done, and after that, it waits SLEEP 20; (20 seconds), and sets cooldown to 0 and makes it available again.

Hope that helps.

SPAWN

---------- Post added at 12:58 ---------- Previous post was at 12:54 ----------

an example of a melee script is.

----------------------------------------

Cooldown = 1;

_target = cursorTarget;

if (player distance _target <=8) then {_target setDamage 1};

sleep 20;

Cooldown = 0;

the 8 is the distance to the target, for players set to 2 or 3 meters, for killing tanks with a punch (lol) you will need a higher value because the middle of the tank is further. try somthing like 8 :P

Share this post


Link to post
Share on other sites

Thanks but is there a way for me to get it working as a addon because it is for my clan/unit and the person who makes the missions dosent know how to script. I did get it working in the editor but when i packed to a pbo it stopped working.

Share this post


Link to post
Share on other sites

that's not possible. if you have it working in the editor, simply export/save to multiplayer missions, and then send him/her that file from "...\Steam\SteamApps\common\Arma 2 Operation Arrowhead\MPMissions\" and the "mission.pbo" file is in there. there is no reason it will not work unless the other person does not have the addons that you used to make the mission like extra downloaded guns or cars etc).

then just tell him/her to put the mission in the same folder.

Also. If you just host the game online and he/she joins. he will automatically download and then have the mission.

OR you could zip up your mission folder from "...Documents\arma2orOtherprofile\PROFILENAME\Missions\" . add the mission folder to a zip. Send. then tell him where to extract it.

Edited by UK_SPAWN

Share this post


Link to post
Share on other sites

Thanks a lot i have being trying to get this to work for days without knowing it wasn't possible. I will get my unit leader to download my script :D

Share this post


Link to post
Share on other sites

If you send the PBO mission to him, he will not have to even see a script or know anything. Just place the file in the correct folder and away you go.

and, your welcome.

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  

×