Skip to content

Commit

Permalink
Add localization support
Browse files Browse the repository at this point in the history
  • Loading branch information
oiad committed Jan 25, 2018
1 parent b2ccdad commit 2289fbe
Show file tree
Hide file tree
Showing 4 changed files with 792 additions and 25 deletions.
24 changes: 13 additions & 11 deletions README.md
@@ -1,12 +1,12 @@
# Service Points
Axe Cops service point script updated for 1.0.6.1 by salival
Axe Cops service point script updated for 1.0.6.2 by salival

Discussion thread on EpochMod: https://epochmod.com/forum/topic/43075-release-vehicle-service-point-refuel-repair-rearm-updated-for-106/

(original github url: https://github.com/vos/dayz/tree/master/service_point)
(original install/discussion url: https://epochmod.com/forum/topic/3935-release-vehicle-service-point-refuel-repair-rearm-script/)

**** *REQUIRES DAYZ EPOCH 1.0.6.1* ****
**** *REQUIRES DAYZ EPOCH 1.0.6.2* ****

Major Changes:

Expand All @@ -27,26 +27,26 @@ Major Changes:

All 3 sections can either be made free, disabled or a specifc price with the following examples:

["Air","free"] will make the vehicle config class of "Air" free for the specific action.
["Air","disabled"] will make the vehicle config class of "Air" disabled for the specific action.
["Air",_freeText] will make the vehicle config class of "Air" free for the specific action.
["Air",_disabledText] will make the vehicle config class of "Air" disabled for the specific action.
["Air",2000] will make the vehicle config class of "Air" have a worth of 2000 for the specific action.
["Armored_SUV_PMC",2000] will make the specific vehicle have a worth of 2000 for the specific action.
["Armored_SUV_PMC","free"] will make the specific vehicle be free for the specific action.
["Armored_SUV_PMC","disabled"] will make the specific vehicle be disabled for the specific action.
["Armored_SUV_PMC",_freeText] will make the specific vehicle be free for the specific action.
["Armored_SUV_PMC",_disabledText] will make the specific vehicle be disabled for the specific action.

Valid vehicle config classes as an example: "Air", "AllVehicles", "All", "APC", "Bicycle", "Car", "Helicopter", "Land", "Motorcycle", "Plane", "Ship", "Tank"

**[>> Download <<](https://github.com/oiad/service_points/archive/master.zip)**

Installation Steps -

1) In your \dayzinstallfolder\MPMissions\DayZ_Epoch_11.Chernarus folder (or similar), create a subfolder called "scripts/service_points" or use another name if a folder with other add-on scripts exists.
1. In your \dayzinstallfolder\MPMissions\DayZ_Epoch_11.Chernarus folder (or similar), create a subfolder called "scripts/service_points" or use another name if a folder with other add-on scripts exists.

2) Download this repo by clicking on the "Clone or Download" button and then click "Download ZIP" or click: https://github.com/oiad/service_points/archive/master.zip
2. Download this repo by clicking on the "Clone or Download" button and then click "Download ZIP" or click: https://github.com/oiad/service_points/archive/master.zip

3) Place the files that you've downloaded below into the "scripts/service_points" folder
3. Place the files that you've downloaded below into the "scripts/service_points" folder

4) Find this line in your <code>init.sqf</code>:
4. Find this line in your <code>init.sqf</code>:
```sqf
execFSM "\z\addons\dayz_code\system\player_monitor.fsm";
```
Expand All @@ -56,7 +56,9 @@ Installation Steps -
execVM "scripts\servicePoints\init.sqf";
```

5) Edit "scripts/servicePoints\init.sqf" and customize it to your preference.
5. Edit "scripts/servicePoints\init.sqf" and customize it to your preference.

6. Copy the supplied <code>stringTable.xml</code> to your mission folder, it is a community based localization file and contains translations for major community mods including this one. See https://github.com/oiad/communityLocalizations for more information.

# Battleye filter install.

Expand Down
4 changes: 2 additions & 2 deletions scripts/servicePoints/init.sqf
Expand Up @@ -2,7 +2,7 @@
Vehicle Service Point by Axe Cop
Rewritten for single currency, gems, briefcase support and 1.0.6 epoch compatibility by salival - https://github.com/oiad/
Requires DayZ Epoch 1.0.6.1
Requires DayZ Epoch 1.0.6.2
This version adds support for both single currency and gems (from the epoch 1.0.6 update) as well as the original epoch briefcase currency system.
Instead of pricing things like the original way, prices are now done on a "worth" similar to how coins are done. The price value of items are below.
Expand Down Expand Up @@ -41,7 +41,7 @@ _servicePointClasses = ["Map_A_FuelStation_Feed","Land_A_FuelStation_Feed","Fuel
_maxDistance = 50; // maximum distance from a service point for the options to be shown
_actionTitleFormat = "%1 (%2)"; // text of the vehicle menu, %1 = action name (Refuel, Repair, Rearm), %2 = costs (see format below)
_actionCostsFormat = "%2 %1"; // %1 = item name, %2 = item count
_message = "Vehicle Service Point nearby"; // message to be shown when in range of a service point (set to "" to disable)
_message = localize "STR_SP_MESSAGE"; // This is translated from your stringtable.xml in your mission folder root. Set to "" to disable
_cycleTime = 5; // Time in sections for how often the action menu will be refreshed and how often it will search for a nearby fuel station (setting this too low can make a lot of lag)
_disabledText = (localize "str_temp_param_disabled");
_freeText = (localize "strwffree");
Expand Down
24 changes: 12 additions & 12 deletions scripts/servicePoints/servicePointActions.sqf
Expand Up @@ -27,9 +27,9 @@ if (_action == "rearm") then {

if (typeName _amount == "STRING") then {
if (_amount == (localize "str_temp_param_disabled")) then {
if (_action == "rearm") then {_reason = format["%1 is unable to be rearmed.",_weaponName]; _disabled = true};
if (_action == "repair") then {_reason = format["%1 is unable to be repaired.",_name]; _disabled = true};
if (_action == "refuel") then {_reason = format["%1 is unable to be refueled.",_name]; _disabled = true};
if (_action == "rearm") then {_reason = format[localize "STR_SP_UNABLE_REARM",_weaponName]; _disabled = true};
if (_action == "repair") then {_reason = format[localize "STR_SP_UNABLE_REPAIR",_name]; _disabled = true};
if (_action == "refuel") then {_reason = format[localize "STR_SP_UNABLE_REFUEL",_name]; _disabled = true};
};
if (_amount == (localize "strwffree")) then {_amount = 0};
};
Expand Down Expand Up @@ -63,15 +63,15 @@ if (_enoughMoney) then {
if (_action == "refuel") then {
[player,50,true,getPosATL player] spawn player_alertZombies;
_vehicle engineOn false;
[format["Refueling %1...",_name],1] call dayz_rollingMessages;
[format[localize "STR_SP_REFUELING",_name],1] call dayz_rollingMessages;
[_vehicle,"refuel",0,false] call dayz_zombieSpeak;

while {vehicle player == _vehicle} do {
if ([0,0,0] distance (velocity _vehicle) > 1) exitWith {[format["Refueling of %1 stopped",_name],1] call dayz_rollingMessages};
if ([0,0,0] distance (velocity _vehicle) > 1) exitWith {[format[localize "STR_SP_REFUELING_STOPPED",_name],1] call dayz_rollingMessages};
_fuel = (fuel _vehicle) + ((_this select 3) select 3);
if (_fuel > 0.99) exitWith {
_vehicle setFuel 1;
[format["%1 Refueled",_name],1] call dayz_rollingMessages;
[format[localize "STR_SP_REFUEL_OK",_name],1] call dayz_rollingMessages;
};
_vehicle setFuel _fuel;
uiSleep ((_this select 3) select 2);
Expand All @@ -86,7 +86,7 @@ if (_enoughMoney) then {
{
if ((vehicle player != _vehicle) || {[0,0,0] distance (velocity _vehicle) > 1}) exitWith {
_allRepaired = false;
[format["Repairing of %1 stopped",_name],1] call dayz_rollingMessages;
[format[localize "STR_SP_REPAIRING_STOPPED",_name],1] call dayz_rollingMessages;
};
_damage = [_vehicle,_x] call object_getHit;
if (_damage > 0) then {
Expand All @@ -95,7 +95,7 @@ if (_enoughMoney) then {
_partName set [1,45];
_partName set [2,20];
_partName = toString _partName;
[format ["Repairing%1...",_partName],1] call dayz_rollingMessages;
[format [localize "STR_SP_REPAIRING",_partName],1] call dayz_rollingMessages;
_selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _x >> "name");
_strH = "hit_" + (_selection);
_vehicle setHit[_selection,0];
Expand All @@ -109,7 +109,7 @@ if (_enoughMoney) then {
if (_allRepaired) then {
_vehicle setDamage 0;
_vehicle setVelocity [0,0,1];
[format["%1 Repaired",_name],1] call dayz_rollingMessages;
[format[localize "STR_SP_REPAIR_OK",_name],1] call dayz_rollingMessages;
};
};

Expand All @@ -120,7 +120,7 @@ if (_enoughMoney) then {

for "_i" from 1 to _magazineCount do {_vehicle addMagazineTurret [_ammo,_turret];};

[format["%1 of %2 Rearmed",_weaponName,_name],1] call dayz_rollingMessages;
[format[localize "STR_SP_REARMED",_weaponName,_name],1] call dayz_rollingMessages;
};
call player_forceSave;
} else {
Expand All @@ -129,8 +129,8 @@ if (_enoughMoney) then {
} else {
_itemText = if (Z_SingleCurrency) then {CurrencyName} else {[_amount,true] call z_calcCurrency};
if (Z_SingleCurrency) then {
systemChat format ["You need %1 %2 to %3 your %4.",[_amount] call BIS_fnc_numberText,_itemText,_action,_name];
systemChat format [localize "STR_SP_FAIL_COINS",[_amount] call BIS_fnc_numberText,_itemText,_action,_name];
} else {
systemChat format ["You need %1 to %2 your %3.",_itemText,_action,_name];
systemChat format [localize "STR_SP_FAIL_BRIEFCASES",_itemText,_action,_name];
};
};

0 comments on commit 2289fbe

Please sign in to comment.