HX3 Foren

HX3 Foren (https://hx3.de/)
-   Editing & Scripting (https://hx3.de/editing-scripting-167/)
-   -   addaction einmalige Aktion (https://hx3.de/editing-scripting-167/addaction-einmalige-aktion-22939/)

Whoop Whoop 21.09.2013 09:32

addaction einmalige Aktion
 
Moin,

ich habe ein kleines Problem, bei welchem ich Hilfe brauche, leider bin ich ein neuling was das Scrippting angeht.

Folgendes: Ich habe ein Script (nicht selbst geschrieben in dem der Player einer Art Level-System bekommt und bei einem Level-Aufstieg natürlich eine Belhonung (Fahrzeug).
Mein Problem ist aber, dass die Fahrzeuge auf den Standartwerten sofort spawnen wenn man ein Level aufsteigt. Ich möchte aber dass man es per Scroll-Menü es sich aussuchen kann wann, aber halt nur ein einziges mal.

hier der Teil vom Script als original:
Zitat:

vehicle_spawner =
{
_allUnits = allUnits;
player setVehicleInit "allUnits = [];";
processInitCommands;
clearVehicleInit player;
allUnits = _allUnits;
_dir = getdir player;
_pos = getpos player;
_pos = [(_pos select 0)+5*sin(_dir),(_pos select 1)+5*cos(_dir),0];

sporkulus = createVehicle [spawnthisshit, _pos, [], 0, "CAN_COLLIDE"];
sporkulus setVariable ["ObjectUID", "script made by Sporkulus", true];
};

level_up =
{

if ((currentMoney >= (v2)) and (currentMoney < (v3)) and (Currentlevel == 1)) then
{
Currentlevel = 2;
profileNamespace setVariable ["level", Currentlevel]; saveProfileNamespace;
_setlevel = profileNamespace getVariable ["level",0];
Currentlevel = _setlevel;spawnthisshit = "Old_bike_TK_CIV_EP1";call vehicle_spawner;
if (allow_texts) then {cutText [format["LEVEL %1 REACHED!", Currentlevel], "WHITE IN"];};
if (allow_sounds) then {playsound "Challenge_Completed";};genRewards = true;
};
Ich habe dann einen addaction-Befehl davor geschaltet und ein Spawn-Script dazu gepackt. Das Menü erscheint auch erst nach dem Level-Aufstieg, aber leider bleibt es auch dann da.
Zitat:

vehicle_spawner =
{
_allUnits = allUnits;
player setVehicleInit "allUnits = [];";
processInitCommands;
clearVehicleInit player;
allUnits = _allUnits;
_dir = getdir player;
_pos = getpos player;
_pos = [(_pos select 0)+5*sin(_dir),(_pos select 1)+5*cos(_dir),0];

sporkulus = createVehicle [spawnthisshit, _pos, [], 0, "CAN_COLLIDE"];
sporkulus setVariable ["ObjectUID", "script made by Sporkulus", true];
};

level_up =
{

if ((currentMoney >= (v2)) and (currentMoney < (v3)) and (Currentlevel == 1)) then
{
Currentlevel = 2;
profileNamespace setVariable ["level", Currentlevel]; saveProfileNamespace;
_setlevel = profileNamespace getVariable ["level",0];
Currentlevel = _setlevel;spawnthisshit = player addaction[("<t color=""#c70000"">" + ("Spawn Vehicle") +"</t>"),"Weg\zur\Datei.sqf","",5,false,true,"",""];call vehicle_spawner;
if (allow_texts) then {cutText [format["LEVEL %1 REACHED!", Currentlevel], "WHITE IN"];};
if (allow_sounds) then {playsound "Challenge_Completed";};genRewards = true;
};

Ich habe es schon mit der hideOnUse-Methode versucht, leider blieb die Action weiterhin erhalten (vill habe ich sie auch nicht richtig eingestellt).
Eine weitere erfolglose Aktion war eine removeaction einzüfugen
Zitat:

{_x removeAction spawnthisshit} forEach allUnits;
leider war das Problem hierbei, dass es die Spawn-Option direkt wieder ausgeschaltet hat =/

Hoffetnlich weiß einer von euch Rat.

Danke und MfG

Vienna 21.09.2013 14:13

Dem Skript werden beim Aufruf durch eine Aktion automatisch Parameter übergeben. Dabei ist auch die ID der Aktion.

Wenn dem Spieler die Aktion erteilt wurde, dann kann die Aktion dem Spieler im Skript nach dem Aufruf folgend gelöscht weden:

player removeAction (_this select 2);


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:36 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