HX3 Foren

HX3 Foren (https://hx3.de/)
-   Editing & Scripting (https://hx3.de/editing-scripting-167/)
-   -   AddWeaponCargo/GetWeaponCargo (https://hx3.de/editing-scripting-167/addweaponcargo-getweaponcargo-22708/)

Eden 03.07.2013 15:26

AddWeaponCargo/GetWeaponCargo
 
Hey Leute,
ich habe heute bestimmt schon eine halbe Ewigkeit nach einer Lösung für mein Problem gesucht aber keine gefunden.
Ich möchte gerne einen beliebigen Inhalt einer Waffenbox in eine andere schreiben bzw. erst einmal in einem namespace zwischen speichern und später wieder raus holen. Warum namespace? ich nutze das ProfileNamespace um trotz Missions neustart den Inhalt noch nutzen zu können. So hier mein bisheriger code:
Code:

Senden der Items:
_weapon = getWeaponCargo postbox;
_magazine = getMagazineCargo postbox;

profileNamespace setVariable ["sol_multiworld_post_weapons",_weapon];
profileNamespace setVariable ["sol_multiworld_post_magazine",_magazine];
saveProfileNamespace;

Empfangen der Items:
_weapon = profileNamespace getVariable "sol_multiworld_post_weapons";
_magazine = profileNamespace getVariable "sol_multiworld_post_magazine";

{postbox addWeaponCargo _x} foreach _weapon;
{postbox addMagazineCargo _x} foreach _magazine;

Aber aus irgend einem Grund geht das nicht so. Ich bin dazu gekommen, dass es am Empfangen liegen muss. Deshalb habe ich es auch so schon probiert:
Code:

{postbox addWeaponCargo [(_x select 0),1]} foreach _weapon;
{postbox addMagazineCargo [(_x select 0),1]} foreach _magazine;

Was zumindest schon mal eine Waffe und ein Magazin hinzufügt aber das hier geht nicht:
Code:

{postbox addWeaponCargo [(_x select 0),(_x select 1)]} foreach _weapon;
{postbox addMagazineCargo [(_x select 0),(_x select 1)]} foreach _magazine;

Ich weis echt nicht mehr wie ich das noch machen soll. Es steht ja leider auch nicht beim getWeaponsCargo Befehl dabei in welchem Format er die Waffen abspeichert.
Hat irgendwer ne Idee für mich?

Vienna 03.07.2013 16:17

Lass dir einmal anzeigen wie die Arrays bestückt sind.
z.B.:
player groupChat format ["%1", _weapon];

Eden 03.07.2013 16:57

Hey Danke, jetzt weis ich was ich falsch gemacht habe.
Für alle die es noch interessiert:
Code:

for "_i" from 0 to ((count (_weapon select 0))- 1) do
{
  _postbox addWeaponCargo [((_weapon select 0)select _i),((_weapon select 1)select _i)];
};
for "_i" from 0 to ((count (_magazine select 0))- 1) do
{
  _postbox addMagazineCargo [((_magazine select 0)select _i),((_magazine select 1)select _i)];



Alle Zeitangaben in WEZ +1. Es ist jetzt 11:45 Uhr.

Angetrieben durch vBulletin, Entwicklung von Philipp Dörner & Tobias


SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119