Jump to content
Sign in to follow this  
NeoPixie

Script course game to crash ONLY on altis..

Recommended Posts

Hey guys, this following script only courses the game to crash while in Altis and i can't seem to figure out why?

any ideas?

buyVehicle_ToClient = objNull;
buyVehicle_ToServer = [];

fn_BuyVehicle =
{	_nearVehicles = nearestObjects [player,['AllVehicles'],5];
if(count _nearVehicles == 0) exitWith 
	{
		closeDialog 0;
		hintSilent 'No vehicle nearby';
		playSound 'error';
	};

{
	if((!((typeOf _x) in vehicleClassMaster))) then {_nearVehicles = _nearVehicles - [_x];}
} forEach _nearVehicles;
if(count _nearVehicles == 0) exitWith 
{
	closeDialog 0;
	hintSilent 'No vehicle nearby'; 
	playSound 'error';
};


{if(_x getVariable 'hidden' == 1) then {_nearVehicles = _nearVehicles - [_x];};} forEach _nearVehicles;
if(count _nearVehicles == 0) exitWith 
{
	closeDialog 0;
	hintSilent 'No vehicle nearby'; 
	playSound 'error';
};


_nearVehicle = _nearVehicles select 0;
_forSale = _nearVehicle getVariable ['masterArrayInfo',nil];
if(isNil '_forSale') exitWith 
{
	closeDialog 0;
	hintSilent 'No vehicle nearby'; 
	playSound 'error';
};

_cost = [_nearVehicle,1] call fn_Cost;
_purchase = [_cost,(_nearVehicle getVariable 'masterArrayInfo')] call fn_Purchase;
if(_purchase select 0) then
{
	titleText ['','BLACK OUT',0.8];
	_masterArrayInfo = _nearVehicle getVariable 'masterArrayInfo';
	sleep 1;
	player setPos (position playerAwayLogic);
	playSound 'carDoor';
	_pos = position _nearVehicle;
	_dir = direction _nearVehicle;
	buyVehicle_ToServer = [_nearVehicle,_pos,_dir,player];
	publicVariableServer "buyVehicle_ToServer";
	//[[_nearVehicle,_pos,_dir,player],"fn_BuyVehicleServer",isServer,false] spawn BIS_fnc_MP;
};
};


fn_BuyVehicleReturn =
{
_veh = _this select 0;
player moveInDriver _veh;
_policeVeh = _veh getVariable ['policeVeh',false];
_color = _veh getVariable ['color',nil];
if(_policeVeh) then 
{
	if(!isNil "_color") then {[_veh,_color] call fn_PoliceTruck;};
};
_veh setVariable ["trunk",[],true];
_veh allowDamage true;
player allowDamage true;
sleep 0.1;
titleText ['','BLACK IN',0.8];
if(_veh getVariable ["policeVeh",false]) then
{
	[_veh] spawn fn_PoliceRadioLoop;
};

_veh setVariable ["coOwners",[],true];
};

"buyVehicle_ToClient" addPublicVariableEventHandler {[(_this select 1)] spawn fn_BuyVehicleReturn};

buyVehReady = 1;

Share this post


Link to post
Share on other sites

Have you tried checking your RPT file and run with scripting errors showing, it might come up on screen before the crash or be in the RPTfile.

Share this post


Link to post
Share on other sites

I am getting the same problem. Scripts run perfect on Stratis and crash on Altis. The scripts are exactly the same. I have gone over everything I can possibly think of over and over, and still cannot find out why.

Share this post


Link to post
Share on other sites

One of my scripts (fillHouse) has the exact same problem.. Can't find any similarities to your script, so I'm starting to believe the problem is not script related. :/

We both use nearestObjects, but in the other hand it works fine in my other scripts..

Share this post


Link to post
Share on other sites

I think Bohemia might have accidentally broken something i receive an error about _threatMaxRadius although this isn't even in my code anywhere. what makes me thing the issue is all Bohemia related.

Share this post


Link to post
Share on other sites
I think Bohemia might have accidentally broken something i receive an error about _threatMaxRadius although this isn't even in my code anywhere. what makes me thing the issue is all Bohemia related.

and

One of my scripts (fillHouse) has the exact same problem.. Can't find any similarities to your script, so I'm starting to believe the problem is not script related. :/

We both use nearestObjects, but in the other hand it works fine in my other scripts..

voila! you've found the culprit!

----------------------------------------

edit: I think both of you (yep, the game engine really) have a problem with maximum objects scan range.

Edited by Zatan13th

Share this post


Link to post
Share on other sites

Was curious so changed it to JUST

fn_BuyVehicle =
{	_nearVehicles = nearestObjects [player,['AllVehicles'],1];
if(count _nearVehicles == 0) exitWith 
	{
		closeDialog 0;
		hintSilent 'No vehicle nearby';
		playSound 'error';
	};
};

So only a radius of 1 to the player and still crashes, really starting to annoy me that there isn't actually any fix

Share this post


Link to post
Share on other sites
Was curious so changed it to JUST

fn_BuyVehicle =
{	_nearVehicles = nearestObjects [player,['AllVehicles'],1];
if(count _nearVehicles == 0) exitWith 
	{
		closeDialog 0;
		hintSilent 'No vehicle nearby';
		playSound 'error';
	};
};

So only a radius of 1 to the player and still crashes, really starting to annoy me that there isn't actually any fix

Have you ever try "AllMissionObjects" command?

Thus, "Allvehicles" <-- I think it is too broad, you should be more specific.

Anyway, I do agree with "nearestObjects" may be broken in Altis.

Edited by Zatan13th

Share this post


Link to post
Share on other sites

I'm not getting crashes. Working fine on Altis and Stratis.

Also count of nearestObjects AllVehicles is always going to be 1 count since the player counts, so you'll never get 0.

Edited by kylania

Share this post


Link to post
Share on other sites
I think Bohemia might have accidentally broken something i receive an error about _threatMaxRadius although this isn't even in my code anywhere. what makes me thing the issue is all Bohemia related.

_threatMaxRadius is a creature variable. Whether that helps you narrow anything down.

Share this post


Link to post
Share on other sites

If you are getting a crash, it is quite unlikely to have anything to do with the specific script. Even if it does, it is most likely a bug with the game and not with the script.

Share this post


Link to post
Share on other sites

I tried changing that, what makes me think its oblivious nearObjects that is i disabled the initialization of the script and the mission loads completely fine. Only issue is that my current mission requires it to work =/

Share this post


Link to post
Share on other sites

im having same issue with (nearestobjects and nearestBuilding) commands when searching for buildings in my case. if I leave this out, the mission starts fine just like it has on stratis since alpha stage. whats strange is that some people can run this code and not have an issue. I gave my code to my friend and he was able to run it on altis with no issue what so ever when it would lockup my pc. very strange issue.

Share this post


Link to post
Share on other sites

is it actually crashing, or just apparently freezing? (yet to see anyones rpt...). any function that involves searching distances on the map, will potentially take a long time to execute on a map as large as altis. i ran into this using findEmptyPosition...altis would take almost a minute load just trying to find a place for a heli...

Share this post


Link to post
Share on other sites

Same here and its for a script with nearestObjects too.

Works fine in Stratis, when I try it on Altis, the game just locks up on the mission loading screen, no visible errors in the RPT.

I then have to start task manager and kill the .exe process.

Share this post


Link to post
Share on other sites

those using nearestObjects - try just letting it sit through the 'freeze' and time it.

really, let it sit for like 5 minutes....ill bet it starts right up after a lengthy wait

Share this post


Link to post
Share on other sites

How does nearestObjects actually work? As it still freezes if radius is set to like 1. Will it still check every object on map, regardless of the radius?

Share this post


Link to post
Share on other sites

Well judging by what has happened to our Clans Edited version of our mission this sounds a very viable cause for a lot of our issues. It seems that anything that carries out a calculation based on counting items or constantly checking for sizes is causing total lock ups, and nearest objects is one of many used within our mission.

We have tested on all types of Server, dedicated via a 3rd party, our own dedicated server (from my machine using a 3rd party program) and also via Arma3 and hosted on the net. All of these have the same issue of what seems to be a massive memory overload causing the players to desync and the server to stall. Whilst on my own dedi we carried out monitoring using a cpu usage and memory monitor, logging the amount of memory being used as best as we could, as each program loaded in to the memory. At a point of no return it showed that the server had locked visually, with ai running on the spot and the 3rd party server monitoring server just stopped. Although the player himself was still able to run freely. it was clear when entering vehicles there was a massive issue, as you were unable to get in and then some minutes later although you were technically doing something else, you would appear in the vehicle you had tried to get in.

During this the server monitor would sometimes show a reading, but most of the time the gaps were between 5-10 minutes at a time, if and only if the server would be able to recover at best did it show a few readings then went back into the process of stalling again. After reading this post it does point to the thought of the mission being stuck in a loop looking or perhaps counting something with infinite results and a massive drain on process to the memory. The maximum memory allocation was seeming to be reach and then in a vain effort both the relative system would try to offload the actual Ram into the page file, but watching it clearly showed that it was in vain as the ram was writing more than it could shift to the page file, thus causing the whole lot to stall.

During all of this anyone even attempting to join the server would stall in any of the screens from joining to playing, some actually seeing no server to join whilst clearly others were in and playing, although being in a state of stall.

Any relevant feedback on this would be appreciated.

Share this post


Link to post
Share on other sites

I would REALLY hope that nearestObjects doesn't scan the whole map for stuff... thats a kinda stupid choice of design for it. Great way to eat a load of memory and cause lots of issues trying to carry out that task on a map as big as Altis that could somewhat easily be done in a much more efficient way. I think it's time for a feedback ticket as I don't think any devs have seen this topic yet... Also, the problem in the first post is that the entire game process crashes after trying to load in the map using nearestObjects. Server RPT spits out no errors either. No errors anywhere, nothing.

Share this post


Link to post
Share on other sites

Yes its exactly that and oops i forgot to add that bit too. I have spent nigh on 4 days of my holiday trying to work out this problem with no errors or inclination of what is causing it as all of my rpts have been squeaky clean.

Share this post


Link to post
Share on other sites

Well it seems the command works fine in a script all by itself and inside a units init box in the editor no problem. Maybe its just the way people are using it thats worng... Would be awesome to have a dev come and sort this out... Regardless it should never be crashing the game back to the desktop... I'm also running on dev build... soooo

Edited by austin_medic

Share this post


Link to post
Share on other sites

tested like austin said and it works to an extend but still, this needs to be sorted by bohemia

Share this post


Link to post
Share on other sites
Well it seems the command works fine in a script all by itself and inside a units init box in the editor no problem. Maybe its just the way people are using it thats worng... Would be awesome to have a dev come and sort this out... Regardless it should never be crashing the game back to the desktop... I'm also running on dev build... soooo

How do you mean by itself?

Are you running locally or server side?

Share this post


Link to post
Share on other sites

I've notice it does it very randomly I used a simple nearobjects to detect units on a different mission and it worked fine, restarted and it caused a crash. very weird!

edit: Skinkicker I've done both server side and locally it will both make the client crash

Share this post


Link to post
Share on other sites

Using nearObjects and nearestObjects with no problems here. Has anyone actually submitted a repro to the devs yet?

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  

×