HX3 Foren

HX3 Foren (https://hx3.de/)
-   Editing (https://hx3.de/editing-139/)
-   -   Eigenes Carbomb Script (https://hx3.de/editing-139/eigenes-carbomb-script-15528/)

Jois[GER] 14.12.2008 12:07

Eigenes Carbomb Script
 
Also,

hab mir heute mal ein eigenes carbombscript gemacht :

Zitat:

? (not alive ab2) : goto "exit"

_Exp = random 7;

?_Exp = 1 : goto "Hydra";
?_Exp = 2 : goto "RPG";
?_Exp = 3 : goto "SH125";
?_Exp = 4 : goto "SH105";
?_Exp = 5 : goto "Hellfire";
?_Exp = 6 : goto "GBU12";
?_Exp = 7 : goto "Nichts";


#Hydra
Bomb1 = "R_Hydra_HE" createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0];
goto "exit";

#RPG
Bomb2 = "R_PG7V_AT" createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0];
goto "exit";

#SH125
Bomb3 = "SH_125_HE" createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0];
goto "exit";

#SH105
Bomb4 = "SH_105_HE" createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0];
goto "exit";

#Hellfire
Bomb5 = "M_Hellfire_AT" createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0];
goto "exit";

#GBU12
Bomb6 = "BO_GBU12_LGB" createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0];
goto "exit";

#Nichts
hint "Die Bombe ist Schrott!";

#exit
hint "exit ausgeloost"
exit;
Nur wird anscheinend gleich die erste Zeile überlesen :(
Alles funzt prima bis auf den Teil , dass wenn das Fahrzeug mal nicht gespawnt wird das Skript gleich nach exit springt ...

Jemand eine Idee??

TeRp 14.12.2008 12:53

Ist doch genau das, was du mit dem IF erreichen willst?
Falls ab2 (anscheinend dein Fahrzeug) nicht lebt = tot = kaputt = nicht auf der Karte dann springe zu exit. :komisch:

Jois[GER] 14.12.2008 13:15

Nein , es sieht so aus .. wenn ich den Auslöserbereich betrete und mein Fahrzeug da ist , ist alles wunderbar.. nur wenn das Fahrzeug nicht da ist , gibt er mir die Fehlermeldung :
Zitat:

Bomb1 = "R_Hydra_HE" /#/ createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0]
Error Type Any , expected Number
... dann müsste er aber bei #Hydra sein .. und nicht bei exit ... und da Frag ich mich , warum ?!

Xeno 14.12.2008 13:26

Wie wäre es mit einer Null Abfrage und wenn null dann raus aus dem Script ?

Code:

?isNull ab2: exit
Xeno

Jois[GER] 14.12.2008 13:36

Hmm, hab jetzt die oberste Zeile gegen deinen Vorschlag getauscht , meintest doch so , oder ? Naja , geht aber nicht , kommt immer noch die Fehlermeldung.

Xeno 14.12.2008 14:16

Ok, dann halt das an den Anfang:

Code:

? format ["%1", ab2] == "scalar bool array string 0xe0ffffef": exit
Und änder mal deine ? xxx. = ist eine Zuweisung, == sieht besser aus.
Und noch ein Tip, random liefert auch Werte die hinter dem Komma Stellen haben. _Exp == 1 wird wohl nie erreicht werden.
Und noch ein Tip, nimm sqf.

Xeno

Jois[GER] 15.12.2008 13:02

Wie würde denn so ein SQF Skript aussehen? Hab bis jetzt nur mit SQS gearbeitet!

Xeno 15.12.2008 17:34

Zum Beispiel so... (nicht getestet, irgendwann muss ich mir mal ArmA auf den Rechner auf der Arbeit machen ;))

Code:

if (format ["%1", ab2] == "scalar bool array string 0xe0ffffef") exitWith {};

if (!alive ab2) exitWith {};

_bombs = ["R_Hydra_HE","R_PG7V_AT","SH_125_HE","SH_105_HE","M_Hellfire_AT","BO_GBU12_LGB","Nichts"];

_ran = floor (random count _bombs);

if ((_bombs select _ran) != "Nichts") then {
    Bomb1 = (_bombs select _ran) createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0];
    // wenn die Variable für die Bombe (BombX) immer anders heißen muss, dann so:
    // call compile format ["Bomb%1 = (_bombs select _ran) createVehicle [(getpos ab2 select 0),(getpos ab2 select 1),0];",_ran];
} else {
    hint "Die Bombe ist Schrott!";
};

Xeno

Jois[GER] 15.12.2008 18:26

Hmm.. ja , also , wenn ein Auto das ist kommt folgenede Meldung :
Zitat:

...((_bombs select _ran) != "Nichts") then /#/ {
Error Generic error in expression
(Explosion geht aber)

Und wenn kein Auto da ist kommt :
Zitat:

Bomb3 = (_bombs select _ran) /#/ createVehicle [(getpos ab2 select 0),(ge...
Error Type Any, expected Number

Xeno 15.12.2008 19:12

Dann empfehle ich Dir mal das Script mit

handle = [] execVM "...

anstatt

[] exec "...

aufzurufen :)

Habs gerade testen können, geht ohne Probleme.

Xeno

Jois[GER] 15.12.2008 20:38

Jop, geht wunderbar! Danke für die Hilfe! :daumen:

raedor 22.12.2008 16:03

Statt (format ["%1", ab2] == "scalar bool array string 0xe0ffffef") kann man übrigens (isNil "ab2") schreiben.

Xeno 22.12.2008 16:17

Zitat:

Zitat von raedor (Beitrag 206902)
Statt (format ["%1", ab2] == "scalar bool array string 0xe0ffffef") kann man übrigens (isNil "ab2") schreiben.

Hihi, endlich kommt einer damit :D

Was allerdings doof ist, dass man nil selber überschreiben kann. Sprich z.B. nil = 10 und nil ist nicht mehr "scalar bool array string 0xe0ffffef" sondern 10.

Xeno


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