So da ich dazu hier nix gefunden Habe dachte ich mir Zeige ich euch wie ihr im Waffenshop Nach Leveln fragt.
Da im Normalen Altis Life z.b. Für jeden Cop Rank ein Waffenshop gemacht wurde und das wenn man z.b. mehr als 3 Ränge hat ist das doch sehr Nervig
Im Grunde macht Das Tutorial nur das man nur noch einen Waffenshop für z.b. COPs hatt und die Waffen wie bei den Autos nur angezeigt werden wenn das benötigte Level vorhanden ist.
Fangen wir an mit der
fn_weaponShopFilter.sqf
Zeile 9
Spoiler anzeigen
dan in
Version 4.4
Spoiler anzeigen
Zeile 40 den inhalt von case 0 {}; zu folgendem ändern
Spoiler anzeigen
_config = M_CONFIG(getArray,"WeaponShops",_shop,"items");
{
if(EQUAL((SEL(_x,0)),"")) then
{
_itemList lbAdd "---------------------------------------";
}else{
_itemInfo = [SEL(_x,0)] call life_fnc_fetchCfgDetails;
_levelData = SEL(_x,4);
if(!(EQUAL(_levelData,""))) then
{
switch (SEL(_levelData,0)) do {
case "life_coplevel": {
if((SEL(_levelData,1)) <= FETCH_CONST(life_coplevel)) then
{
_itemList lbAdd format["%1",if(!(EQUAL(SEL(_x,1),""))) then {SEL(_x,1)} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,SEL(_x,2)];
};
};
case "life_mediclevel": {
if((SEL(_levelData,1)) <= FETCH_CONST(life_mediclevel)) then
{
_itemList lbAdd format["%1",if(!(EQUAL(SEL(_x,1),""))) then {SEL(_x,1)} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,SEL(_x,2)];
};
};
};
}else{
_itemList lbAdd format["%1",if(!(EQUAL(SEL(_x,1),""))) then {SEL(_x,1)} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,SEL(_x,2)];
};
};
} foreach (_config);
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Mags";
ctrlShow [38402,true];
ctrlShow [38406,true];
Alles anzeigen
die Datei sollte dan so aus Sehn
Spoiler anzeigen
#include "..\..\script_macros.hpp"
/*
File: fn_weaponShopFilter.sqf
Author: Bryan "Tonic" Boardwine
Description:
Applies the filter selected and changes the list.
*/
private["_itemList","_index","_config","_priceTag","_itemArray","_levelData"];
_index = (lbCurSel 38402);
_shop = uiNamespace getVariable ["Weapon_Shop",""];
if(_index == -1 OR _shop == "") exitWith {systemChat "Bad Data Filter"; closeDialog 0;}; //Bad data passing.
uiNamespace setVariable["Weapon_Shop_Filter",_index];
//Setup List Control & Purge it.
_priceTag = ((findDisplay 38400) displayCtrl 38404);
_priceTag ctrlSetStructuredText parseText "";
_itemList = ((findDisplay 38400) displayCtrl 38403);
lbClear _itemList;
if((GVAR_UINS ["Weapon_Magazine",0]) == 1) then {
_config = M_CONFIG(getArray,"WeaponShops",_shop,"mags");
{
if(SEL(_x,0) in (uiNamespace getVariable ["Magazine_Array",[]])) then {
_itemInfo = [SEL(_x,0)] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if(!(EQUAL(SEL(_x,1),""))) then {SEL(_x,1)} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,SEL(_x,2)];
};
} foreach (_config);
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Weapons";
ctrlShow [38402,false];
ctrlShow [38406,true];
} else {
switch (_index) do {
case 0:
{
_config = M_CONFIG(getArray,"WeaponShops",_shop,"items");
{
if(EQUAL((SEL(_x,0)),"")) then
{
_itemList lbAdd "---------------------------------------";
}else{
_itemInfo = [SEL(_x,0)] call life_fnc_fetchCfgDetails;
_levelData = SEL(_x,4);
if(!(EQUAL(_levelData,""))) then
{
switch (SEL(_levelData,0)) do {
case "life_coplevel": {
if((SEL(_levelData,1)) <= FETCH_CONST(life_coplevel)) then
{
_itemList lbAdd format["%1",if(!(EQUAL(SEL(_x,1),""))) then {SEL(_x,1)} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,SEL(_x,2)];
};
};
case "life_mediclevel": {
if((SEL(_levelData,1)) <= FETCH_CONST(life_mediclevel)) then
{
_itemList lbAdd format["%1",if(!(EQUAL(SEL(_x,1),""))) then {SEL(_x,1)} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,SEL(_x,2)];
};
};
}else{
_itemList lbAdd format["%1",if(!(EQUAL(SEL(_x,1),""))) then {SEL(_x,1)} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,SEL(_x,2)];
};
};
} foreach (_config);
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Mags";
ctrlShow [38402,true];
ctrlShow [38406,true];
};
case 1: {
private["_listedItems"];
_config = [];
_listedItems = [];
//Go through weapons
if(primaryWeapon player != "") then {_config pushBack primaryWeapon player;};
if(secondaryWeapon player != "") then {_config pushBack secondaryWeapon player;};
if(handgunWeapon player != "") then {_config pushBack handgunWeapon player;};
//Go through items
_config = _config + primaryWeaponItems player;
_config = _config + (assignedItems player);
_config = _config + (uniformItems player);
_config = _config + (vestItems player);
_config = _config + (backPackItems player);
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Sell";
ctrlShow [38402,true];
ctrlShow [38406,false];
_itemArray = M_CONFIG(getArray,"WeaponShops",_shop,"items");
{
if(!(_x in _listedItems) && _x != "") then {
_iS = [_x,_itemArray] call TON_fnc_index;
if(_iS != -1) then {
if(!(EQUAL(SEL(SEL(_itemArray,_iS),3),-1))) then {
_itemInfo = [_x] call life_fnc_fetchCfgDetails;
_listedItems pushBack _x;
_itemCount = {_x == (_itemInfo select 0)} count _config;
if(_itemCount > 1) then {
_itemList lbAdd format["[%2] %1",_itemInfo select 1,_itemCount];
} else {
_itemList lbAdd format["%1",_itemInfo select 1];
};
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
};
};
};
} foreach _config;
};
};
};
((findDisplay 38400) displayCtrl 38403) lbSetCurSel 0;
Alles anzeigen
Version 4.4R3
Spoiler anzeigen
Zeile 61 den inhalt von case 0 {}; zu folgendem ändern
Spoiler anzeigen
_config = M_CONFIG(getArray,"WeaponShops",_shop,"items");
{
if ((_x select 0)isEqualTo "") then
{
_itemList lbAdd "---------------------------------------";
}else{
_itemInfo = [_x select 0] call life_fnc_fetchCfgDetails;
_levelData = (_x select 4);
if(!(_levelData isEqualTo ""))then
{
switch (_levelData select 0) do {
case "life_coplevel": {
if((_levelData select 1) <= FETCH_CONST(life_coplevel)) then
{
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
};
case "life_mediclevel": {
if((_levelData select 1) <= FETCH_CONST(life_mediclevel)) then
{
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
};
};
}else{
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
};
} foreach (_config);
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Mags";
ctrlShow [38402,true];
ctrlShow [38406,true];
Alles anzeigen
die Datei sollte dan so aus Sehn
Spoiler anzeigen
#include "..\..\script_macros.hpp"
/*
File: fn_weaponShopFilter.sqf
Author: Bryan "Tonic" Boardwine
Description:
Applies the filter selected and changes the list.
*/
private["_itemList","_index","_config","_priceTag","_itemArray"];
_index = (lbCurSel 38402);
_shop = uiNamespace getVariable ["Weapon_Shop",""];
if (_index isEqualTo -1 || _shop isEqualTo "") exitWith {systemChat "Bad Data Filter"; closeDialog 0;}; //Bad data passing.
uiNamespace setVariable ["Weapon_Shop_Filter",_index];
//Setup List Control & Purge it.
_priceTag = ((findDisplay 38400) displayCtrl 38404);
_priceTag ctrlSetStructuredText parseText "";
_itemList = ((findDisplay 38400) displayCtrl 38403);
lbClear _itemList;
if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 1 || (uiNamespace getVariable ["Weapon_Accessories",0]) isEqualTo 1) then {
if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 1) then {
_config = M_CONFIG(getArray,"WeaponShops",_shop,"mags");
{
_var = _x select 0;
_count = {_x == _var} count (uiNamespace getVariable ["Magazine_Array",[]]);
if (_count > 0) then {
_itemInfo = [(_x select 0)] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
} forEach (_config);
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Weapons";
ctrlShow [38406,true];
ctrlShow [38407,false];
} else {
_config = M_CONFIG(getArray,"WeaponShops",_shop,"accs");
{
_var = _x select 0;
_count = {_x == _var} count (uiNamespace getVariable ["Accessories_Array",[]]);
if (_count > 0) then {
_itemInfo = [(_x select 0)] call life_fnc_fetchCfgDetails;
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
} forEach (_config);
((findDisplay 38400) displayCtrl 38407) ctrlSetText localize "STR_Global_Weapons";
ctrlShow [38406,false];
ctrlShow [38407,true];
};
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
ctrlShow [38402,false];
} else {
switch (_index) do {
case 0: {
_config = M_CONFIG(getArray,"WeaponShops",_shop,"items");
{
if ((_x select 0)isEqualTo "") then
{
_itemList lbAdd "---------------------------------------";
}else{
_itemInfo = [_x select 0] call life_fnc_fetchCfgDetails;
_levelData = (_x select 4);
if(!(_levelData isEqualTo ""))then
{
switch (_levelData select 0) do {
case "life_coplevel": {
if((_levelData select 1) <= FETCH_CONST(life_coplevel)) then
{
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
};
case "life_mediclevel": {
if((_levelData select 1) <= FETCH_CONST(life_mediclevel)) then
{
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
};
};
}else{
_itemList lbAdd format["%1",if (!((_x select 1) isEqualTo "")) then {(_x select 1)} else {(_itemInfo select 1)}];
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
_itemList lbSetValue[(lbSize _itemList)-1,(_x select 2)];
};
};
} foreach (_config);
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Mags";
ctrlShow [38402,true];
ctrlShow [38406,true];
};
case 1: {
private["_listedItems"];
_config = [];
_listedItems = [];
//Go through weapons
if (primaryWeapon player != "") then {_config pushBack primaryWeapon player;};
if (secondaryWeapon player != "") then {_config pushBack secondaryWeapon player;};
if (handgunWeapon player != "") then {_config pushBack handgunWeapon player;};
//Go through items
_config = _config + primaryWeaponItems player;
_config = _config + (assignedItems player);
_config = _config + (uniformItems player);
_config = _config + (vestItems player);
_config = _config + (backPackItems player);
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Sell";
ctrlShow [38402,true];
ctrlShow [38406,false];
ctrlShow [38407,false];
_itemArray = M_CONFIG(getArray,"WeaponShops",_shop,"items");
{
if (!(_x in _listedItems) && _x != "") then {
_iS = [_x,_itemArray] call TON_fnc_index;
if (_iS != -1) then {
if (!(((_itemArray select _iS) select 3) isEqualTo -1)) then {
_itemInfo = [_x] call life_fnc_fetchCfgDetails;
_listedItems pushBack _x;
_itemCount = {_x == (_itemInfo select 0)} count _config;
if (_itemCount > 1) then {
_itemList lbAdd format["[%2] %1",(_itemInfo select 1),_itemCount];
} else {
_itemList lbAdd format["%1",(_itemInfo select 1)];
};
_itemList lbSetData[(lbSize _itemList)-1,(_itemInfo select 0)];
_itemList lbSetPicture[(lbSize _itemList)-1,(_itemInfo select 2)];
};
};
};
} forEach _config;
};
};
};
((findDisplay 38400) displayCtrl 38403) lbSetCurSel 0;
Alles anzeigen
Jetzt nur noch Config_Weapons.hpp
Wenn z.b. bei Civ kein levle vorhanden dan macht ihr das so
Spoiler anzeigen
class gun {
name = "Billy Joe's Firearms";
side = "civ";
license = "gun";
level[] = { "", "", -1, "" };
items[] = {
{ "hgun_Rook40_F", "", 6500, 500,"" },
{ "hgun_Pistol_heavy_02_F", "", 9850, -1,"" },
{ "hgun_ACPC2_F", "", 11500, -1,"" },
{ "hgun_PDW2000_F", "", 20000, -1,"" },
{ "optic_ACO_grn_smg", "", 2500, 250,"" }
};
mags[] = {
{ "16Rnd_9x21_Mag", "", 25 },
{ "6Rnd_45ACP_Cylinder", "", 50 },
{ "9Rnd_45ACP_Mag", "", 45 },
{ "30Rnd_9x21_Mag", "", 75 }
};
};
Alles anzeigen
Bei jedem Item ausgenommen mags
{ "hgun_Rook40_F", "", 6500, 500,"" }, ein ,"" hinterm verkaufspreis mit einfügen fertig.
Wenn wei bei cop level vorhanden dan einfach
Spoiler anzeigen
class cop_basic {
name = "Altis Cop Shop";
side = "cop";
license = "";
level[] = { "", "", -1, "" };
items[] = {
{ "arifle_sdar_F", "Taser Rifle", 20000, 7500,"" },
{ "hgun_P07_snds_F", "Stun Pistol", 2000, 650,"" },
{ "hgun_P07_F", "", 7500, 1500,"" },
{ "HandGrenade_Stone", "Flashbang", 1700, -1,"" },
{ "Binocular", "", 150, -1,"" },
{ "ItemGPS", "", 100, 45,"" },
{ "ToolKit", "", 250, 75,"" },
{ "muzzle_snds_L", "", 650, -1,"" },
{ "FirstAidKit", "", 150, 65,"" },
{ "Medikit", "", 1000, 450,"" },
{ "NVGoggles", "", 2000, 980,"" },
{ "arifle_MX_F", "", 35000, 7500, { "life_coplevel", 4 } },
{ "SMG_02_ACO_F", "", 30000, -1, { "life_coplevel", 4 } },
{ "HandGrenade_Stone", "Flashbang", 1700, -1, { "life_coplevel", 4 } },
{ "MineDetector", "", 1000, 500, { "life_coplevel", 4 } },
{ "acc_flashlight", "", 750, 100, { "life_coplevel", 4 } },
{ "optic_Holosight", "", 1200, 275, { "life_coplevel", 4 } },
{ "optic_Arco", "", 2500, -1, { "life_coplevel", 4 } },
{ "muzzle_snds_H", "", 2750, -1, { "life_coplevel", 4 } }
};
mags[] = {
{ "16Rnd_9x21_Mag", "", 25 },
{ "20Rnd_556x45_UW_mag", "Taser Rifle Magazine", 45 },
{ "30Rnd_65x39_caseless_mag", "", 130 },
{ "30Rnd_9x21_Mag", "", 250 }
};
};
Alles anzeigen
der muss dann { "HandGrenade_Stone", "Flashbang", 1700, -1, { "life_coplevel", 4 } } das rote hinzufügen
{ "life_coplevel", 4 } das life_coplevel sagt den level namen kann auch für medics in life_mediclevel geändert werden die Zahl ist das level im Beispiel ab lvl 4 kann der COP das sehn und kaufen
Und denkt bitte immer an die Komma Setzung
Zu guter letzt noch was nettes damit man z.b. Item und Waffen besser im Shop Sortieren kann und man dan im Spiel nicht ewig gucken muss kann man mit dem Tutorial auch Trenstriche im Shop machen
wenn ihr in der Config_Weapons.hpp
z.b. bei den COP im shop
einfach nur "", eintragt wie im Beispiel
Spoiler anzeigen
class cop_basic {
name = "Altis Cop Shop";
side = "cop";
license = "";
level[] = { "", "", -1, "" };
items[] = {
{ "arifle_sdar_F", "Taser Rifle", 20000, 7500,"" },
{ "hgun_P07_snds_F", "Stun Pistol", 2000, 650,"" },
{ "hgun_P07_F", "", 7500, 1500,"" },
{ "HandGrenade_Stone", "Flashbang", 1700, -1,"" },
{ "Binocular", "", 150, -1,"" },
{ "ItemGPS", "", 100, 45,"" },
{ "ToolKit", "", 250, 75,"" },
{ "muzzle_snds_L", "", 650, -1,"" },
{ "FirstAidKit", "", 150, 65,"" },
{ "Medikit", "", 1000, 450,"" },
{ "NVGoggles", "", 2000, 980,"" },
{""},
{ "arifle_MX_F", "", 35000, 7500, { "life_coplevel", 4 } },
{ "SMG_02_ACO_F", "", 30000, -1, { "life_coplevel", 4 } },
{ "HandGrenade_Stone", "Flashbang", 1700, -1, { "life_coplevel", 4 } },
{ "MineDetector", "", 1000, 500, { "life_coplevel", 4 } },
{ "acc_flashlight", "", 750, 100, { "life_coplevel", 4 } },
{ "optic_Holosight", "", 1200, 275, { "life_coplevel", 4 } },
{ "optic_Arco", "", 2500, -1, { "life_coplevel", 4 } },
{ "muzzle_snds_H", "", 2750, -1, { "life_coplevel", 4 } }
};
mags[] = {
{ "16Rnd_9x21_Mag", "", 25 },
{ "20Rnd_556x45_UW_mag", "Taser Rifle Magazine", 45 },
{ "30Rnd_65x39_caseless_mag", "", 130 },
{ "30Rnd_9x21_Mag", "", 250 }
};
};
Alles anzeigen
Dan bekommt ihr im Shop nur ein Strich angezeigt.