Forum Jump :

Author Message


Posts: 105
Rank:


Level: Member

Country: us
Location:
Occupation: Marine
Age:
In-game name: shadowmarine578

 
#1 Posted at 2014-07-30 17:07        
     
need some help with setting the object name after spawning a vehicle by script. i have tried several different ways to do this but keep messing up. does any one know how to get the setVehicleVarName command to work.

this is the script i am useing.
openMap [true, false];
	Visable_Marker_mapclick = false;
	onMapSingleClick "Visable_Marker_clickpos = _pos; Visable_Marker_mapclick = true; onMapSingleClick ''; true;";
	waitUntil {Visable_Marker_mapclick or !(visiblemap)};
	if (!visibleMap) exitwith {
	systemChat "map marker cancelled.";
	breakOut "main";
	};
	_pos = Visable_Marker_clickpos;
	Visable_Marker_mapclick = if(true) then{  
	call compile format ['
	mkr_Marked = createmarker ["mkr_Marked", Visable_Marker_Clickpos];
	"mkr_Marked" setMarkerTypeLocal "mil_join";
	"mkr_Marked" setMarkerColorLocal "ColorBlue";
	"mkr_Marked" setMarkerTextLocal "Rally Point";'];
};
sleep 1;
_Rally_Marker_Spawn = _this select 0;
_iniVeh = _this select 1;
_Rally_Marker = _this select 2;

_Rally_Marker_Spawn = creategroup WEST;
_Rally_Marker = [getMarkerPos "mkr_Marked", 0, "Land_runway_edgelight_blue_F", _Rally_Marker_Spawn] call BIS_fnc_spawnVehicle;
_Rally_Marker = _iniVeh;
_iniVeh setVehicleVarName _Rally_Marker;
_iniveh SetVehicleVarName _name;
call compile format["%1 = _veh", _name];
_iniVeh = _Rally_Marker;
systemChat "Rally Point named.";
systemChat "Rally Point Ground/Map Marker placed.";
systemChat "closing map.";
openMap false;
sleep 3;
hintsilent "";
sleep 1;

if (true) exitWith {};
///Visable_Map_Marker_Test.sqf

Ok this is what works it does spawn the vehicle with no problem but the setVehicleVarName is not working not sure if i am using it the right way.

the reason i need the object or vehicle created to have an id name is so i can delete it later with another script other wise i have 100 of the objects on the map serving no purpose.


Author Message


Posts: 317
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name: BrotherhoodOfHam

 
#2 Posted at 2014-07-31 12:31        
     
The name parameter for setVehicleVarName has to be a string. You are passing an object as the parameter instead.
_Rally_Marker = [getMarkerPos "mkr_Marked", 0, "Land_runway_edgelight_blue_F", _Rally_Marker_Spawn] call BIS_fnc_spawnVehicle;
_Rally_Marker = _iniVeh;
_iniVeh setVehicleVarName _Rally_Marker;
You could try replacing the last bit with:
_iniVeh setVehicleVarName (str _Rally_Marker);

Although I am not sure what the bit after that is supposed to do:
_iniveh SetVehicleVarName _name;
Where did this _name variable come from?

Also I think your code needs some tidying up ;-)

EDIT:
Also I PM'd you

This post was edited by BrotherhoodOfHam (2014-07-31 18:08, ago)

Some delicious stuff:
3D marker script
Some WIP delicious stuff:
Modular Customization Interface