Jump to content

Recommended Posts

I was just writing a simple wind speed indicator to be trigger right when you get near the halo. Seems that it always returns the same value (2.1). I am using a random weather script and the wind is definitely changing. Should I be using something different other then _windSpeed = vectorMagnitude wind; ?

 

Thanks,

dubl

/************************************************************************
Wind Speed indicator

**********************************************************************/
private["_windSpeed","_color"];


fn_WindSpeed_Message ={

    params["_Speed", "_txtcolor" ];

    _Speed = _this select 0;
    _txtcolor = _this select 1;
    //display message
    hint parseText format[ "Current Wind Speed:<br /><t color='%2' size='2'>%1</t><br />", _windSpeed, _color ];

};

_windSpeed = vectorMagnitude wind; //get wind speed

switch (true) do
    {
    
    case (_windSpeed > 10):{_color = "#EDED00";};//Yellow
    case (_windSpeed > 15):{_color = "#EDED00";};//Red
    default {_color = "#38DB0B";};//Green
    };
            
//call the function
[ _windSpeed, _color ] call fn_WindSpeed_Message;


Share this post


Link to post
Share on other sites

Not sure about the actual question here, however, within the function, on format, shouldn't you be using _Speed, as opposed to _windSpeed?

Share this post


Link to post
Share on other sites

Question is: Why is the _windSpeed always the same value of 2.1? 

 

The wind is definitely changing since the wind at times is pulling me all around during the jump.

/************************************************************************
Wind Speed indicator

**********************************************************************/
private["_windSpeed","_color"];


fn_WindSpeed_Message ={

    params["_windSpeed", "_color" ];

    _Speed = _this select 0;
    _txtcolor = _this select 1;
    //display message
    hint parseText format[ "Current Wind Speed:<br /><t color='%2' size='2'>%1</t><br />", _windSpeed, _color ];

};

_windSpeed = vectorMagnitude wind; //get wind speed

switch (true) do
    {
    
    case (_windSpeed > 10):{_color = "#EDED00";};//Yellow
    case (_windSpeed > 15):{_color = "#EDED00";};//Red
    default {_color = "#38DB0B";};//Green
    };
            
//call the function
[ _windSpeed, _color ] call fn_WindSpeed_Message;

Share this post


Link to post
Share on other sites

Not sure about the actual question here, however, within the function, on format, shouldn't you be using _Speed, as opposed to _windSpeed?

Yes! sorry did not see that! thanks. I guess it comes down to this. What is the best way to get the current wind speed? Use the below or some other way?

_windSpeed = vectorMagnitude wind;

OR

_windSpeed = wind call BIS_fnc_vectorMagnitude; 

Share this post


Link to post
Share on other sites

I guess I was up too late playing! It did not dawn on me till just now. I was only calling once on mission start, which is apparently 2.1. I added to the trigger and it is working and walked in out a few times and seems good. Sorry for wasting anyone's time.

  • Like 1

Share this post


Link to post
Share on other sites

Here it is in case someone wants it.

/************************************************************************
Wind Speed Indicator
thedubl 
2016-01-16
**********************************************************************/
private["_windSpeed","_color"];


fn_WindSpeed_Message ={

    params["_Speed", "_txtcolor" ];

    _Speed = _this select 0;
    _txtcolor = _this select 1;
    //display message
    hint parseText format[ "Current Wind Speed:<br /><t color='%2' size='2'>%1</t><br />", _Speed, _txtcolor ];

};

_windSpeed = vectorMagnitude wind; //get wind speed
_windSpeed  = round(_windSpeed * (10 ^ 1)) / (10 ^ 1);

switch (true) do
    {
    
    case (_windSpeed > 10):{_color = "#EDED00";};//Yellow
    case (_windSpeed > 15):{_color = "#EDED00";};//Red
    default {_color = "#38DB0B";};//Green
    };
            
//call the function
[ _windSpeed, _color ] call fn_WindSpeed_Message;

Share this post


Link to post
Share on other sites

Updated. Includes direction and some simple instructions. I put this together since people were trying to halo in high winds to their deaths. Now, the player can blame no one if they know the speed. Hope it helps someone else out.

 

Here is a link to the directional info.

 

dubl 

/*************************************************************************************************
Wind Speed Indicator
dubl 
1/18/2016

--Was setup for people not know wind speed and trying to halo. 
  Could be an add action or trigger near halo

Setup:
for trigger
  --if trigger and you do not want to broadcast the message to everyone 
    place, "player in thislist" replacing "this"

for action
  -- add below to initplayerLocal
//add action
[[player,[("<t color=""#ff8000"">" + ("Check Wind Speed") + "</t>"),{_this execVM "scripts\windSpeed.sqf"},[player],0,false,true, "",'player ==_target']],"addAction",true,true,false] call BIS_fnc_MP;
//re-add if player dies  
 player addEventHandler
[
	"respawn",
	{
	  windspeed = [[player,[("<t color=""#ff8000"">" + ("Check Wind Speed") + "</t>"),{_this execVM "scripts\windSpeed.sqf"},[player],0,false,true, "",'player ==_target']],"addAction",true,true,false] call BIS_fnc_MP;
	}
];

*********************************************************************************************************/
private["_windSpeed","_windDir","_color"];

_player = _this select 0;


fn_WindSpeed_Message ={

    params["_Speed","_direction","_txtcolor"];

    _Speed = _this select 0;
    _direction = _this select 1;
    _txtcolor = _this select 2;

  //display message
  hint parseText format[ "Current Wind Speed:<br /><t color='%3' size='2'>%2 </t><t color='%3' size='2'>%1</t><t color='%3' size='2'>kph</t>", _Speed,_direction,_txtcolor ];

};

_windSpeed = vectorMagnitude wind; //get wind speed
_windSpeed  = round(_windSpeed * (10 ^ 1)) / (10 ^ 1);

//wind Direction
switch (true)do
    {
    case (windDir >= 348.75 && windDir <= 11.25):{_windDir = "N"};
    case (windDir >= 11.25 && windDir <= 33.75):{_windDir = "NNE"};
    case (windDir >= 33.75 && windDir <= 56.25):{_windDir = "NE"};
    case (windDir >= 56.25 && windDir <= 78.75):{_windDir = "ENE"};
    case (windDir >= 78.75 && windDir <= 101.25):{_windDir = "E"};
    case (windDir >= 101.25 && windDir <= 123.75):{_windDir = "ESE"};
    case (windDir >= 123.75 && windDir <= 146.25):{_windDir = "SE"};
    case (windDir >= 146.25 && windDir <= 168.75):{_windDir = "SSE"};
    case (windDir >= 168.75 && windDir <= 191.25):{_windDir = "S"};
    case (windDir >= 191.25 && windDir <= 213.75):{_windDir = "SSW"};
    case (windDir >= 213.75 && windDir <= 236.25):{_windDir = "SW"};
    case (windDir >= 236.25 && windDir <= 258.75):{_windDir = "WSW"};
    case (windDir >= 258.75 && windDir <= 281.25):{_windDir = "W"};
    case (windDir >= 281.25 && windDir <= 303.75):{_windDir = "WNW"};		
    case (windDir >= 303.75 && windDir <= 326.25):{_windDir = "NW"};
    case (windDir >= 326.25 && windDir <= 348.75):{_windDir = "NNW"};	
    default {_windDir = " ";};
    };


//color based on speed
switch (true) do
    {
    case (_windSpeed > 8):{_color = "#ff0000";};//Red
    case (_windSpeed > 5):{_color = "#EDED00";};//Yellow
    default {_color = "#38DB0B";};//Green
    };
            
//call the function
[ _windSpeed,_windDir,_color] call fn_WindSpeed_Message;

Share this post


Link to post
Share on other sites

1 - the case (windDir >= 348.75 && windDir <= 11.25):{_windDir = "N"};  can't work. You see why? You have to check between 0 and 11.25 , and 348.75 and 360

2 - You do the same mistake as BI devs: A North (East) wind is blowing from N (E) , not to N (E)
3 - As magicsrp said, your wind is in m/s

4 - wind is supposed to change (see smoke). Make a loop.

Share this post


Link to post
Share on other sites

doesn't wind also change with each weather simulation cycle?

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

×