Frictional Games Forum (read-only)
[SCRIPT] Script problem - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Script problem (/thread-19057.html)



Script problem - ooadrianoo - 11-02-2012

Hello I have a problem. My script doesn't work.

PHP Code:
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.3f0.6f),3);
    
AddTimer("RandomLoop"RandFloat(5.0f,7.0f), "TimerRandom");
    
AddTimer("fadein"5"fadeintimer");
    
    }
    
    else if(
iRandoms == or iRandoms == 5)
    {
    
StartEffectFlash(115);//Checks whether this part works
    
    
SetPlayerRunSpeedMul(0.65f);
    
SetPlayerMoveSpeedMul(0.7f);
    
FadePlayerFOVMulTo(13);
    
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?


RE: Script problem - FlawlessHappiness - 11-02-2012

this: (string&in asTimer)


Should be: (string &in asTimer)


RE: Script problem - ooadrianoo - 11-02-2012

(11-02-2012, 09:00 PM)beecake Wrote: this: (string&in asTimer)
Nothing changed. Still the same problem ._.


RE: Script problem - Your Computer - 11-02-2012

I would assume that the value is never the ones in the if statement


RE: Script problem - ooadrianoo - 11-02-2012

(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.


RE: Script problem - Your Computer - 11-02-2012

(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."


RE: Script problem - ooadrianoo - 11-02-2012

It works if I make it so:
PHP Code:
if (iRandoms 4
and
PHP Code:
else if(iRandoms 4

But I don't understand why it works this way.


RE: Script problem - ZodiaC - 11-02-2012

(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.


RE: Script problem - ooadrianoo - 11-02-2012

(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


RE: Script problem - ZodiaC - 11-02-2012

(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 Wink