Jump to content
Sign in to follow this  
DLC_Crabz

Unit's Insignia based on ICQ pulled from XML.

Recommended Posts

Hello,

 

On the unit i'm currently playing we're planning to introduce a ranking system. 

We want the rankings to be visual on the soldier in the game. Now the ranks will be manually put in the XML as their IQC.

 

An easy way would be to create multiple XML's all with difrent icons acording to their ranks.

 

Now we're also very proud to present our own logo on the vehicle and on the shoulder.

 

Now the question as the title says, Is it possible to have an init or some kind of script that checks the ICQ of the squad XML?

 

Thanks in advance,

 

Crabz

Share this post


Link to post
Share on other sites

 

Awesome! Thanks for the quick response. I'm currently trying to understand scripting.

Would it be concidered bad if i asked for help on this here or should i do more research on my own?

 

If so, I'd love someone who could run me trough quick steps and help me put this toughetter.

Share this post


Link to post
Share on other sites

Ask as much as you like. It's a forum after all.

If what you mean by making the "rankings to be visible on the soldier" you might find insignia useful. If you want to place nametags over people's heads drawIcon3D is something to look into.

If this is your first time playing with scripts, read through some of the guides on the wiki. Introduction to Scripting and Control Structures are pretty useful.

Share this post


Link to post
Share on other sites

I've picked up some work on this project again.

 

This that are done:

-the ranks are created in photoshop

-I've finalized the logo's for Teamspeak 16x16

-Created .paa textures for insignia's

-Made a mod including all ranks as insignia's with classnames

-Made an excel sheet with a forumla that calculates a players rank based on their trainings. SquadXML

-A script has been made to export the information from the excel sheet to a SquadXML

 

The only thing that i still need to do is :

-Make a script for arma that checks the squadParams ICQ and then assign the acording insignia

 

I'm not very smart and not a good learner and i would love it if someone could personally help me. I've read trough the Introduction to Scripting but this seems a little too advanced for me.

 

Can someone help me out?

 

Kind regards,

 

Crabz

Share this post


Link to post
Share on other sites

Few hours later and a little messing around.

 

I've made the classnames of the insignia's exactly like the names of the ranks in the SquadXML.

Then with a Trigger in a MP mission i finaly managed to get the Insignia to show wich was assigned to me in the SquadXML

 

SquadICQ = squadParams player select 1 select 4; [player, SquadICQ] call BIS_fnc_setUnitInsignia; hint str SquadICQ;

 

Is there an easy way to make this in to a script or mod that does this like every 2 minutes or like on respawns ?

 

Kind regards,

 

Crabz

Share this post


Link to post
Share on other sites

Currently i have it setup like this. but it appears to lag the server tremendously.

 

Init.sqf

if (hasInterface) then { 
 
[] spawn {
 
    while {true} do {

 
_squadICQ = squadParams player select 1 select 4; 
[player, _squadICQ] call BIS_fnc_setUnitInsignia;

 
        sleep 15;
 
    };
 
};

Share this post


Link to post
Share on other sites

I'm sure someone with far far more scripting experience will be along soon but to me that is lagging out the server because you're running a loop every 15 seconds that sets players insignia dependent upon the params from squadparams.

 

Surely you can just get away with running this once when initplayerlocal.sqf or onplayerrespawn.sqf runs?  This way it only runs once per player and sets their insignia once.  There is a downside to this however in that whenever a player removes or replaces their uniform the insignia will disappear until they respawn or re-JIP again.

Share this post


Link to post
Share on other sites

 

Currently i have it setup like this. but it appears to lag the server tremendously.

 

Init.sqf

if (hasInterface) then { 
 
[] spawn {
 
    while {true} do {

 
_squadICQ = squadParams player select 1 select 4; 
[player, _squadICQ] call BIS_fnc_setUnitInsignia;

 
        sleep 15;
 
    };
 
};

Might want to ditch the init.sqf it's old antiquated and has been replaced with:

initServer.sqf

initPlayerServer.sqf

initPlayerLocal.sqf

 

BIS-fnc_setunitInsignia lags because it uses setObjectTextureGlobal. I have encountered on some not so clever altis life servers, that doing this

ultimately generates unnecessary traffic, and can result in bandwidth issues probably related to the lag you get. Cycling this every 15 seconds on all clients, imagine the traffic generated?

Me personally I would check

1. if they're alive or dead

2. maybe use an MPkilled mission eventhandler so when they die, it uses the function only when they die.

making the code not called "all" the time.

3. I would personally take that little snippet of code pack it into a cfgFunctions.hpp definition, which increases it's execution speed by

mission precompilation.

4. ignore when the player is dead. the call from the unscheduled from the EVH will go straight to the function / procedure, and perform the action only when a player is dead. so https://community.bistudio.com/wiki/addMPEventHandler

// setAllinsignia.sqf sets players insignia on MP respawn
_index = player addMPEventHandler ["mpkilled",{

if (hasInterface) then { 
 
[] spawn {
	if (alive (_this select 0)) then {
_squadICQ = squadParams player select 1 select 4; 
[player, _squadICQ] call BIS_fnc_setUnitInsignia;

 
        sleep 15;
 
		};
 
	};
};

  • Like 1

Share this post


Link to post
Share on other sites

It really shouldn't need more than this:

 

onplayerrespawn.sqf

_squadICQ = squadParams player select 1 select 4; 
[_this select 0, _squadICQ] call BIS_fnc_setUnitInsignia;

The function is global anyway, so why bother using an MP handler ?

Share this post


Link to post
Share on other sites

Oh so it is, didn't notice yeah the above in the initPlayerLocal.sqf and you should be good to go. It will account for JIP

and when the mission first starts

Share this post


Link to post
Share on other sites

Eventually managed to make my own Function incorperated in the mod.

If people are intrested i'll be glad to share.

Share this post


Link to post
Share on other sites

just share what u r able to. Im looking at my glass sphere and I see:

"There is a guy in the future who is looking for it..."

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  

×