Jump to content
Sign in to follow this  
Baconeo

Display hints to players within area

Recommended Posts

Hi guys, making a rifle range script for my unit and struggling with displaying the score to only certain players. Originally in ArmA 2 we had it display the score in side chat but I can't do that and have resorted to hints but because of multiple ranges I need the hints to display to units within a certain area of the ranges, is this possible? Thanks!

Share this post


Link to post
Share on other sites

Place a trigger over the particular range slot and as one of the conditions put:

player in thisList;

And then have your call to your script for score keeping, this basically makes the hinting local to the trigger area to only the players that are within it.

Share this post


Link to post
Share on other sites

Are you saying you can't do sidechat because you don't know how? place a unit in the editor far, far away and give him a name

Then use UNITNAME sideChat "YOURTEXTHERE";

Alternatively, you can use systemChat "YOURTEXTHERE" without needing a unit (message shows up in gray)

EDIT: Double alternatively, in case you didn't know about the format command (click this)

text1 = "Dreaded";
text2 = "Entity";
myText = format["My name is %1%2", text1, text2];

The variable "myText" will be equal to "My name is DreadedEntity" after this code is run.

Edited by DreadedEntity

Share this post


Link to post
Share on other sites

public variable and then a distance check within the pv.

My_Variable = {
if (isServer) exitWith {};
[_arg1,_arg2,_etc] spawn {
if ((player distance _pos) < _radius) then {
hint "Im within the radius, yay!";
};
};
}; publicVariable "My_Variable";

My_Variable = nil; publicVariable "My_Variable";     // Destroy it after use

Share this post


Link to post
Share on other sites
Are you saying you can't do sidechat because you don't know how? place a unit in the editor far, far away and give him a name

Then use UNITNAME sideChat "YOURTEXTHERE";

Alternatively, you can use systemChat "YOURTEXTHERE" without needing a unit (message shows up in gray)

EDIT: Double alternatively, in case you didn't know about the format command (click this)

text1 = "Dreaded";
text2 = "Entity";
myText = format["My name is %1%2", text1, text2];

The variable "myText" will be equal to "My name is DreadedEntity" after this code is run.

How can I display the formatText in globalChat? As currently it will not display. So in your example myText. I was trying this "range globalChat tScore; " but this did not work.

Share this post


Link to post
Share on other sites

According to the wiki page the globalChat command is "sent" by a particular unit, meaning that whatever is before the globalChat command has to be a unit, i.e.:

_unit globalChat tScore;

Share this post


Link to post
Share on other sites
According to the wiki page the globalChat command is "sent" by a particular unit, meaning that whatever is before the globalChat command has to be a unit, i.e.:

_unit globalChat tScore;

Sorry I should have explained, range is a unit. Do I have to include the _ even if the units name is simply "range"?

Share this post


Link to post
Share on other sites

No, you don't have to include the "_", I was just making sure you didn't have "range" as an object, but I think what you need is something like this:

range globalChat formatText ["%1",tScore];

//OR, as I don't know the difference between the two myself

range globalChat format ["%1",tScore];

Share this post


Link to post
Share on other sites
No, you don't have to include the "_", I was just making sure you didn't have "range" as an object, but I think what you need is something like this:

range globalChat formatText ["%1",tScore];

//OR, as I don't know the difference between the two myself

range globalChat format ["%1",tScore];

Unfortunately that did not work, is there something I could be missing? I am running AGM and TFR but I would not have thought that they would interfere. This is how the score segment of my code is looking at the moment.

				tScore = format ["Rifle Range 2 - Targets: %1 Hit: %2", _inc, _score];
			range globalChat format ["%1",tScore];  

Share this post


Link to post
Share on other sites
tScore = format ["Rifle Range 2 - Targets: %1 Hit: %2", _inc, _score];
range globalChat format ["%1",tScore];

First you're going to need an actual unit called range. Then you can shorten that to just one line like this:

range globalChat format ["|Rifle Range 2|\nTargets: %1\nHit: %2", _inc, _score];

\n makes a new line, so it should make things look a little nicer

Share this post


Link to post
Share on other sites

AGM disables "radio" for AI units which means they won't be able to use sideChat etc.

You can do this in init.sqf to fix it

true spawn {
 sleep 3;
 enableRadio true;
};

Share this post


Link to post
Share on other sites
First you're going to need an actual unit called range. Then you can shorten that to just one line like this:

range globalChat format ["|Rifle Range 2|\nTargets: %1\nHit: %2", _inc, _score];

\n makes a new line, so it should make things look a little nicer

I put that into my script, had an AI unit named range as well as trying it naming myself range and yet it does not show up. I made sure I was running the map as a server as otherwise the chat wouldn't work. I am not entirely sure where to go from here.

AGM disables "radio" for AI units which means they won't be able to use sideChat etc.

You can do this in init.sqf to fix it

true spawn {
 sleep 3;
 enableRadio true;
};

Cheers, added that in but unfortunately it does not work as in my script doing what I wanted.

Share this post


Link to post
Share on other sites

I ran without TFR and it did still not work unfortunately. Very confused as to why it will not work.

Share this post


Link to post
Share on other sites

Guys while your on the subject, I was wondering if someone can tell me how to change the color of the text displayed in a Trigger effect, I have the trigger working just want the text to be in red not white ??, Im using the effects tab as i think its better as opposed to putting a hint in on activation ??

For example will this work "<t color='#FFFFFF' >";WARNING!! This is Restricted Airspace, You have 1:30 seconds to Leave or your aircraft will be disabled"

Share this post


Link to post
Share on other sites

If you use these forums and then give the text the effects you want, the you should be able to just copy that over to the game.

You are on the right track with what you have there, I think your just missing a bit of syntax stuff, which you can compare to what this forums text editor brings up for your use :p.

I could be wrong in part, but I'm used too 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  

×