ArmA 3 Cvar Help
- J-English
- This is my homepage
- Posts: 618
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Thu Apr 15, 2010 4:06 am
- Location: United Kingdom
ArmA 3 Cvar Help
Im running A3 wasteland stratis.
I need help with 2 issues.
I want to disable fatigue so players dont get tired.Were do i put this ?
player enableFatigue false; ?
Also i want to print server messages ingame ,not MOTD
Cheers
I need help with 2 issues.
I want to disable fatigue so players dont get tired.Were do i put this ?
player enableFatigue false; ?
Also i want to print server messages ingame ,not MOTD
Cheers
-
- This is my homepage
- Posts: 439
- Joined: Sat Sep 04, 2010 10:20 am
- Location: Cologne, Gemany
- Contact:
Re: ArmA 3 Cvar Help
ArmA series don't use a CVAR system.
For what you want to do, disabling the fatigue system, you have to code this into the mission (Wasteland in this case). There are several ways to do this, a good way would be to use a connection event handler, or an easy way to do, would be the following:
In your init.sqf add the following code:
This will execute the code on any client that will connect to the server, which will disable the fatigue in the process. The event handler way is a bit more complicated and would look something like this:
Can also be executed in the init.sqf, though it has to be on the server, the code for "someFunction" would be your player enableFatigue false; line. Did not test it, so try it with the first code line first and contact me, if you want to do this with the EH version for a verification.
For what you want to do, disabling the fatigue system, you have to code this into the mission (Wasteland in this case). There are several ways to do this, a good way would be to use a connection event handler, or an easy way to do, would be the following:
In your init.sqf add the following code:
Code: Select all
if (!(isServer)) then
{
player enableFatigue false;
};
Code: Select all
_OnPlayerDisconnectedStackedEventHandler = ["someId", "onPlayerConnected", "someFunction"] call BIS_fnc_addStackedEventHandler;
Re: ArmA 3 Cvar Help
Code: Select all
if (!(isServer)) then
{
player enableFatigue false;
};
I know im being a bit pushy here,
Need to print out ingame server messages automatically,will i need anrcon tool for that?
I also cant find were to configure the server to auto restart itself at certain times? Perhaps through the VDS NFO control panel maybe.
And last thing ,to keep the weather to daylight permanenlty ,do i need to change a setting in the dynamicweathereffects.sqf ?
Thanks again
-
- This is my homepage
- Posts: 439
- Joined: Sat Sep 04, 2010 10:20 am
- Location: Cologne, Gemany
- Contact:
Re: ArmA 3 Cvar Help
For the ingame texts:
If you are using a VDS/Dedicated server you can use the BEC tool, which will allow you to define messages to be displayes ingame with specified intervalls. That option is not available, if you are renting a single gameserver, in this case you would have to write a custom function (I will propably include one in my own mission, though I don't use it, but maybe someone else running this might find it usefull, so you could borrow this function). This will also enable you to use a shutdown at specified intervalls, though you need something to restart the server again on the OS level.
BEC URL: http://ibattle.org/
As to the daytime:
Weather and date/time are two different things in ArmA. I don't know what SaMatra set up in the dynamicweathereffects.sqf function, but you can check it for some time setting, or, if there is a date/time setting in the mission parameters.
ArmA usually follows a natural day-night cycle, so if you want daytime only, you could restart the server after 8-10 hours depending on your initial start time and always have a daytime enviroment.
Another option is to code in a time set that is executed on the server only. This could be done with the following code:
This would have to be wrapped into a loop function also.
I would be very careful with this though, if there are other functions depending on time that the mission author defined, you will get unexpected results/crashes.
If you are using a VDS/Dedicated server you can use the BEC tool, which will allow you to define messages to be displayes ingame with specified intervalls. That option is not available, if you are renting a single gameserver, in this case you would have to write a custom function (I will propably include one in my own mission, though I don't use it, but maybe someone else running this might find it usefull, so you could borrow this function). This will also enable you to use a shutdown at specified intervalls, though you need something to restart the server again on the OS level.
BEC URL: http://ibattle.org/
As to the daytime:
Weather and date/time are two different things in ArmA. I don't know what SaMatra set up in the dynamicweathereffects.sqf function, but you can check it for some time setting, or, if there is a date/time setting in the mission parameters.
ArmA usually follows a natural day-night cycle, so if you want daytime only, you could restart the server after 8-10 hours depending on your initial start time and always have a daytime enviroment.
Another option is to code in a time set that is executed on the server only. This could be done with the following code:
Code: Select all
if (sunOrMoon > 0.7) then
{
setDate [2035, 2, 1, 06, 0];
};
I would be very careful with this though, if there are other functions depending on time that the mission author defined, you will get unexpected results/crashes.
Re: ArmA 3 Cvar Help
My arama 3 server is running on managed VDS,so it means i wont be able to use BEC
would u be able to let me borrow you`re custom function that you made instead?
would u be able to let me borrow you`re custom function that you made instead?
-
- This is my homepage
- Posts: 439
- Joined: Sat Sep 04, 2010 10:20 am
- Location: Cologne, Gemany
- Contact:
Re: ArmA 3 Cvar Help
Yes, of course you can use my function. Here is the code, also attached in a file.
What you have to do is copy the file (or the code) in the mission root folder. Before you do that, please remove the top lines 1 to 9, as they are making sense only in the context of my mission and in the while loop, replace (!MissionStatusHasFinished) with true. In your init.sqf, you add the following code:
You can play around a bit with the _MinimumSleepTimeScalar variable value, as this allows you to group the messages (less clutter on the screen).
Function code:
What you have to do is copy the file (or the code) in the mission root folder. Before you do that, please remove the top lines 1 to 9, as they are making sense only in the context of my mission and in the while loop, replace (!MissionStatusHasFinished) with true. In your init.sqf, you add the following code:
Code: Select all
if (!(isServer)) then
{
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "client_AnnounceMessages.sqf";
[] call ClientPreComp_AnnounceMessages;
};
Function code:
Code: Select all
if (!(EditorMode)) then
{
if (isServer) exitWith {};
};
/*
ArmA3 mission Forward Edge of Battle Area (FEBA) written by Caliban55
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/de/
*/
private ["_MessagesToAnnounceStringArray","_DisplayTimesCheckArray","_MinimumSleepTimeScalar","_DisplayReadyMessageStringsArray","_MiniumTimeBetweenAnnouncementsScalar","_CurrentAnnouncementTimeCounterScalar","_UpdatedAnnouncementTimeScalar","_CompiledMessageDisplayString"];
/*
The message announcement array has the following format: [Message to display, format String, Time between announcements, format scalar]
For example:
["Testmessage1 here!", 60], ["This is testmessage 2 displayed every 90 seconds!", 90]
*/
_MessagesToAnnounceStringArray = [["Testmessage1 here!", 60], ["This is testmessage 2 displayed every 90 seconds!", 90]];
if ((count _MessagesToAnnounceStringArray) == 0) exitWith
{
diag_log format ["** Automatic message announcement not used, the array is empty. **"];
};
if (isNil ("CGV_MessageAnnouncementArray")) then
{
CGV_MessageAnnouncementArray = [];
};
_DisplayTimesCheckArray = [];
{
CGV_MessageAnnouncementArray set [count CGV_MessageAnnouncementArray, [_x select 0, _x select 1, 0]];
_DisplayTimesCheckArray set [count _DisplayTimesCheckArray, _x select 1];
} forEach _MessagesToAnnounceStringArray;
_MinimumSleepTimeScalar = [_DisplayTimesCheckArray, 0] call BIS_fnc_findExtreme;
if (_MinimumSleepTimeScalar > 300) then
{
_MinimumSleepTimeScalar = 300;
};
_MinimumSleepTimeScalar = 5;
while {(!MissionStatusHasFinished)} do
{
_DisplayReadyMessageStringsArray = [];
{
_DisplayMessageString = _x select 0;
_MiniumTimeBetweenAnnouncementsScalar = _x select 1;
_CurrentAnnouncementTimeCounterScalar = _x select 2;
if (_CurrentAnnouncementTimeCounterScalar >= _MiniumTimeBetweenAnnouncementsScalar) then
{
_DisplayReadyMessageStringsArray set [count _DisplayReadyMessageStringsArray, _DisplayMessageString];
_UpdatedAnnouncementTimeScalar = 0;
}
else
{
_UpdatedAnnouncementTimeScalar = _CurrentAnnouncementTimeCounterScalar + _MinimumSleepTimeScalar;
};
[CGV_MessageAnnouncementArray, [_forEachIndex, 2], _UpdatedAnnouncementTimeScalar] call BIS_fnc_setNestedElement;
} forEach CGV_MessageAnnouncementArray;
if ((count _DisplayReadyMessageStringsArray) != 0) then
{
_CompiledMessageDisplayString = "";
{
_CompiledMessageDisplayString = _CompiledMessageDisplayString + _x;
} forEach _DisplayReadyMessageStringsArray;
cutText [_CompiledMessageDisplayString, "PLAIN", 2, false];
};
sleep _MinimumSleepTimeScalar;
};
- Attachments
-
- client_AnnounceMessages.7z
- (1.12 KiB) Downloaded 161 times
Re: ArmA 3 Cvar Help
Thankyou caliban ! will test this out
Re: ArmA 3 Cvar Help
Is this correct Caliban ?
my init.sqf contains this at the bottom
And client Announcemessages.sqf
To change the (!MissionStatusHasFinished) to true do they still need to have the brackets ?
my init.sqf contains this at the bottom
Code: Select all
//fatigue
if (!(isServer)) then
{
player enableFatigue false;
};
if (!(isServer)) then
{
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "client_AnnounceMessages.sqf";
[] call ClientPreComp_AnnounceMessages;
};]
Code: Select all
_MinimumSleepTimeScalar = 5;
while {(true)} do
{
_DisplayReadyMessageStringsArray = [];
{
_DisplayMessageString = _x select 0;
_MiniumTimeBetweenAnnouncementsScalar = _x select 1;
_CurrentAnnouncementTimeCounterScalar = _x select 2;
-
- This is my homepage
- Posts: 439
- Joined: Sat Sep 04, 2010 10:20 am
- Location: Cologne, Gemany
- Contact:
Re: ArmA 3 Cvar Help
Yes, looks OK from here.
You could also included the announcer part in the 1st if clause, where you set the fatigue for connecting clients. But it will also work this way.
You could also included the announcer part in the 1st if clause, where you set the fatigue for connecting clients. But it will also work this way.
Code: Select all
if (!(isServer)) then
{
player enableFatigue false;
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "client_AnnounceMessages.sqf";
[] call ClientPreComp_AnnounceMessages;
};
Re: ArmA 3 Cvar Help
Thankyou old chap,will test this when the server empties.
Re: ArmA 3 Cvar Help
Could you give me an example for in game server messages to be displayed ?
For example i want to place about 5 server messages with each message displaying about 20 mins between them.I gather in seconds i will need to change this from 90 to 1200.
Because i dont know were to place them.Also messages show in the center,is it possible for them to display in the chat area ? if not center of the screen is ok for me also.
cheers calib
For example i want to place about 5 server messages with each message displaying about 20 mins between them.I gather in seconds i will need to change this from 90 to 1200.
Because i dont know were to place them.Also messages show in the center,is it possible for them to display in the chat area ? if not center of the screen is ok for me also.
cheers calib
Code: Select all
/*
The message announcement array has the following format: [Message to display, format String, Time between announcements, format scalar]
For example:
["Testmessage1 here!", 60], ["This is testmessage 2 displayed every 90 seconds!", 90]
*/
_MessagesToAnnounceStringArray = [["Welcome to nomercykillers.com", 60], ["This is testmessage 2 displayed every 90 seconds!", 90]; ["message 3 ?", 90]];
-
- This is my homepage
- Posts: 439
- Joined: Sat Sep 04, 2010 10:20 am
- Location: Cologne, Gemany
- Contact:
Re: ArmA 3 Cvar Help
You can add messages by defining them in the _MessagesToAnnounceStringArray array. Each message is an array itself, with the data type format ["Text here <data type string", display interval <data type scalar>] . The whole thing is called a nested array, an array that is made up from array.
To get your messages in there, here is a quick example:
Additional message can added by sepperating them with a comma.
To use a differnt screen position to display the message, you can change the line containing cutText [_CompiledMessageDisplayString, "PLAIN", 2, false]; (originally line 73) to the following:
Lower third of the screen ->
You can also use the radio, but that requires that the player has a radio in his inventory. Depending on the client's user interface setting, long message texts may not display as a whole. To do that, replace the line 73 with the following:
Global radio ->
Side radio ->
Another good position to display the message is on the right side of the screen in the hint area. Use the following code for this (meaning, replace line 73):
Play a bit around with the different formats until you find one that you like.
To get your messages in there, here is a quick example:
Code: Select all
_MessagesToAnnounceStringArray = [["Message text 1", 1200], ["Message text 2", 1210], ["Message text 3", 1220], ["Message text 4", 1230], ["Message text 5", 1240]];
To use a differnt screen position to display the message, you can change the line containing cutText [_CompiledMessageDisplayString, "PLAIN", 2, false]; (originally line 73) to the following:
Lower third of the screen ->
Code: Select all
cutText [_CompiledMessageDisplayString, "PLAIN DOWN", 2, false];
Global radio ->
Code: Select all
player globalChat CompiledMessageDisplayString;
Code: Select all
player sideChat CompiledMessageDisplayString;
Code: Select all
hint format ["%1", CompiledMessageDisplayString, "plain down"];
Re: ArmA 3 Cvar Help
Works great thanks calib! will play around with the positioning of the text.
Also the player fatigue stops working for some players and others it works.
I shall test the event handler maybe
Also the player fatigue stops working for some players and others it works.
I shall test the event handler maybe
Code: Select all
_OnPlayerDisconnectedStackedEventHandler = ["someId", "onPlayerConnected", "someFunction"] call BIS_fnc_addStackedEventHandler;
-
- This is my homepage
- Posts: 439
- Joined: Sat Sep 04, 2010 10:20 am
- Location: Cologne, Gemany
- Contact:
Re: ArmA 3 Cvar Help
No problem.
Small copy&paste mistake in the above code lines,which I can't edit anymore. The codes containing have to be of course, sorry.
As to the fatigue stopping for some players, I guess this happens after they died and respawned? The new player objects don't have that fatigue setting then. I don't know how Wasteland handles respawns, but you could try a different MP event handler. I will see if I can provide an easy code integration for this.
Small copy&paste mistake in the above code lines,which I can't edit anymore. The codes containing
Code: Select all
CompiledMessageDisplayString
Code: Select all
_CompiledMessageDisplayString
As to the fatigue stopping for some players, I guess this happens after they died and respawned? The new player objects don't have that fatigue setting then. I don't know how Wasteland handles respawns, but you could try a different MP event handler. I will see if I can provide an easy code integration for this.
-
- This is my homepage
- Posts: 439
- Joined: Sat Sep 04, 2010 10:20 am
- Location: Cologne, Gemany
- Contact:
Re: ArmA 3 Cvar Help
To address the issue with the fatigue for respawning players, please try the following:
1. Create a file in your mission root folder called client_ManagePlayerFatigue.sqf with the following code in it:
In your fatigue if clause inside the init.sqf, add the following lines:
It should look like this then:
1. Create a file in your mission root folder called client_ManagePlayerFatigue.sqf with the following code in it:
Code: Select all
private ["_PlayerRespawnUnitObject","_PlayerCorpseObject"];
_PlayerRespawnUnitObject = _this select 0;
_PlayerCorpseObject = _this select 1;
_PlayerRespawnUnitObject enableFatigue false;
Code: Select all
ClientPreComp_ManagePlayerFatigue = compileFinal preprocessFileLineNumbers "client_ManagePlayerFatigue.sqf";
player addEventHandler ["Respawn", {_this spawn ClientPreComp_ManagePlayerFatigue;}];
Code: Select all
if (!(isServer)) then
{
player enableFatigue false;
ClientPreComp_ManagePlayerFatigue = compileFinal preprocessFileLineNumbers "client_ManagePlayerFatigue.sqf";
player addEventHandler ["Respawn", {_this spawn ClientPreComp_ManagePlayerFatigue;}];
};