<- Lenghty post warning ->Do I have put all of that stuff in the "class userActions" of every soldier I want to control that way?
If you don't want it to get too confusing, then yes..
Otherwise, there are other ways..
You know how in the config the soldiers inherit from a parent class, like
class mysoldierclass: SoldierWB
where the
SoldierWB is the parent class (which itself inherits fom yet another parent class) for the
mysoldierclassNow, all the parameters (values/whatever) the parent class includes will be inherited by the child class, in this case the
mysoldierclass, and you can then edit those parameters without affecting the parent class..
A simple example:
class SoldierWB:Soldier
{
model="MC vojakW2";
hiddenSelections[]={"medic"};
moves="CfgMovesMC";
vehicleClass="Men";
scope=2;
side=1;
accuracy=0.7;
displayName="$STR_DN_SOLDIER";
weapons[]={"M16","Throw","Put"};
magazines[]={"M16","M16","M16","M16","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade"};
cost=40000;
};
class mysoldierclass: SoldierWB
{
vehicleClass="Mod Men";
displayName="some guy";
};
The
mysoldierclass now has all the same parameters as the parent class except for the two bolded parameters..
So, when you add that userAction class into the parent class from where your soldiers inherit from it will be available on all your soldiers and you don't need to copy/paste the same useraction class into all your soldier classes..
Or, you can use the
#define..
There are basic #defines in the start of the config, and you can add your own if you will..
Example:
#define my_useractions_def class UserActions \
{ \
class someuseraction \
{ \
displayName="Blah Blah"; \
position="pos driver"; \
radius=0.1; \
condition="(vehicle this == this) && somevariable"; \
statement="do some stuff"; \
}; \
class someuseraction_2 \
{ \
displayName="Yada Yada"; \
position="pos driver"; \
radius=0.1; \
condition="(vehicle this == this) && !(somevariable)"; \
statement="this exec ""somescript.sqs"""; \
}; \
class someuseraction_3 \
{ \
displayName="Babble Babble"; \
position="pos driver"; \
radius=0.1; \
condition="(vehicle this == this) && this hasWeapon "someweapon""; \
statement="this exec ""someotherscript.sqs"""; \
}; \
}; \
Now, this is less messy to copy/paste into each soldier class if you wish to do so, but the parent class thingy explained above works with this as well..
But now as you have the define
my_userActions_def you only need to add that line in the parent class or in each soldier class
class SoldierWB:Soldier
{
model="MC vojakW2";
hiddenSelections[]={"medic"};
moves="CfgMovesMC";
vehicleClass="Men";
scope=2;
side=1;
accuracy=0.7;
displayName="$STR_DN_SOLDIER";
weapons[]={"M16","Throw","Put"};
magazines[]={"M16","M16","M16","M16","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade"};
cost=40000;
};
class mysoldierclass: SoldierWB
{
vehicleClass="Mod Men";
displayName="some guy";
my_userActions_def
};
class mysoldierclass_2: mysoldierclass
{
vehicleClass="Mod Men";
displayName="some guy 2";
};
Now both soldiers,
some guy and
some guy 2 will have the same actions without needing the copy/paste..
If you want to use the copy/paste into each soldier class, it would be like this
class SoldierWB:Soldier
{
model="MC vojakW2";
hiddenSelections[]={"medic"};
moves="CfgMovesMC";
vehicleClass="Men";
scope=2;
side=1;
accuracy=0.7;
displayName="$STR_DN_SOLDIER";
weapons[]={"M16","Throw","Put"};
magazines[]={"M16","M16","M16","M16","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade"};
cost=40000;
};
class mysoldierclass: SoldierWB
{
vehicleClass="Mod Men";
displayName="some guy";
my_userActions_def
};
class mysoldierclass_2: mysoldierclass
{
vehicleClass="Mod Men";
displayName="some guy 2";
my_userActions_def
};
Why do I need a position?
As I said, it's named selection on the soldier model..
For example
hlava is the soldier's head, and it's that position the action is "attached" to if you choose to use the
hlava selection (if named sleections are a mystery,
take a look at some basic modelling tutorials )..
If you don't have a position for the userAction it will not appear in the action menu..
This is just how OFP works..
Or radius?
This goes hand in hand with the
position..
It's a radius (in meters I think) from the
position where the action is available, so using radius=0.1 should keep the action only for the soldier itself and not "leak" it to soldiers coming close..
Or can you suggest some kind of FAQ or testfile for a config dummy like me?
I'm not sure whether there are any FAQs or tutorials for this, but like I said in my earlier post, look for released AddOns that have those extra actions for the soldiers and take a look at those configs..
Although, I could write you a 'real' example myself...
how it works with your group
Not exactly sure what you mean..
If you for example want certain action to be available for the leader of the group only you can use something like this in the
condition of the userAction (not exactly sure that would work as is, just an example)
condition="((count units) group this)>1 && leader group this == this";
this refers to the unit on who the action is attached to..
where to put the scripts that you are calling.
When you are making a mod it depends..
If you are making a total conversion mod you can use the scripts.pbo in the OFP/Dta/ folder, or you can use some addon pbo if you wish..
For example if you have the soldiers as an addon in
mymod_soldiers.pbo you can put the scripts in there, for example in a folder called
scripts..
Now, to exec a script from there you will use filepath for it, in this case
\mymod_soldiers\scripts\the_script.sqs
So, a 'full' userAction class might look something like this
class userActions
{
class action1
{
displayName="Use the Actrion";
position="hlava";
radius=0.1;
condition="vehicle this == this && ((count units) group this)>1 && leader group this == this";
statement="[this] exec ""\mymod_soldiers\scripts\the_script.sqs""";
};
};
Ok, this messy and insanely long post just probably confuses you more
But I hope this helps even a little bit..