Jump to content
Sign in to follow this  
JanMasterson

Role call scipt

Recommended Posts

hello all,

for my first post in this section section, i calling your advice to help me to write my very first script.

what i want to do is to display the number of units, classe by classe, that are actually on the map.

i started with the command "CountType" to obtain the number of unit from a given classe.

for exemple:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_numOfficerW ="OfficerW"CountType_list;

is it correct?

then i have to display the result, preferably in a table, sorted by side (Bluefor, Redfor, Civilians) and "family" (Infantry, Vehicles).

but how? by using the command "HintC"?

here is where i am actually, could you guide me further?

cheers,

Jan

Share this post


Link to post
Share on other sites

Hi..

are you seriouse about counting all the classes.?

why in gods name do you need that?

hintC is not what you want,, unless you want the game to pause..

hint or make a dialog ..i would prefer a dialog for this,,

hint may crash arma if its getting so big that it fills the screen..

anyway heres a example.. with a trigger,,

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Me = (_this select 0);

while {true} do {

TriggerOne = createTrigger ["EmptyDetector", position _Me];

TriggerOne setTriggerActivation ["EAST", "PRESENT", true];

TriggerOne setTriggerType "NONE";

TriggerOne setTriggerArea [50000, 50000, 0, false ];

sleep 1;

//put your classes here

_nr1 = "KA50" counttype list TriggerOne;

_nr2 = "SU34" counttype list TriggerOne;

hint format["number of KA50:%1\nnumber of su34%2",_nr1,_nr2];

};

put: nil=[this] execvm "script.sqf" on a unit..

this little example will only count KA50 and su34

and is only activated by EAST.. you can set ANYBODY or something like that, just look up setTriggerActivation on the wiki

get the idea?

Share this post


Link to post
Share on other sites

thanks much nuxil, i'm gonna try it ASAP.

by the way, i need it for MP missions.

on the kind of missions my team is playing, there are two sides and an arbiter.

The arbiter would give both sides an orbat (for exmple: 1 offcier, 10 Rifleman, 2 Medic, 2 Stryker, and so forth...).

Then each "Side's chief" organize all these soldiers in groups that fits his plan.

Then the arbiter would easily check if none have used more units than he allowed to and place both fprces on the final mission file.

Then the mission is played.

We are actually beta testing the concept by playing weekly two missions.

The team is nicknamed "OFCRA" wich stand for "Organisation Francophone de Combats Réalistes sur Armed assault".

Our website is at: http://www.armedassault-fr.com/

cheers,

Jan

Share this post


Link to post
Share on other sites

It's working great! Thanks much again! notworthy.gif

if i understand correctly:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

TriggerOne = createTrigger ["EmptyDetector", position _Me];

TriggerOne setTriggerActivation ["EAST", "PRESENT", true];

TriggerOne setTriggerType "NONE";

TriggerOne setTriggerArea [50000, 50000, 0, false ];

it means that if an east unit is present 50000m around "_Me", the script count the units of the given classes, right?

now how to make it count also empty units (vehicles for exemple)?

PS: is it any tutorial where i can learn to write script like you done? all i found is about commands

cheers,

Jan

Share this post


Link to post
Share on other sites

yes it creates a circle with radius 50000 meter.. should be the hole map.. not sure.. but i think its big enough..

if you place a empty unit on the map.. example "stryker ATGM"

then change this EAST to ANY

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

TriggerOne setTriggerActivation ["ANY", "PRESENT", true];

now you no longer need 2 trigger for west / east.. ANY is all..

you'll see that the stryker is also counted..

no i dont know any guides. maybe ther is a ofp guide you can read. since the basic commands are verry much the same. "that what i hear people say, but can not conferm it. since i didnt play ofp".. i only used the wiki to learn to script.. and im still a noob myself. tounge2.gif

if you want to learn this language hang around the forum and visit the wiki verry "verry" often.. there are few examples ther too.. also look at ohers scripts. simple scripts..

PS: what i have shown you will only count the classes.. not units. so i cant tell how it will work if ther is people in the vehicle. i dont know if they are counted,,

Share this post


Link to post
Share on other sites

Thanks to you, here's what i'm now able to do:

appelnp2.th.jpg

Since i have a lot of more classes to display, would it be easier to use a "dialog" (wht is it?) or to use triggers (for exemple radio) to manage what is displayed (Infantry, vehicles, east, west, etc...)

cheers,

Jan

Share this post


Link to post
Share on other sites

No dialog is not easy.. espesicaly if you are new to scripting,,

what i might have done is to. split up the info.

then store thouse values into a publicalvariable..

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Me = (_this select 0);

while {true} do {

TriggerOne = createTrigger ["EmptyDetector", position _Me];

TriggerOne setTriggerActivation ["EAST", "PRESENT", true];

TriggerOne setTriggerType "NONE";

TriggerOne setTriggerArea [50000, 50000, 0, false ];

sleep 1;

publicalvariable "nr1";

publicalvariable "nr2";

publicalvariable "nr3";

//put your classes here

nr1 = "KA50" counttype list TriggerOne;

nr2 = "SU34" counttype list TriggerOne;

};

now we do not hint from this script.. but use hint from a trigger "radio"

so you can create a trigger "radio alpha" if you only want to show infs with alpha..

so on act on the trigger do..

hint format["%1\n%2\n%3", nr1,nr2,nr3]

where nr1,nr2,nr3 is man classes..

offcource there is alot more classes than just this 3 tounge2.gif

hope you understan what i mean.. my english isnt the best and i have problems translating several words :\

Share this post


Link to post
Share on other sites

by far wink_o.gif

for exemple, here's what i have only for east infantry:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

//put your classes here

_nr1 = "SoldierEB" counttype list TriggerOne;

_nr2 = "SoldierEG" counttype list TriggerOne;

_nr3 = "SoldierEMedic" counttype list TriggerOne;

_nr4 = "SoldierENOG" counttype list TriggerOne;

_nr5 = "SoldierE" counttype list TriggerOne;

_nr6 = "SoldierEMG" counttype list TriggerOne;

_nr7 = "SoldierEAT" counttype list TriggerOne;

_nr8 = "SoldierEAA" counttype list TriggerOne;

_nr9 = "SoldierEMiner" counttype list TriggerOne;

_nr10 = "SquadLeaderE" counttype list TriggerOne;

_nr11 = "TeamLeaderE" counttype list TriggerOne;

_nr12 = "OfficerE" counttype list TriggerOne;

_nr13 = "SoldierESniper" counttype list TriggerOne;

_nr14 = "SoldierESaboteur" counttype list TriggerOne;

_nr15 = "SoldierESaboteurPipe" counttype list TriggerOne;

_nr16 = "SoldierESaboteurBizon" counttype list TriggerOne;

_nr17 = "SoldierESaboteurMarksman" counttype list TriggerOne;

_nr18 = "SoldierEPilot" counttype list TriggerOne;

_nr19 = "BISCamelPilot2" counttype list TriggerOne;

_nr20 = "SoldierECrew" counttype list TriggerOne;

hint format["SoldierEB:%1\nSoldierEG:%2\nSoldierEMedic:%3\nSoldierENOG:%4\nSoldierE:%5\nSoldierEMG:%6\nSoldierEAT:%7\nSoldierEAA:%8\nSoldierEMiner:%9\nSquadLeaderE:%10\nTeamLeaderE:%11\nOfficerE:%12\nSoldierESniper:%13\nSoldierESaboteur:%14\nSoldierESaboteurPipe:%15\nSoldierESaboteurBizon:%16\nSoldierESaboteurMarksman:%17\nSoldierEPilot:%18\nBISCamelPilot2:%19\nSoldierECrew:%20\n",_nr1,_nr2,_nr3,_nr4,_nr5,_nr6,_nr7,_nr8,_nr9,_nr10,_nr11,_nr12,_nr13,_nr14,_nr15,_nr16

,_nr17,_nr18,_nr19,_nr20];

};

so, if i understand correctly, to use triggers, i should keep all the codes like "_nr1 = " in the .sqs and put the line hint format[**all i want to display**]; in the trigger's activation field?

Share this post


Link to post
Share on other sites

yikes... SQS? this is SQF tounge2.gif lol

_nr1 must become nr1

as i showed you in my previouse example,,

and make them publical as i did..

then just put the hint command on the trigger alpha

PS: i wanna correct myslef before someone else do ;p

I meant publcvariable and not publcalvariable

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  

×