Jump to content
Sign in to follow this  
andylee054

How to get unit's id from mission.sqm

Recommended Posts

In mission.sqm file, we may find the script like that:

class Item1

{

position[]={9922.818359,26.730000,4003.331787};

id=2;

side="WEST";

vehicle="SoldierWB";

rank="SERGEANT";

skill=0.600000;

markers[]={};

};

I tried to find out the way to get the ID or rank from mission.sqm, because I need the data for some sqs file.

But I still don't get it.

Anyone know how to do that?

Share this post


Link to post
Share on other sites
class Item1

{

 position[]={9922.818359,26.730000,4003.331787};

 id=2;

 side="WEST";

 vehicle="SoldierWB";

 rank="SERGEANT";

 skill=0.600000;

 markers[]={};

};

Isn't that what you're looking for?

Share this post


Link to post
Share on other sites

yes, that's all want, but I want to use some script to dig them out.

such like:

_unit = _this select 0

_unitID = ID or rank....etc.

than I can use the ID or rank to do the other thing in sqs.

Share this post


Link to post
Share on other sites

ah, sorry, didn't read the last sentence in your first post too well. I don't know really... Don't find anythingin comref.

Share this post


Link to post
Share on other sites

Hi,

Quote[/b] ]

I tried to find out the way to get the ID or rank from mission.sqm, because I need the data for some sqs file.

But I still don't get it.

Is there any particular reason for getting the info from mission.sqm file?

If you create your groups at runtime, you can store all the info you need in an array.

Share this post


Link to post
Share on other sites

Alright, I tell you why.

I made a lot of customed oriental faces, and I set those faces as TW00~TW30.

I also made an class eventhandlers In my addon's config.cpp to call a sqs file which used to setface for my units.

the script for eventhandlers would be:

class Eventhandlers

{Init =  "[_this select 0] exec ""\roc\script\twface.sqs""";};

In the earlier time, my twface.sqs was made for setting the faces randomly, the script like that:

_P1 = _this select 0

_Tr = random 3.1

?(_Tr <= 0.1): _P1 setface "TW00"

?(_Tr>0.1 and _Tr <= 0.2): _P1 setface "TW01"

......and so on....to "TW30"

So, the script will make solders has a random customed face.

And user no need to add any script in init or sqs to see the oriental random faced soldiers.

But, I found a problem lately, when soldiers get in car and out, the init would be triggered again, so, He got a new face!!

That's why I think if I can get the id from mission.sqm, so, I can fix the randomed face on soldier by determing the ID.

Maybe it's not the best way, or anyone know the better way?

I also tried removeEventhandler command to stop the init, it's not work on class eventhandlers which in config.cpp.

I wish the script would be like that:

_P1 = _this select 0

_Pid = _P1.ID

_Pr = _Pid / 31

?(_Pr > 31): _Pid = _Pid - (_Pr * 31)

?(_Pid = 1): _P1 setface "TW00"

?(_Pid = 2): _P1 setface "TW01"

..... and so on.....to "TW30"

Share this post


Link to post
Share on other sites

Hi,

I dont know anything when it comes to scripts within addons (But I will need to, after I have worked out the umpteen other things I need. Before getting to that point).

So I hope you dont mind if I ask you some questions along the way?

If you added _P1 to either a global or local Array in your initial init event:

_PidArray Set [(count _PidArray)+1,_P1]

or defined as a global var:

PidArray Set [(count PidArray)+1,_P1]

Would _PidArray still contain the same info, when the init event is called a second time, by the (unwanted) exit vehicle event?

Cheers

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  

×