Jump to content
Sign in to follow this  
marker

Error On Second Run Of Script!

Recommended Posts

Hi Guys

Using a script that Kyliana helped me with, when I say help, he did most of the hard work :)

Script is as below!!

//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by: MarKeR, Credit to Kyliana : TAW_Tonic
//////////////////////////////////////////////////////////////////

if (!isServer) exitWith {};

sleep (10 + (random 90));

// Mission

_missionType = _this select 0;

fn_findMissionSpot = {

//Creating the position

private ["_rad","_cnps","_hills","_hillcount","_hillnum","_hill","_marker","_boxes","_numb","_boxnum","_box","_picture","_name","_text","_color"];

_rad=20000;
_cnps = getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition");
_hills = nearestLocations [_cnps, ["FlatArea"], _rad];
_hillcount = count _hills;
_hillnum = floor (random _hillcount);
_hill = _hills select _hillnum;

getPos _hill
};

//ARTILLERY MISSION 	

fn_spawnArtyMission = {

//Creating the marker 

_marker = createMarker ["Artillery", call fn_findMissionSpot];
_marker setMarkerType "mil_destroy";
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Mobile Artillery";
_marker setMarkerSize [1,1];


// Creating Vehicle and Hints 
_veh = ["MLRS_DES_EP1","GRAD_CDF"] call BIS_fnc_selectRandom;

arty = createVehicle [_veh,[(getMarkerpos _marker select 0) + 30, getMarkerpos _marker select 1,0],[], 0, "NONE"];
arty setFuel random 0.9;
arty setVehicleAmmo random 0.9;


_color = "#C5C5C5";
_name = getText (configFile >> "cfgVehicles" >> typeOf art >> "displayName");
_picture = getText (configFile >> "cfgVehicles" >> typeOf art >> "picture");

_text = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Objective</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>This <t color='#FFCC33'>%1</t>, is your OBJECTIVE!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Get to it first!</t>",   _name, _picture, _color 
       ];

     [nil,nil,rHINT,_text] call RE; 

// Complete Mission 
waitUntil { Player distance arty < 20};

deleteMarker _marker;


_text2 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Objective</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>Capture the <t color='#FFCC33'>%1</t>, has been completed!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Congratulations!!</t>",   _name, _picture, _color 
       ];

       [nil,nil,rHINT,_text2] call RE;

	sleep 2;


};


// TANK MISSION 

fn_spawnTankMission = {

//Creating The Marker 
_marker = createMarker ["MBT", call fn_findMissionSpot];
_marker setMarkerType "selector_selectedMission";
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Main Battle Tank";
_marker setMarkerSize [1,1];

// Creating Vehicle and Hints 
_veh = ["T90","M2A3_EP1","T34","M1A1","T72_INS","T55_TK_GUE_EP1","BMP2_HQ_TK_EP1"] call BIS_fnc_selectRandom;

tank = createVehicle [_veh,[(getMarkerpos _marker select 0) + 30, getMarkerpos _marker select 1,0],[], 0, "NONE"];
tank setFuel random 0.9;
tank setVehicleAmmo 0.9;


_color = "#C5C5C5";
_name = getText (configFile >> "cfgVehicles" >> typeOf tank >> "displayName");
_picture = getText (configFile >> "cfgVehicles" >> typeOf tank >> "picture");

_text3 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Objective</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>This <t color='#FFCC33'>%1</t>, is your OBJECTIVE!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Get to it first!</t>",   _name, _picture, _color 
       ];

     [nil,nil,rHINT,_text3] call RE; 



// Complete Mission 
waitUntil { Player distance tank < 20}; 

deleteMarker _marker;


_text4 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Complete</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>Capture the <t color='#FFCC33'>%1</t>, has been completed!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Destroy The Enemy Bases!</t>",   _name, _picture, _color 
       ];

       [nil,nil,rHINT,_text4] call RE; 

	sleep 2;

};


// HELI MISSION 
fn_spawnHeliMission = {

//Creating Marker 
_marker = createMarker ["Helicopter", call fn_findMissionSpot];
_marker setMarkerType "Pickup";
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Secure Helicopter";
_marker setMarkerSize [1,1];


// Creating Vehicle and Hints 
_chopper = ["UH60M_MEV_EP1","UH1H_TK_GUE_EP1","Mi17_Ins","CH_47F_EP1","BAF_Merlin_HC3_D","MH6J_EP1","MV22"] call BIS_fnc_selectRandom;

chop = createVehicle [_chopper,[(getpos _hill select 0) + 30, getpos _hill select 1,0],[], 0, "NONE"];
chop setFuel random 0.9;
chop setVehicleAmmo  random 0.9;

_color = "#C5C5C5";
_name = getText (configFile >> "cfgVehicles" >> typeOf chop >> "displayName");
_picture = getText (configFile >> "cfgVehicles" >> typeOf chop >> "picture");

_text5 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Objective</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>This <t color='#FFCC33'>%1</t>, is your OBJECTIVE!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Get to it first!</t>",   _name, _picture, _color 
       ];

     [nil,nil,rHINT,_text5] call RE; 


//Complete Mission 
waitUntil { Player distance chop < 20};

deleteMarker _marker;

_text6 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Complete</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>Capture the <t color='#FFCC33'>%1</t>, has been completed!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>CTransport Your Team Around!!</t>",   _name, _picture, _color 
       ];

       [nil,nil,rHINT,_text6] call RE; 

	sleep 2

};

// FUEL TRUCK MISSION 

fn_spawnTruckMission = {

//Creating The Marker 
_marker = createMarker ["Truck", call fn_findMissionSpot];
_marker setMarkerType "mil_destroy";
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Fuel Truck";
_marker setMarkerSize [1,1];


// Creating Vehicle and Hints 
_veh = ["MTVR","MTVR"] call BIS_fnc_selectRandom;

truck = createVehicle [_veh,[(getMarkerpos _marker select 0) + 30, getMarkerpos _marker select 1,0],[], 0, "NONE"];
truck setFuel random 0.9;
truck setVehicleAmmo 0.9;


_color = "#C5C5C5";
_name = getText (configFile >> "cfgVehicles" >> typeOf truck >> "displayName");
_picture = getText (configFile >> "cfgVehicles" >> typeOf truck >> "picture");

_text7 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Objective</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>This <t color='#FFCC33'>%1</t>, is your OBJECTIVE!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Get to it first!</t>",   _name, _picture, _color 
       ];

     [nil,nil,rHINT,_text7] call RE; 



//Complete Mission 
waitUntil { Player distance truck < 20};

deleteMarker _marker;

_text8 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Complete</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>Capture the <t color='#FFCC33'>%1</t>, has been completed!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Mobile Re-fuel Your Vehicles!</t>",   _name, _picture, _color 
       ];

       [nil,nil,rHINT,_text8] call RE;

	sleep 2;

};


// C130 Wreck Mission 
fn_spawnC130Mission = {

// Creating The Marker 	
_marker = createMarker ["C130",call fn_findMissionSpot];
_marker setMarkerType "Defend";
_marker setMarkerColor "ColorRed";
_marker setMarkerText "C130 Crash Site";
_marker setMarkerSize [1,1];


// Creating Vehicle & Hints 
c130wreck = createVehicle ["C130J_wreck_EP1",[(getpos _hill select 0) + 30, getpos _hill select 1,0],[], 0, "NONE"];
box = createVehicle ["USOrdnanceBox",[(getpos _hill select 0) - 10, getpos _hill select 1,0],[], 0, "NONE"];
box2 = createVehicle ["USBasicWeaponsBox",[(getpos _hill select 0) - 10, (getpos _hill select 1) - 10,0],[], 0, "NONE"];


_color = "#C5C5C5";
_name = getText (configFile >> "cfgVehicles" >> C130J >> "displayName");
_picture = getText (configFile >> "cfgVehicles" >> C130J >> "picture");

_text9 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Objective</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>This <t color='#FFCC33'>%1</t>, is your OBJECTIVE!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Get to it first!</t>",   _name, _picture, _color 
       ];

     [nil,nil,rHINT,_text9] call RE; 


//Complete Mission 
waitUntil { Player distance c130wreck < 20}; 

	deleteMarker _marker;

_text10 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Complete</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>Capture the <t color='#FFCC33'>%1</t>, has been completed!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Use The Extra Ammo To Your Advantage!</t>",   _name, _picture, _color 
       ];

       [nil,nil,rHINT,_text10] call RE;

	sleep 2;


};

// Harrier Mission 
fn_spawnHarrierMission = {

// Creating The Marker
_marker = createMarker ["LaserD", call fn_findMissionSpot];
_marker setMarkerType "mil_destroy";
_marker setMarkerColor "ColorRed";
_marker setMarkerText "Laser Designater";
_marker setMarkerSize [1,1];


//Creating the Vehicle & Hints  
_veh = ["BAF_Offroad_W","BAF_Offroad_D"] call BIS_fnc_selectRandom;

laser = createVehicle [_veh,[(getMarkerpos _marker select 0) + 30, getMarkerpos _marker select 1,0],[], 0, "NONE"];
laser setFuel 1;
clearWeaponCargo laser;
laser addWeaponCargoGlobal ["laserdesignator", 1];
laser addMagazineCargoGlobal ["laserbatteries", 1];

_color = "#C5C5C5";
_name = getText (configFile >> "cfgVehicles" >> typeOf laser >> "displayName");
_picture = getText (configFile >> "cfgVehicles" >> typeOf laser >> "picture");

_text11 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Objective</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>This <t color='#FFCC33'>%1</t>, is your OBJECTIVE!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Get to it first!</t>",   _name, _picture, _color 
       ];

     [nil,nil,rHINT,_text11] call RE; 


// Complete Mission 
waitUntil { Player distance laser < 20};

deleteMarker _marker;


_text12 = parseText format ["<t align='center' color='#f39403' shadow='1' shadowColor='#000000'>Mission Complete</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#666c3f' shadow='1' shadowColor='#000000'><t color='%3'><img size='4' image='%2'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>Capture the <t color='#FFCC33'>%1</t>, has been completed!</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'>Call The Airstrike In!</t>",   _name, _picture, _color 
       ];

       [nil,nil,rHINT,_text12] call RE; 

	sleep 2;
};

// MAIN LOGIC

_missionDetails = switch (_missionType) do {
case "arty": {call fn_spawnArtyMission;};
case "tank": {call fn_spawnTankMission;};
case "chop": {call fn_spawnTankMission;};
case "truck": {call fn_spawnTruckMission;};
case "c130wreck": {call fn_spawnTankMission;};
case "laser": {call fn_spawnHarrierMission;};

};	



nul = execVM "server\core\missions\missionfinder.sqf";

Is is called from the line above. Which the code for is...

// Select Random Mission : Credit Kyliana..

if(!isServer) exitWith {};

waituntil {!isnil "bis_fnc_init"}; //waiting

_missions = ["arty","tank","chop","truck","c130wreck","laser"]; //mission array

_choose = _missions call BIS_fnc_selectRandom; // random mission 

[_choose] execVM "server\core\missions\makemission.sqf";  //call mission

Which is called using

nul = execVM "server\core\missions\missionfinder.sqf";

Everything works great on the first run..

But as soon as it completes I am getting errors, which are below!

if (!isServer) exitWith {};

sleep (10 + (random 90));



_missionType = _t>
 Error position: <(10 + (random 90));



_missionType = _t>
 Error Missing ;
File mpmissions\Wasteland_custom1.Chernarus\server\core\missions\makemission.sqf, line 8

I have tried changing the line which it seems to be failing on, to sleep, sleep random.

If I don't put a sleep command in, it doesn't run at all, which is confusing the life out of me! Also, tried using the same lines within the missionfinder.sqf and it still comes back with the same error!

Still the same error everytime!

Anyone see anything?

Thanks

Share this post


Link to post
Share on other sites

Error Missing ;

Missing ;

Missing ;

Missing ;

;

Please read the error messages, thank you.

Share this post


Link to post
Share on other sites

I can see the error message..

I can't see the error though!

Share this post


Link to post
Share on other sites

Why not just use the hTime included in Wasteland? Does the same thing you need....

_wait = [100,10] call fnc_hTime;

sleep _wait;

100 being the highest, 10 being the lowest number that can be returned.

Edited by Tonic-_-

Share this post


Link to post
Share on other sites

I have tried that Tonic..

Still getting the same error!

Placed a post in your wasteland thread!

Share this post


Link to post
Share on other sites

Well other then that I don't see anything wrong, the original piece doesn't seem wrong either...

What i'd do is make a separate file where you are defining i.e fn_spawnHarrierMission to a separate file, call that on mission start so that those variables are defined once, instead of defining them every time... Knowing ArmA the engine can work in weird ways and those may throw up issues. I've had times where i'd scratch my head for hours at something that doesn't make sense.. Then separating things fixed the issue even though logically it doesn't make sense... Good ol' ArmA...

Edited by Tonic-_-

Share this post


Link to post
Share on other sites

The real question is, why are you defining functions in a script file that is ran multiple times? You're defining the function on each run, that defeats the purpose of a PRE-DEFINED function.

But besides that, I see no syntax errors. Generally when arma returns a missing ";" on a line it is referring to the line above it. (With no semicolon, arma recognizes this as a run-on command, thus pumping out a missing ";" error.)

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  

×