John

Detrimental weather effects script

66 posts in this topic

 

**UPDATED** Now has configuration settings for messages and other configurable options.

Hi guys, id like to share with you another script I made. What this script does is the following -

Applies effects to players based on certain weather circumstances and checks for conditions such as warm clothing, cover, fire etc.

Default settings

  • Conditions for cold are when it is between 7pm and 5am OR when it is raining beyond a factor of 0.5.
  • Players are checked for "cold" roughly every 3 minutes
  • If the player does not have Warm clothing, or is not within 50m of a building or not within 20m of a fire they would be "cold" and vulnerable to the effects
  • There are 4 values the script looks at
    • Warm: Weather or not the player is warm or not, this determines weather to apply the next value
    • - Cold: This value is applied if the player is not warm, it ranges from 0 - 1
    • - Sick: This value is boolean, true or false. If true the next value can increase
    • -Sick Value: This value ranges from 0 - 1
  • If the player is not warm, Cold will increase slowly. If the player has a cold value higher than 0 they have a chance to get sick. If the players cold value is higher then 0.3 they suffer the effects of cold the cold value will continue to increase.
    • Cold effects - Above 0.3, every 3 minutes (roughly) the player will loose 7% HP and suffer camera shaking
    • A cold value of 0-1 will give the message "You are getting cold.."
    • A cold value of 0-2 will give the message "You are starting to freeze.."
    • A cold value of 0-3 and above will give the message "You are freezing..."
  • If the player gets sick, his sick value will begin to increase, sick value will only increase while the player is not warm. 
    • sick value of 0 to 0.25 has no ill effect "You are sick.."
    • sick value of 0.25 to 0.5 will cause the player to loose 2% hp every 2-3 minutes, enable fatigue for the player and cause a camera shake. "You are very sick.."
    • sick value of 0.50 and above will cause the same affects but set fatigue to 1 (make you walk) and apply a blood effect to your screen. "You are dieing..."
    • sick value will continue to increase while the player is above 0.3 cold.
  • To get healthy - Get warm! once your cold is 0. Your sickness will start to deteriorate over time. The colder / sicker you are the longer this takes. 
    • If the player is Warm and their cold value is 0 sickness will reduce over time. 
    • Once the value of cold reaches 0 and sick Value is less than 0.25 the payer will receive the message "You are feeling better..."
  • When the following conditions are met the player will receive the message "You are healthy..."
    • Player is warm
    • Player is not sick
    • Player is not cold
    • Players health is above 90%

If users do not want messages displaying, there are configurable options in the script.

Installation -

1. Create a file called "WeatherEffects.sqf" inside this file place this code - hmm the code / spoiler things seems to be gone, so pastebin..

http://pastebin.com/963A7FED

2. At the bottom of your "InitPlayerLocal.sqf" put - [] execVM "WeatherEffects.sqf";

3. Profit

Some pictures of the warning messages -

P6Dcbgd.jpg

ft1LV9Y.jpg

 

Edited by John
  • Like 16

Share this post


Link to post
Share on other sites
Advertisement

@John I love you! 

Thanks for creating this, was actually considering to do it myself, will check it out with next release, and see what else we can put into it :rock:

Share this post


Link to post
Share on other sites

I have a new version of the script I am working on that advances the levels further -

New mechanics will be.

Value - "Cold" ranges 0 -1

Players will have a cold value that is constantly updating.

Value "Sick" 0 -1

Players will have a sick value that is constantly updating

The values will not instantly decrease based on circumstances anymore, but rather they will reduces / increase over time. 

The script will also have configurable notifcations to display such as -

"You are comfortable"

"You are getting cold"

"You are starting to freeze.."

"You are freezing"

"You are sick"

"You are very sick"

etc.. this will be able to be turned on or off as you so desire so don't freak out.

- John

  • Like 3

Share this post


Link to post
Share on other sites

Sounds pretty cool so far.. Any chance you could do a temperature system that bases off of the date in the mission sqm that could tie into all this? Could have fluctuating temperatures based off real world values that further determine how cold or hot someone gets. Introducing heat temp could be interesting. The hotter it is, the faster your thirst goes down but when it rains you dont get sick. Just some ideas!

Share this post


Link to post
Share on other sites
On 11/21/2015, 8:26:46, READTHESCROLL said:

Sounds pretty cool so far.. Any chance you could do a temperature system that bases off of the date in the mission sqm that could tie into all this? Could have fluctuating temperatures based off real world values that further determine how cold or hot someone gets. Introducing heat temp could be interesting. The hotter it is, the faster your thirst goes down but when it rains you dont get sick. Just some ideas!

I could, however, unless you are changing your mission date it would be the same all the time? I'll look into it though. I might make it configurable, tell me what dates would equal what effects, ie summer, winter, etc etc. Im from Australia which would be the minority and I can't be bothered googling your real world dates :) 

Share this post


Link to post
Share on other sites

Thanks to a friend on mine, ill be testing tonight adding "Cold Breath" coming from your character during cold conditions.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.