Jump to content

Recommended Posts

Hi, while exploring some public missions to learn, I have come around custom classes defined with custom names and it's variables, it was inside a github I found online while looking for extdb3/sql info.

Though not related to data base and sql, this could come handy for something I have planned, I looked on the biki and on google but found no info on this, so what is the use of this? Can I declare my own classes to use with other scripts? Could these classes have it's own functions?

 

For example, could I do a class named base, with variables like position, markers, garrison and faction, and then declare various bases?

Or, one class named bases with inside the class of each base?

Share this post


Link to post
Share on other sites

i think you mean something like this (in description.ext):

class Bases
{
 class FOB1
 {
  side = west;

  position[] = { 7000, 3000 };

  // Etc
 };
};

 

then you can extract information from the classes with commands such as getArray, getText, getNumber

_base = missionConfigFile >> "Bases" >> "FOB1";

_pos = getArray (_base >> "position");

 

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Thanks a lot, I will have to study that to absorb all that knowledge, so, in a big mission or campaign the usefulness of this is to set up some non editable classes with non editable variables? And, being able to access it over the whole place? Sorry I didn't get the usability.

Share this post


Link to post
Share on other sites

classes are readonly and can be accessed anywhere from sqf script

  • Thanks 1

Share this post


Link to post
Share on other sites

Would this be a good way to use configs? it's a mission with different jobs and each job has several tasks.

_job is a string variable.

params ["_job"];
private ["_taskList","_task","_missionFnc","_taskInfo"];

_taskList = getArray (missionConfigFile >> "Jobs" >> _job >> "tasks");
_task = selectRandom _taskList;
_missionFnc = getText (missionConfigFile >> "Tasks" >> _task >> "function");

_taskInfo = call compile _missionFnc;
_taskInfo;

 

  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, Erwin23p said:

Would this be a good way to use configs? it's a mission with different jobs and each job has several tasks.

_job is a string variable.


params ["_job"];
private ["_taskList","_task","_missionFnc","_taskInfo"];

_taskList = getArray (missionConfigFile >> "Jobs" >> _job >> "tasks");
_task = selectRandom _taskList;
_missionFnc = getText (missionConfigFile >> "Tasks" >> _task >> "function");

_taskInfo = call compile _missionFnc;
_taskInfo;

 

 

Looks like to me you got the grasp of it. i try to use configs much as possible in my missions, in my side mission script I have defined all the missions as config classes. Like this: https://pastebin.com/xMba1QfX

so I can add new missions by adding a new class only

  • Thanks 1

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

×