ooadrianoo
Member
Posts: 82
Threads: 29
Joined: Apr 2012
Reputation:
0
|
Script problem
Hello I have a problem. My script doesn't work.
void OnEnter () {
AddTimer("Random", RandFloat(2.0f,4.0f), "TimerRandom"); }
void TimerRandom(string&in asTimer) { int iRandoms = RandFloat(1,7); if (iRandoms > 6){ SetPlayerActive(false); //Checks whether this part works SetPlayerRunSpeedMul(RandFloat(0.6f,0.8f)); SetPlayerMoveSpeedMul(RandFloat(0.8f,0.9f)); FadePlayerFOVMulTo(RandFloat(1.1f,1.3f), 3); FadeImageTrailTo(RandFloat(0.3f, 0.6f),3); AddTimer("RandomLoop", RandFloat(5.0f,7.0f), "TimerRandom"); AddTimer("fadein", 5, "fadeintimer"); } else if(iRandoms == 2 or iRandoms == 5) { StartEffectFlash(1, 1, 5);//Checks whether this part works SetPlayerRunSpeedMul(0.65f); SetPlayerMoveSpeedMul(0.7f); FadePlayerFOVMulTo(1, 3); FadeImageTrailTo(RandFloat(0.8f,1.0f), RandFloat(3.0f,5.0f)); PlaySoundAtEntity("breath_slow", "react_breath_slow.snt", "Player", RandFloat(0.8f,1.0f), false); AddTimer("RandomLoop", RandFloat(4.0f,6.0f), "TimerRandom"); } }
This part of my script and I don't know why. Can anyone help me?
|
|
11-02-2012, 08:50 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Script problem
this: (string&in asTimer)
Should be: (string &in asTimer)
Trying is the first step to success.
|
|
11-02-2012, 09:00 PM |
|
ooadrianoo
Member
Posts: 82
Threads: 29
Joined: Apr 2012
Reputation:
0
|
RE: Script problem
(11-02-2012, 09:00 PM)beecake Wrote: this: (string&in asTimer) Nothing changed. Still the same problem ._.
(This post was last modified: 11-02-2012, 09:08 PM by ooadrianoo.)
|
|
11-02-2012, 09:08 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Script problem
I would assume that the value is never the ones in the if statement
(This post was last modified: 11-02-2012, 09:13 PM by Your Computer.)
|
|
11-02-2012, 09:13 PM |
|
ooadrianoo
Member
Posts: 82
Threads: 29
Joined: Apr 2012
Reputation:
0
|
RE: Script problem
(11-02-2012, 09:13 PM)Your Computer Wrote: I would assume that the value is never the ones in the if statement Explain me why.
|
|
11-02-2012, 09:24 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Script problem
(11-02-2012, 09:24 PM)ooadrianoo Wrote: Explain me why.
It's not that it can't be, but that every time you've tested it the value was either 1, 3, 4 or 6. Perhaps i should have said "was" instead of "is."
(This post was last modified: 11-02-2012, 09:34 PM by Your Computer.)
|
|
11-02-2012, 09:34 PM |
|
ooadrianoo
Member
Posts: 82
Threads: 29
Joined: Apr 2012
Reputation:
0
|
RE: Script problem
It works if I make it so:
and
But I don't understand why it works this way.
|
|
11-02-2012, 09:36 PM |
|
ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
RE: Script problem
(11-02-2012, 09:24 PM)ooadrianoo Wrote: Explain me why. Because you make the iRandoms random from 1 to 7.
In your first "if" it checks if it's bigger than 6
and in your "else if" you check if the iRandoms is equal to 2 or 5
So if the iRandoms is 1,3,4,6 the script will do nothing.
|
|
11-02-2012, 09:39 PM |
|
ooadrianoo
Member
Posts: 82
Threads: 29
Joined: Apr 2012
Reputation:
0
|
RE: Script problem
(11-02-2012, 09:39 PM)ZodiaC Wrote: (11-02-2012, 09:24 PM)ooadrianoo Wrote: Explain me why. Because you make the iRandoms random from 1 to 7.
In your first "if" it checks if it's bigger than 6
and in your "else if" you check if the iRandoms is equal to 2 or 5
So if the iRandoms is 1,3,4,6 the script will do nothing. Thank you
|
|
11-02-2012, 09:51 PM |
|
ZodiaC
Member
Posts: 120
Threads: 8
Joined: Oct 2012
Reputation:
2
|
RE: Script problem
(11-02-2012, 09:51 PM)ooadrianoo Wrote: (11-02-2012, 09:39 PM)ZodiaC Wrote: (11-02-2012, 09:24 PM)ooadrianoo Wrote: Explain me why. Because you make the iRandoms random from 1 to 7.
In your first "if" it checks if it's bigger than 6
and in your "else if" you check if the iRandoms is equal to 2 or 5
So if the iRandoms is 1,3,4,6 the script will do nothing. Thank you Your Welcome
|
|
11-02-2012, 09:53 PM |
|
|