Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Updated thread] Need help
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#91
RE: [Updated thread] Need help

Your AddTimers end up stacking, since your timer checks each if-statement, and say, your health and sanity are 100, then the code adds two AmountOfHealth timers. Then 3 seconds later, they both execute, and once again, adds 2 timers but does so twice because the two AmountOfHealth timers run, four timers run next time, etc.

So what we do, is we remove all the AddTimers, except one which will execute at the end of the whole Timer. This will keep the one looping timer.

Then we remove the last GetPlayerSanity(), because it doesn't do anything.

We end up with this:
Spoiler below!
PHP Code: (Select All)
void AmountOfHealth(string &in asTimer)
{
if(
GetPlayerHealth() < 51.0f)
{
PlaySoundAtEntity("Player""woman_breath.snt""Player"0false);
FadeSepiaColorTo(1,1);
}
if(
GetPlayerHealth() > 51.0f)
{
FadeSepiaColorTo(0,1);
}
if(
GetPlayerSanity() < 45.0f)
{
PlaySoundAtEntity("Player""insanity_whispers.snt""Player"0false);
}
AddTimer(""3"AmountOfHealth");



You can also "lower" the number of if-checks by using an else statement.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 03-24-2015, 08:53 AM by Romulator.)
03-24-2015, 08:49 AM
Find


Messages In This Thread
[Updated thread] Need help - by Catalyst - 10-24-2014, 08:18 PM
RE: A new custom story - by hewiefreeman - 10-25-2014, 02:28 AM
RE: A new custom story - by Romulator - 10-25-2014, 02:32 AM
RE: A new custom story - by The chaser - 10-25-2014, 08:13 AM
RE: A new custom story - by Catalyst - 10-25-2014, 08:32 AM
RE: A new custom story - by The chaser - 10-25-2014, 08:38 AM
RE: A new custom story - by Catalyst - 10-25-2014, 10:03 AM
RE: [ACTUAL]A new custom story - by Catalyst - 01-26-2015, 09:55 PM
RE: A new custom story - by Straxedix - 10-25-2014, 12:02 PM
RE: A new custom story - by Catalyst - 10-25-2014, 12:47 PM
RE: A new custom story - by Straxedix - 10-25-2014, 12:58 PM
RE: A new custom story - by Daemian - 10-25-2014, 02:44 PM
RE: A new custom story - by Catalyst - 11-01-2014, 10:38 PM
RE: A new custom story - by Darkfire - 11-02-2014, 08:37 PM
RE: A new custom story - by Red - 11-04-2014, 09:53 AM
RE: A new custom story - by Catalyst - 11-04-2014, 02:24 PM
RE: A new custom story - by Red - 11-05-2014, 01:08 PM
RE: A new custom story - by Catalyst - 11-16-2014, 08:46 AM
RE: [SOLVED]A new custom story - by Darkfire - 01-17-2015, 11:15 PM
RE: [SOLVED]A new custom story - by Tesseract - 01-18-2015, 07:40 AM
RE: [SOLVED]A new custom story - by Catalyst - 01-22-2015, 09:21 PM
RE: [ACTUAL]A new custom story - by Tesseract - 01-23-2015, 02:39 AM
RE: [ACTUAL]A new custom story - by Catalyst - 01-23-2015, 12:18 PM
RE: [ACTUAL]A new custom story - by Tesseract - 01-23-2015, 01:40 PM
RE: [ACTUAL]A new custom story - by Catalyst - 01-23-2015, 01:57 PM
RE: [ACTUAL]A new custom story - by Mudbill - 01-23-2015, 12:55 PM
RE: [ACTUAL]A new custom story - by Catalyst - 01-23-2015, 01:01 PM
RE: [ACTUAL]A new custom story - by Mudbill - 01-23-2015, 01:32 PM
RE: [ACTUAL]A new custom story - by Catalyst - 01-23-2015, 04:02 PM
RE: [ACTUAL]A new custom story - by Catalyst - 01-23-2015, 05:40 PM
RE: [ACTUAL]A new custom story - by Mudbill - 01-23-2015, 06:04 PM
RE: [ACTUAL]A new custom story - by Catalyst - 01-23-2015, 06:09 PM
RE: [ACTUAL]A new custom story - by Catalyst - 02-07-2015, 05:15 PM
RE: [Updated thread] Need help - by Mudbill - 02-07-2015, 06:54 PM
RE: [Updated thread] Need help - by Catalyst - 02-08-2015, 11:55 AM
RE: [Updated thread] Need help - by Romulator - 02-08-2015, 12:45 PM
RE: [Updated thread] Need help - by Catalyst - 02-08-2015, 12:46 PM
RE: [Updated thread] Need help - by Catalyst - 02-08-2015, 03:12 PM
RE: [Updated thread] Need help - by Romulator - 02-08-2015, 11:19 PM
RE: [Updated thread] Need help - by Mudbill - 02-08-2015, 05:01 PM
RE: [Updated thread] Need help - by Catalyst - 02-13-2015, 05:49 PM
RE: [Updated thread] Need help - by Mudbill - 02-14-2015, 01:57 AM
RE: [Updated thread] Need help - by Romulator - 02-14-2015, 01:58 AM
RE: [Updated thread] Need help - by Catalyst - 02-14-2015, 10:40 AM
RE: [Updated thread] Need help - by Mudbill - 02-14-2015, 12:59 PM
RE: [Updated thread] Need help - by Catalyst - 02-24-2015, 03:22 PM
RE: [Updated thread] Need help - by Mudbill - 02-24-2015, 03:29 PM
RE: [Updated thread] Need help - by Catalyst - 02-24-2015, 04:54 PM
RE: [Updated thread] Need help - by Romulator - 02-24-2015, 05:02 PM
RE: [Updated thread] Need help - by Catalyst - 02-24-2015, 05:09 PM
RE: [Updated thread] Need help - by Mudbill - 02-24-2015, 05:23 PM
RE: [Updated thread] Need help - by Catalyst - 02-25-2015, 07:40 PM
RE: [Updated thread] Need help - by Darkfire - 02-25-2015, 08:59 PM
RE: [Updated thread] Need help - by Catalyst - 02-25-2015, 11:12 PM
RE: [Updated thread] Need help - by Catalyst - 02-26-2015, 01:18 PM
RE: [Updated thread] Need help - by Darkfire - 02-26-2015, 04:32 PM
RE: [Updated thread] Need help - by Mudbill - 02-26-2015, 05:14 PM
RE: [Updated thread] Need help - by Darkfire - 02-26-2015, 07:46 PM
RE: [Updated thread] Need help - by Catalyst - 02-26-2015, 08:53 PM
RE: [Updated thread] Need help - by Darkfire - 02-26-2015, 09:41 PM
RE: [Updated thread] Need help - by Catalyst - 02-26-2015, 10:23 PM
RE: [Updated thread] Need help - by Darkfire - 02-26-2015, 10:34 PM
RE: [Updated thread] Need help - by Catalyst - 02-26-2015, 10:41 PM
RE: [Updated thread] Need help - by Catalyst - 02-27-2015, 11:21 AM
RE: [Updated thread] Need help - by Mudbill - 02-27-2015, 01:46 PM
RE: [Updated thread] Need help - by Catalyst - 02-27-2015, 02:22 PM
RE: [Updated thread] Need help - by Mudbill - 02-27-2015, 03:33 PM
RE: [Updated thread] Need help - by Darkfire - 02-27-2015, 03:34 PM
RE: [Updated thread] Need help - by Catalyst - 02-27-2015, 10:10 PM
RE: [Updated thread] Need help - by Mudbill - 02-27-2015, 11:44 PM
RE: [Updated thread] Need help - by Catalyst - 03-02-2015, 02:59 PM
RE: [Updated thread] Need help - by Mudbill - 03-02-2015, 04:38 PM
RE: [Updated thread] Need help - by Catalyst - 03-02-2015, 07:50 PM
RE: [Updated thread] Need help - by Mudbill - 03-02-2015, 08:38 PM
RE: [Updated thread] Need help - by Catalyst - 03-04-2015, 04:56 PM
RE: [Updated thread] Need help - by Mudbill - 03-04-2015, 05:39 PM
RE: [Updated thread] Need help - by Catalyst - 03-06-2015, 08:30 PM
RE: [Updated thread] Need help - by Darkfire - 03-06-2015, 08:52 PM
RE: [Updated thread] Need help - by Catalyst - 03-07-2015, 03:01 PM
RE: [Updated thread] Need help - by Catalyst - 03-22-2015, 06:36 PM
RE: [Updated thread] Need help - by A.M Team - 03-22-2015, 08:43 PM
RE: [Updated thread] Need help - by Catalyst - 03-22-2015, 08:50 PM
RE: [Updated thread] Need help - by Mudbill - 03-22-2015, 09:20 PM
RE: [Updated thread] Need help - by Catalyst - 03-23-2015, 06:26 AM
RE: [Updated thread] Need help - by Mudbill - 03-23-2015, 11:18 AM
RE: [Updated thread] Need help - by Catalyst - 03-23-2015, 01:03 PM
RE: [Updated thread] Need help - by Catalyst - 03-23-2015, 09:06 PM
RE: [Updated thread] Need help - by Mudbill - 03-23-2015, 09:43 PM
RE: [Updated thread] Need help - by Straxedix - 03-24-2015, 06:51 AM
RE: [Updated thread] Need help - by Romulator - 03-24-2015, 08:49 AM
RE: [Updated thread] Need help - by Catalyst - 03-24-2015, 04:34 PM
RE: [Updated thread] Need help - by Catalyst - 03-26-2015, 08:09 PM
RE: [Updated thread] Need help - by Mudbill - 03-26-2015, 08:29 PM
RE: [Updated thread] Need help - by Catalyst - 03-27-2015, 02:05 PM
RE: [Updated thread] Need help - by Mudbill - 03-27-2015, 02:08 PM
RE: [Updated thread] Need help - by Catalyst - 03-27-2015, 05:50 PM
RE: [Updated thread] Need help - by Traggey - 03-27-2015, 07:43 PM
RE: [Updated thread] Need help - by Catalyst - 03-28-2015, 09:13 AM
RE: [Updated thread] Need help - by Traggey - 03-28-2015, 03:33 PM
RE: [Updated thread] Need help - by Catalyst - 03-28-2015, 06:07 PM
RE: [Updated thread] Need help - by Catalyst - 03-28-2015, 08:28 PM
RE: [Updated thread] Need help - by Darkfire - 03-28-2015, 08:50 PM
RE: [Updated thread] Need help - by Catalyst - 03-28-2015, 08:52 PM
RE: [Updated thread] Need help - by Catalyst - 03-29-2015, 01:49 PM
RE: [Updated thread] Need help - by Romulator - 03-29-2015, 02:29 PM
RE: [Updated thread] Need help - by Catalyst - 03-29-2015, 04:44 PM
RE: [Updated thread] Need help - by Catalyst - 03-29-2015, 06:08 PM
RE: [Updated thread] Need help - by Darkfire - 03-30-2015, 03:35 PM
RE: [Updated thread] Need help - by Catalyst - 03-30-2015, 05:07 PM
RE: [Updated thread] Need help - by Catalyst - 04-03-2015, 12:45 PM
RE: [Updated thread] Need help - by Romulator - 04-03-2015, 01:19 PM
RE: [Updated thread] Need help - by Catalyst - 04-03-2015, 08:20 PM
RE: [Updated thread] Need help - by Mudbill - 04-04-2015, 01:48 AM
RE: [Updated thread] Need help - by Catalyst - 04-04-2015, 11:59 AM
RE: [Updated thread] Need help - by Catalyst - 04-05-2015, 10:31 AM
RE: [Updated thread] Need help - by Romulator - 04-05-2015, 02:13 PM
RE: [Updated thread] Need help - by Catalyst - 04-05-2015, 07:58 PM
RE: [Updated thread] Need help - by Mudbill - 04-05-2015, 08:43 PM
RE: [Updated thread] Need help - by Catalyst - 04-06-2015, 02:31 PM
RE: [Updated thread] Need help - by Catalyst - 04-06-2015, 05:04 PM
RE: [Updated thread] Need help - by Catalyst - 05-17-2015, 09:59 AM
RE: [Updated thread] Need help - by Romulator - 05-17-2015, 10:17 AM
RE: [Updated thread] Need help - by Catalyst - 05-17-2015, 10:33 AM
RE: [Updated thread] Need help - by Catalyst - 05-18-2015, 07:43 PM
RE: [Updated thread] Need help - by Catalyst - 06-19-2015, 10:24 AM
RE: [Updated thread] Need help - by DnALANGE - 06-19-2015, 10:35 AM
RE: [Updated thread] Need help - by NotASkrub - 06-19-2015, 11:47 AM
RE: [Updated thread] Need help - by Romulator - 06-19-2015, 12:49 PM
RE: [Updated thread] Need help - by DnALANGE - 06-19-2015, 01:28 PM
RE: [Updated thread] Need help - by Romulator - 06-19-2015, 01:41 PM
RE: [Updated thread] Need help - by Catalyst - 06-20-2015, 06:27 AM
RE: [Updated thread] Need help - by Romulator - 06-20-2015, 08:52 AM
RE: [Updated thread] Need help - by Catalyst - 07-04-2015, 07:31 PM
RE: [Updated thread] Need help - by Rahmerh - 07-04-2015, 07:36 PM
RE: [Updated thread] Need help - by Catalyst - 07-04-2015, 09:33 PM
RE: [Updated thread] Need help - by Catalyst - 07-20-2015, 10:28 AM
RE: [Updated thread] Need help - by Traggey - 07-20-2015, 11:19 AM
RE: [Updated thread] Need help - by Catalyst - 04-22-2017, 05:59 PM
RE: [Updated thread] Need help - by Romulator - 04-23-2017, 03:17 AM
RE: [Updated thread] Need help - by Catalyst - 05-31-2018, 08:44 PM
RE: [Updated thread] Need help - by Romulator - 06-02-2018, 06:44 PM
RE: [Updated thread] Need help - by Mudbill - 06-02-2018, 09:42 PM



Users browsing this thread: 12 Guest(s)