Jump to content
Sign in to follow this  
hogmason

spawning fuel_dump_ru1 cannot error

Recommended Posts

ok so im creating a arma composition "fuel_dump_ru1" found here

http://www.armatechsquad.com/ArmA2Class151656165165341654165165165165f/A2/Objects/compositions/#document

this is my script

 fuel_active = 1; publicvariable "fuel_active";
   [color="#FF0000"]_fuelbunker = "fuel_dump_ru1" createVehicle (getMarkerPos "fuelbase")[/color];
   _fuelbunker setDir random 290;
		_fuelbunker addeventhandler ["killed", { fuel_active = 0;publicvariable "fuel_active"; [sgt,nil,rgroupChat,"Enemy fuel has been destroyed"] call RE;}];
           _fuelbunker setVehicleInit "_fuelbunker addEventHandler [""HandleDamage"",{(_this select 4) == ""PipeBomb""}]" ;format ["%1 = this; this setVehicleVarName ""%1""",_fuelbunker];
           processInitCommands;	


however i am getting this error in my rpt

Cannot create non-ai vehicle fuel_dump_ru1,

Share this post


Link to post
Share on other sites

Bit off-topic, but since I see that you write a lot of scripts and ask many questions I would recommend you to read this article: Code Optimisation, I'm sure you will find lots of interesting info there, especially since I see that you use old createVehicle command instead of createVehicle array. Quote from article:

It is highly recommended to use a standard of createVehicle array rather than the older (deprecated version) createVehicle. It is up to 500x faster than its older brother.

Share this post


Link to post
Share on other sites

thanks Samatra ill read that one ;)

any way ive just spent the past 3 hours stuck on this issue.

My code just isnt working and i have no idea why

this is the piece of code im using to spawn the composition base

_fuelMARKERposition = ["E_Patrol", false, ["safezone"]] call SHK_pos;
_createfuelmarker = createmarker ["fuelbase", _fuelMARKERposition];
_createfuelmarker setMarkerType "Dot";
_createfuelmarker setMarkerColor "ColorRed";
_createfuelmarker setMarkerAlpha 0;
_createfuelmarker setMarkerDir 90;

_position = getmarkerpos "fuelbase";
_directionfuel = getDir _createfuelmarker;
//spawn bunker to spawn fuel guns around
   _fuelbunker = [_position, _directionfuel, "fuel_dump_ru1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

now this is the full code

if (isServer) then {

if (isnil "fuel_active") then {fuel_active = 0;};

waituntil {!isnil "bis_fnc_init"};

_r = random 360;
_d = 30; //distance for defence line
_distance = 40; //distance for barb wire line

//create the east group	
_fuelmen = createGroup east;


_fuelMARKERposition = ["E_Patrol", false, ["safezone"]] call SHK_pos;
_createfuelmarker = createmarker ["fuelbase", _fuelMARKERposition];
_createfuelmarker setMarkerType "Dot";
_createfuelmarker setMarkerColor "ColorRed";
_createfuelmarker setMarkerAlpha 0;
_createfuelmarker setMarkerDir 90;

_position = getmarkerpos "fuelbase";
_directionfuel = getDir _createfuelmarker;
//spawn bunker to spawn fuel guns around
 fuel_active = 1; publicvariable "fuel_active";
   _fuelbunker = [_position, _directionfuel, "fuel_dump_ru1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));	
   //_fuelbunker setDir random 290;
		//_fuelbunker addeventhandler ["killed", { fuel_active = 0;publicvariable "fuel_active"; [sgt,nil,rgroupChat,"Enemy fuel has been destroyed"] call RE;}];
           //_fuelbunker setVehicleInit "_fuelbunker addEventHandler [""HandleDamage"",{(_this select 4) == ""PipeBomb""}]" ;format ["%1 = this; this setVehicleVarName ""%1""",_fuelbunker];
           //processInitCommands;	

//spawn fuelguns
			//_fueldefences = "GUE_WarfareBMGNest_PK" createVehicle [((getpos _fuelbunker) select 0) + sin 360 *_d, ((getpos _fuelbunker) select 1) + cos 360 *_d, 0];
			_fueldefences0 = "GUE_WarfareBMGNest_PK" createVehicle [((getpos _fuelbunker) select 0) + sin 300 *_d, ((getpos _fuelbunker) select 1) + cos 300 *_d, 0];
			_fueldefences0 setdir 300;	

			_fueldefences1 = "GUE_WarfareBMGNest_PK" createVehicle [((getpos _fuelbunker) select 0) + sin 240 *_d, ((getpos _fuelbunker) select 1) + cos 240 *_d, 0];
			_fueldefences1 setdir 240;	

			_fueldefences2 = "GUE_WarfareBMGNest_PK" createVehicle [((getpos _fuelbunker) select 0) + sin 180 *_d, ((getpos _fuelbunker) select 1) + cos 180 *_d, 0];
			_fueldefences2 setdir 180;	

			_fueldefences3 = "GUE_WarfareBMGNest_PK" createVehicle [((getpos _fuelbunker) select 0) + sin 120 *_d, ((getpos _fuelbunker) select 1) + cos 120 *_d, 0];
			_fueldefences3 setdir 120;	

			_fueldefences4 = "GUE_WarfareBMGNest_PK" createVehicle [((getpos _fuelbunker) select 0) + sin 60 *_d, ((getpos _fuelbunker) select 1) + cos 60 *_d, 0];
			_fueldefences4 setdir 60;	

			//create bunkers
			_fuelbunker1 = "Land_fortified_nest_small_EP1" createVehicle [((getpos _fuelbunker) select 0) + sin 320 *_d, ((getpos _fuelbunker) select 1) + cos 320 *_d, 0];	 
			_fuelbunker1 setdir 160;

			_fuelbunker2 = "Land_fortified_nest_small_EP1" createVehicle [((getpos _fuelbunker) select 0) + sin 250 *_d, ((getpos _fuelbunker) select 1) + cos 250 *_d, 0];	 
			_fuelbunker2 setdir 90;	

			_fuelbunker3 = "Land_fortified_nest_small_EP1" createVehicle [((getpos _fuelbunker) select 0) + sin 40 *_d, ((getpos _fuelbunker) select 1) + cos 40 *_d, 0];	 
			_fuelbunker3 setdir 220;	

			_fuelbunker4 = "Land_fortified_nest_small_EP1" createVehicle [((getpos _fuelbunker) select 0) + sin 92 *_d, ((getpos _fuelbunker) select 1) + cos 92 *_d, 0];	 
			_fuelbunker4 setdir 280;

			_fuelbunker5 = "Land_fortified_nest_small_EP1" createVehicle [((getpos _fuelbunker) select 0) + sin 140 *_d, ((getpos _fuelbunker) select 1) + cos 140 *_d, 0];	 
			_fuelbunker5 setdir 320;

			// Now the Wire line
            	_fuelwiredef1 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 240 *_distance, ((getpos _fuelbunker) select 1) + cos 240 *_distance, 0];	publicVariable "_wiredef1";
			_fuelwiredef1 setdir 240;	

			_fuelwiredef2 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 180 *_distance, ((getpos _fuelbunker) select 1) + cos 180 *_distance, 0];	publicVariable "_wiredef2";
			_fuelwiredef2 setdir 180;	

			_fuelwiredef3 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 120 *_distance, ((getpos _fuelbunker) select 1) + cos 120 *_distance, 0];publicVariable "_wiredef3";
			_fuelwiredef3 setdir 120;	

			_fuelwiredef4 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 60 *_distance, ((getpos _fuelbunker) select 1) + cos 60 *_distance, 0];	publicVariable "_wiredef4";
			_fuelwiredef4 setdir 60;	

			//create bunkers
			_fuelwiredef1 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 320 *_distance, ((getpos _fuelbunker) select 1) + cos 320 *_distance, 0];	publicVariable "_wiredef1";
			_fuelwiredef1 setdir 160;

			_fuelwiredef2 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 250 *_distance, ((getpos _fuelbunker) select 1) + cos 250 *_distance, 0];	publicVariable "_wiredef2";
			_fuelwiredef2 setdir 90;	

			_fuelwiredef3 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 40 *_distance, ((getpos _fuelbunker) select 1) + cos 40 *_distance, 0];	publicVariable "_wiredef3";
			_fuelwiredef3 setdir 220;	

			_fuelwiredef4 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 92 *_distance, ((getpos _fuelbunker) select 1) + cos 92 *_distance, 0];	publicVariable "_wiredef4";
			_fuelwiredef4 setdir 280;

			_fuelwiredef5 = "Fort_RazorWire" createVehicle [((getpos _fuelbunker) select 0) + sin 140 *_distance, ((getpos _fuelbunker) select 1) + cos 140 *_distance, 0];	publicVariable "_wiredef5";
			_fuelwiredef5 setdir 320;

              sleep 5;
           _upsgrp6 = [1,getmarkerpos "fuelbase",1,["fuelbase","spawned","fortify","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";
	       sleep 0.3;


   //Set the skills		
     {_x setSkill ["aimingAccuracy",0.65]} forEach units _fuelmen;
     {_x setSkill ["aimingShake",0.65]} forEach units _fuelmen;
     {_x setSkill ["aimingSpeed",0.65]} forEach units _fuelmen;
     {_x setSkill ["endurance",0.85]} forEach units _fuelmen;
     {_x setSkill ["spotDistance",0.99]} forEach units _fuelmen;
     {_x setSkill ["spotTime",0.85]} forEach units _fuelmen;
     {_x setSkill ["courage",0.85]} forEach units _fuelmen;
     {_x setSkill ["reloadSpeed",0.85]} forEach units _fuelmen;
     {_x setSkill ["commanding",0.85]} forEach units _fuelmen;
     {_x setSkill ["general",0.85]} forEach units _fuelmen;


  //Set up The DEBUG
      if (HOG_debug) then {
               [sgt,nil,rgroupChat,"Spawning fuel Base Debug ON."] call RE;                
               fueldebug = {

                   _fuelbase = _this select 0; 

				 [sgt,nil,rgroupChat,"Creating fuel Base Debug Markers."] call RE;

				 _fuelmarker = createMarker[str(_fuelbase),position _fuelbase]; str(_fuelbase) setMarkerType "mil_box"; str(_fuelbase) setMarkerColor "ColorRed"; str(_fuelbase) setMarkerText "fuelbase";
				sleep 0.2;
				[sgt,nil,rgroupChat,"fuel Base Debug Finished."] call RE; 
                   };

                   _handlerr = [_fuelbunker] spawn fueldebug;

      };	  


this is the error

Error in expression <GUE_WarfareBMGNest_PK" createVehicle [((getpos _campbunker) select 0) + sin 300 >
 Error position: <getpos _campbunker) select 0) + sin 300 >
 Error getpos: Type Array, expected Object,Location
File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_V_3.Chernarus\missions\spawners\Targets\camp_base.sqf, line 35


now that piece of code its telling me has an error DOESNT it works fine if i am spawning anything but a composition base.

also if i un // the addeventhandler and vehicle init part i get this error

Error in expression <cripts\objectMapper.sqf"));
_campbunker addeventhandler ["killed", { camp_active>
 Error position: <addeventhandler ["killed", { camp_active>
 Error addeventhandler: Type Array, expected Object
File C:\Users\natho\Documents\ArmA 2 Other Profiles\=Mason=\missions\Operation_HOG_V_3.Chernarus\missions\spawners\Targets\camp_base.sqf, line 25


p.s i know its a different variable name its from another script everything the same but different composition base.

Does any 1 know what is wrong

Share this post


Link to post
Share on other sites

Have you tried to dump what your _fuelbunker contains? Try

diag_log _fuelbunker;

and look into your RPT. When you place composition, it returns array with all composition objects. You can't attach EHs to arrays just like error states.

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  

×