PDA

View Full Version : help please from some scripter / main script to control one random mission



dpd29
Jun 14 2009, 18:41
I have made a script to control one mission . the script called main.sqf with codec.




_puntosdemunicion=[municion1,municion2,municion3,municion4];//ammopositionsrandom. i use logics objects.


_puntosdeobjetivo=[posicion1e,posicion2e,posicion3e,posicion4e,posicion5e,posicion6e,posicion7e,posicion8e,posicion9e,posicion10e,posicion1w,posicion2w,posicion3w,posicion4w,posicion5w,posicion6w,posicion7w,posicion8w,posicion9w,posicion10w];
//objetivepositionsrandom.i use logics objects.

_objetivos=[o1,o2,o3,o4,o5,o6,o7,o8,o9,o10,o11,12,o13,o14,o15];// random objetives from 15 posibilities


_misionesrealizadas=[];// missions made

_objetivorealizado=[];// objetive choosen





_ctmisionesA= count _puntosdeobjetivo;



_salirprincipal=false;



/// while to do the random missions

while {not _salirprincipal} do {





_misionactual= _puntosdeobjetivo select (floor(random _ctmisionesA));// i choose the objetive position

nill=["area","CDF",3,4,4,"MOVE","area"] execVM "Spawnunits.sqf";// enemy respawn in marker called area
hint "runing main";
sleep 10;

///////////////////////
// its to choose a objetive positions, if is null or made objetivo before then i do it again

_salir1=false;


while {not _salir1} do {


if (not (_misionactual==objnull) and not (_misionactual in _misionesrealizadas)) then {_salir1=true;};

_misionactual= _puntosdeobjetivo select (floor(random _ctmisionesA));

};


////////////

//its to choose the random objetive object

_salir2=false;

_objetivoelegido= _objetivos select (floor(random count _objetivos));
while {not _salir2} do {




if (not (_objetivoelegido==objnull) and not (_objetivoelegido in _objetivorealizado)) then {_salir2=true;};
_objetivoelegido= _objetivos select (floor(random count _objetivos));
};



/////////////////








_posicionmunicion= _puntosdemunicion select (floor(random count _puntosdemunicion));// random position ammo



//// Bucle general de cada mision// its to move the marker to position objetive and ammo position

_objetivoelegido setpos position _misionactual;
zonaa setpos position _misionactual;
"marcadorobjetivo" setmarkerpos getpos _misionactual;
ammo1 setpos position _posicionmunicion;
ammo2 setpos position _posicionmunicion;
ammo3 setpos position _posicionmunicion;
ammo4 setpos position _posicionmunicion;
ammo5 setpos position _posicionmunicion;
ammo6 setpos position _posicionmunicion;
ammo7 setpos position _posicionmunicion;
"marcadormunicion" setmarkerpos getpos _posicionmunicion;
sleep 4;

nill=["zonaa","CDF",3,4,4,"MOVE","zonaa"] execVM "Spawnunits.sqf";// respawn enemy units in marker called "zonaa"

///////////////////////////////////////////////////////////////////////////////


waituntil {not alive _objetivoelegido};

if (count _misionesrealizadas==5) then {_salirprincipal=true;};// if made missions count is equal 5 then exit while


};



//finish


exit;


















do you find some wrong line? In file rpt there is not errors. thanks.

---------- Post added at 06:41 PM ---------- Previous post was at 06:37 PM ----------

Fuck im a litle silly todya, i have found some error.:D.Im going to try it.

Mr Fenix
Jun 14 2009, 21:44
Have you seen the new task ("objective") commands in use?

Check the code here.
http://www.ofpec.com/forum/index.php?topic=33468.0