Jump to content
Sign in to follow this  
Gonobob

setvariable on item spawned into WeaponHolder

Recommended Posts

Hi all

i have a big trouble with 'setvariable on item spawned into WeaponHolder'

my script(only on server-side)

#define _locStart1 [13495.3,4470.54,0.001]

_itemBible = "ItemBookBible";
_isSpawned = 0;


while {true} do {
_date = date;

     If ( _isSpawned == 0 ) then {
         	_qPack = createVehicle ["WeaponHolder", _locStart1, [], 0, "NONE"];
	_qPack addMagazineCargoGlobal ["ItemBookBible",1];
               _isSpawned = 1;
	_result = getMagazineCargo _qPack;

               {

		if ((_x select 0)  == _itemBible) then 
		{
			_iBible = _x select 0;
			_iBible setVariable ["spawned", _date, true];
			//_var = _x getVariable ["spawned",-1];
			diag_log "_x2";
		};

	} foreach _result;
    };
};

i have an error with _x(it is STRING type), but setvariable only on OBJECT i think

Can anyone help with this?

Or may be need another way to do this

Thanks (sorry for bad english)

Share this post


Link to post
Share on other sites

Getmagazinecargo returns an array of the classnames of the magazines, and you are taking a classname of one magazine and trying to use servariable on it. So you are doing something like

"Hello" servariable....

You can only setvariable on objects(that incudes vehicles, units, and a few other types)

Edited by columdrum

Share this post


Link to post
Share on other sites

ok, and how can i spawn item (without createVehicle) and setvariable on it?

Share this post


Link to post
Share on other sites

If by items you mean magazines or weapons, those aren't accesible objects, and as i said, there is simply no way to setvariable on them since you can only acces. There You can do a setvariable on the weaponholder though.

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  

×