Jump to content
Sign in to follow this  
kiero

MP mission start parameters used in triggers

Recommended Posts

In description.ext I have this:

class Params

{

class EnemyVeh

{

title = "Vehicles";

values[] = {1,2,3};

texts[] = {"One Vehicle","Two Vehicles","Three Vehicles"};

default = 2;

};

};

In my mission i would like to have triggers that will be activated according to this EnemyVeh value. Can it be done in trigger condition field?

Share this post


Link to post
Share on other sites

Take a look, this way maybe help u.

description.ext

class Params
{
class EnemyVeh
{
title = "Vehicles";
values[] = {0,1,2};
texts[] = {"One Vehicle","Two Vehicles","Three Vehicles"};
default = 1;
code = "EnemyVeh = %1";
};
};

init.sqf

pv_veh1 = false;
publicvariable "pv_veh1";
pv_veh2 = false;
publicvariable "pv_veh2";
pv_veh3 = false;
publicvariable "pv_veh3";

// for MP server parameters.
processParamsArray = [] execVM "ParamsArray.sqf";
[] execVM "setMissionConditions.sqf";

ParamsArray.sqf

for [ { _i = 0 }, { _i < count(paramsArray) }, { _i = _i + 1 } ] do
{
_paramName =(configName ((missionConfigFile >> "Params") select _i));
_paramValue = (paramsArray select _i);
_paramCode = ( getText (missionConfigFile >> "Params" >> _paramName >> "code"));
_code = format[_paramCode, _paramValue];
call compile _code;
};

setMissionConditions.sqf

// DECLARE VARIABLES AND FUNCTIONS
private ["_EnemyVeh"];

// WAIT FOR PARAMSARRAY TO BE PROCESSED
waitUntil {scriptDone processParamsArray};

// Conditions are set in the parameters screen (during mission set-up).
_EnemyVeh= EnemyVeh;

switch (_EnemyVeh) do {

case 0: {pv_veh1 = true; publicvariable "pv_veh1"}; 	 // one vehicle
case 1: {pv_veh2 = true; publicvariable "pv_veh2"}; 	 // two vehicle
case 2: {pv_veh3 = true; publicvariable "pv_veh3"};   // three vehicle

};

Now about triggers:

Create 3 triggers and use publicvariables as condition, example trigger for one vehicle.

trigger size 0 X 0

Activation:

Game logic

Condition:

(pv_veh1)

On Act: ur codes...

Note about condition if you want spawn vehicles, use Isserver in condition to prevent spawn so many vehicles per each players.

Condition:

(pv_veh1) and Isserver

same for other triggers

use search in forum and find more info about public variable and params

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×