Forum Jump :

Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name: [USSWC] Gen.AustinAtSt

 
#1 Posted at 2013-12-09 04:27        
     
So the script im trying to work on will dynamically change a player's viewDistance depending on a player's proximity to a city. By doing this, ill keep optimization very high on my mission that has a lot of elements involved. And since a player's viewdistance is limited naturally within a city, they won't notice.

Heres what i have so far:

// nul = [this] execVM "viewDistance.sqf";  <- Player init
//Cities are Gamelogics

private ["_player","_viewD","_Cities","_i","_SelectCities","_dist"];

_player = _this select 0;
_ViewD =  viewDistance;


_Cities = [Olympus,Pyrgos];

//ViewDistance for each city
while {alive _player} do {

	for [{_i=0},{_i < (count _Cities)},{_i=_i+1}] do {
		_SelectCities = _Cities select 0;
		_dist = _player distance _SelectCities;
		{
			if (_dist > 150) then {setViewDistance 2000;};
			if (_dist < 150) then {setViewDistance 1500;};
			if (_dist < 100) then {setViewDistance 1000;};
			if (_dist < 50) then {setViewDistance 500;};
			if (_dist < 25) then {setViewDistance 300;};
			
		}forEach _Cities;	
	};
	
	sleep 1;
};


Now this only half works, and the view distance keeps jumping because the other cities are interfering. But with only one city involved, there is no problem, there just isnt a smooth transition.

Questions:
(A) How can i stop the "jumping" of viewdistances, and localize one city at a time.
(B) Is there a way to smoothly transition the viewdistances so that the changes are almost seamless?
(C) And is there a way to factor in a players height? So that if a player is above the skyline, they can see further out of the city?


Author Message


Posts: 685
Rank:


Level: Member

Country: nl
Location: Amsterdam
Occupation: IT nerd
Age: 41
In-game name: -=XTRA=-Larsiano

 
#2 Posted at 2013-12-09 14:23        
     
Smart thinking! This idea has been in my mind for a while so it’s good to see someone working on _this. To make it smoother maybe you can add more "in-between _proximity A > B" viewdistance changes to gradually change the viewdistance in compare to an on/off switch. If your really great with math and remembered all them logarithmic functions you can use that to make it more dynamic *HI*

What comes to mind is that it can be also possible to add the script to the town instead of the unit > The closer you come to _cities the more the viewdistance is reduced ( for each _unit). Only then either the script must be compatible with all towns or all towns must have their own "initiation"?


Advertisement


Author Message


Posts: 13
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name: [USSWC] Gen.AustinAtSt

 
#3 Posted at 2013-12-09 17:50        
     
# -=XTRA=-Larsiano : What comes to mind is that it can be also possible to add the script to the town instead of the unit


Im gonna try this method and report back. I was just thinking this last night!


-Edit: No such luck. Gonna try to continue with executing from the player =/

This post was edited by AustinAtSt (2013-12-09 18:20, ago)