Jump to content
Sign in to follow this  
Hinny

Script i need help with

Recommended Posts

Ok, this is for MP games.

For my squad there are various people of different ranks, and I would like to make these ranks displayable in game. I have a way of doing this in script form, but the tricky bit is assigning them to players.

As we don't necessarily know who will be playing the game that evening it's impossible to edit the mission so the appropriate script for each person is initiated in the unit's init line.

Instead I want to create a 'rank box', like an ammo box except people go up to it, pick the appropriate rank and have the appropriate script run to display it.

However I have no clue as how to code this. Anyone care to help?

Share this post


Link to post
Share on other sites

In init.sqs put something like

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

_Sarge = "gutterfunk"

_Private = "zig566"

?(Name player == _Captain) : hint format ["You are Captain %1",name player]

?(Name player == _Sarge) : hint format ["You are Seargent %1",name player]

?(Name player == _Private) : hint format ["You are Private %1",name player]

Something along those lines, I think your trying to do that.

Share this post


Link to post
Share on other sites

That would actually be quite good, not quite what I was looking for, but good nonetheless biggrin_o.gif

However it suffers one problem. I want it to work globally rather than just locally. With that method the assigned textures only appear to the person they were activated on, whereas I want everyone to see them.

Share this post


Link to post
Share on other sites

Here's the code I'm using.

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

_Joe = "[CPL] Joe"

_Tim = "[LCP] Tim"

_Tom = "[LCP] Tom"

#CPL

?(Name player == _Bob) : player setObjectTexture [2,"\rank_cpl.paa"]

?(Name player == _Joe) : player setObjectTexture [2,"\rank_cpl.paa"]

#LCP

?(Name player == _Tim) : player setObjectTexture [2,"\rank_lcpl.paa"]

?(Name player == _tom) : player setObjectTexture [2,"\rank_lcpl.paa"]

Share this post


Link to post
Share on other sites

I thought init.sqs IS completley public?

Er, nevermind, I see..

Share this post


Link to post
Share on other sites

It is public, but the script only initiates the texture for the player, rather than everyone else too.

Share this post


Link to post
Share on other sites

Woo, took me some time but I've done it smile_o.gif

Thanks for your help.

Share this post


Link to post
Share on other sites

I did the same as I orignally posted but also added the lines:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(name player == Bob) : a = player; publicvariable "a"

?(name player == Joe) : b = player; publicvariable "b"

?(name player == Tim) : c = player; publicvariable "c"

?(name player == Tom) : d = player; publicvariable "d"

Then called another script with the lines:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">a setObjectTexture [2,"\rank_cpl.paa"]

b setObjectTexture [2,"\rank_cpl.paa"]

c setObjectTexture [2,"\rank_lcpl.paa"]

d setObjectTexture [2,"\rank_lcpl.paa"]

Share this post


Link to post
Share on other sites

Hi,

there is another possibility:

All units have a "rating" which you get through the rating-command. The higher the rank the higher the initial rating. Just look for the initial rating (I can't provide you the rating for every rank, you can find them out yourself smile_o.gif )

Share this post


Link to post
Share on other sites

Ah, but for that you'd have had to set the original unit ranks which would kinda go against the point of this script. Which is to allow players to have the right rank slide despite what slot they decide to put themselves in MP games.

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  

×