Jump to content
Sign in to follow this  
jaynic

Newbie question - folder structure of my addon

Recommended Posts

Hi all,

I am tring to create a basic addon that decreases the amount of fatigue by a variable. I have made it in individual missions, but I'd like to make it an addon so I can have it accessible all the time with my group...

 

I have looked for a guide on how to get this started, but haven't come up with anything. Everything I see is about creating some magical 'p' drive and all this... It seems like it's overly complex for what I'm attempting - I should just be able to script this, correct?

 

Anyways, I have the following script:

 



if !(hasInterface) exitWith{};
waitUntil {!isNull(findDisplay 46)};
waitUntil {!isNull player};

//set global variables
missionNamespace setVariable ["OHTC_FatigueMultiplier", 0.3];

_l = 0; //The last fatigue we had
while {true} do {
if(!(isNil "OHTC_FatigueMultiplier") && typeName OHTC_FatigueMultiplier == "SCALAR" && OHTC_FatigueMultiplier >0 0 OHTC_FatigueMultiplier <= 1) then {
//The current fatigue of the player
_c = getfatigue player;

//The default increase: ie: difference between what we have now, and what we had last time we ran
_di = _c - _l;

//The NEW increase in fatigue would be the percentage we request of the default increase
_ni = _di - (_di * OHTC_FatigueMultiplier);

//Assuming we've gone up: let's set the fatigue to the new value;
if(_ni > 0) then {
player setFatigue _c - _ni;
};

systemChat format ["Last: %1, Current: %2, Default Inc: %3, Multiplier: %4, New Inc: %5, Final Fatigue: %6", _l, _c, _di, OHTC_FatigueMultiplier, _ni, getfatigue player];

//Now we set our last historical value to our modified value
_l = getfatigue player;

};
sleep 1;
}

And I want it as a mod. I've taken apart a couple mods with Elitness, but I'm not understanding how to piece one together myself.

 

I have folder in my arma directory called "@OHTCfatigueMultiplier".

Inside this folder I have another folder called "addons"

Inside the addons folder I have a script - init.sqf - that contains the above script.

 

What else am I missing, please?

 

Thank you

Share this post


Link to post
Share on other sites

You need a config.cpp (don't ask me how to write this to execute your script, I've no idea) as well as the script itself all packed in a .PBO

Simply having the script in a mod folder wont do anything.

 

EDIT: Although, you could just pbo the script and then execute it in every mission by just pathing to the pbo/script and do it that way.

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  

×