Ich möchte einen Parameter definieren, der mir es ermöglicht bei Start der Mission auszuwählen ob der Introfilm abläuft oder nicht.
Trotz Suche
Sichtweite im Multiplayer
parameter tag- nacht
bin ich noch nicht auf das gestoßen was ich brauche:
Meine description.ext
Code:
class Params
{
class DayTime
{
//paramsArray[0]
title = "Time:";
values[] = {6, 14, 17};
texts[] = {"Sunrise","Day","Sunset"};
default = 6;
};
class Intro
{
//paramsArray[1]
title = "Intro:";
values[] = {0,1};
texts[] = {"Yes please!","No thanks!"};
default = 0;
};
class Revive
{
//paramsArray[2]
title = "Revive:";
values[] = {0,1,2,5};
texts[] = {"No Revive","1","2","5"};
default = 1;
};
};
meine Init.sqf
Code:
//non-JIP player, someone who's went through role selection and briefing
if (!(isNull player)) then
{
//Missionparameters
skiptime (((paramsarray select 0) - daytime + 24) % 24);
//Mission parameters - IntroMovie
if ((paramsArray select 1) == 0) then
{
// Play Intro
[] exec "intro\film.sqs"
};
else {if ((paramsArray select 1) == 1) then
{[] exec "scripts\faststart.sqs";
introdone = true;
publicVariable "introdone"
}
};
};
//JIP player, role selection then right into mission
if (!isServer && isNull player) then
{
waitUntil {!isNull player};
...
};
//server
if (isServer) then
{
...
};
Problem: Es scheint als ob der paramsArray Status 0 oder 1 nicht in der Init übernommen und geändert wird. Warum?
Vielen Dank für eure Hilfe!
__________________________________________________ ________________________________
So, nach weiterer Suche bin ich darauf gestossen:
Zusätzliche Parameter funktionieren nicht
Psychobastard´s Hinweis verhalf zum Durchbruch:
Code:
playtime = paramsArray select 0;
if (isNil "playtime") then {playtime = 5400;};
Meine init.sqf sieht nun so aus:
Code:
//Mission parameters
skiptime (((paramsarray select 0) - daytime + 24) % 24);
//Mission parameters - Intro Movie
film = paramsArray select 0;
if (isNil "film") then {[] exec "intro\film.sqs";};
Ergebnis: Es funkt. Warum verstehe ich zwar immer noch nicht.
In die globale Variable film wird der Inhalt des paramsArray 0 übergeben. Was genau fragt denn
"isNil" ab? Laut BI Wiki:
Zitat:
Tests whether the variable defined by the String argument is undefined, or whether an expression result passed as Code is undefined. The function returns true if the variable is undefined or the expression result undefined (i.e. the expression result is Void), and false in all other cases.
Hä?