Frictional Games Forum (read-only)

Full Version: AddLocalVarInt and valves problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So my problem is I try to use AddLocalVarInt when I turn 4 valves so the LocalVar is 4 but the problem is that it wont add anything.

And before you ask, Yes I added SetLocalVarInt 0 and I don't have any typos.

The thing I asking about is, Is it any bug/problems with using AddLocalVar when using the valves?
As far as i know, there aren't any issues with AddLocalVarInt, but having us assume that you've set everything up correctly won't get you anywhere.
If you did everything correctly then there wouldn't be any problems in the first place Tongue
Show us the script c:
I got a map with the same mechanic. I just add "SetLocalVarInt("Valve", 0);" and then every time you turn a valve you add "AddLocalVarInt("Valve", 1);". Then every time you try to open the door, the "if" statement starts, if("Valve" == 4);{ the door opens } else{ message saying its locked }.
There must be a bug or something because Statyk tried it to and the same results, He got it working with using only SetLocalVar but not AddLocalVar... oh well here's my script

PHP Code:
void OnStart();
{
    
SetLocalVarInt("Valve"0);
}
/*Turn Valves to direct steam
 */
 
void TurnStartSteam(string &in asEntityint alState)
 {
    if(
alState == 1){
        for(
int i=6i<=8;i++){ 
            
CreateParticleSystemAtEntity("ValveP"+i"ps_steam.ps""ValveParticles_"+itrue);
            
PlaySoundAtEntity("ValveS"+i"13_steam""ValveParticles_"+i0.5true);
            
SetPropObjectStuckState("machine_valve_1"1);
            
SetEntityInteractionDisabled("machine_valve_1"true);
            
PlaySoundAtEntity("""lock_door.snt""machine_valve_1"0true);
            
FadeLightTo("PointLight_6"0,0,0,0, -11.5f);
            
AddLocalVarInt("Valve"1);
        }
    }
    else if (
alState == -1AddDebugMessage("Valve Min"false);
 }

 
void TurnStartSteam2(string &in asEntityint alState)
 {
    if(
alState == 1){
        for(
int i=1i<=2;i++){
            
CreateParticleSystemAtEntity("ValveP"+i"ps_steam.ps""ValveParticles_"+itrue);
            
PlaySoundAtEntity("ValveS"+i"13_steam""ValveParticles_"+i0.5true);
            
SetPropObjectStuckState("machine_valve_2"1);
            
SetEntityInteractionDisabled("machine_valve_2"true);
            
PlaySoundAtEntity("""lock_door.snt""machine_valve_2"0true);
            
FadeLightTo("PointLight_7"0,0,0,0, -11.5f);
            
AddLocalVarInt("Valve"1);
        }
    }
    else if (
alState == -1AddDebugMessage("Valve Min"false);
 }
 
void TurnStartSteam3(string &in asEntityint alState)
 {
    if(
alState == 1){
        for(
int i=3i<=5;i++){
            
CreateParticleSystemAtEntity("ValveP"+i"ps_steam.ps""ValveParticles_"+itrue);
            
PlaySoundAtEntity("ValveS"+i"13_steam""ValveParticles_"+i0.5true);
            
SetPropObjectStuckState("machine_valve_3"1);
            
SetEntityInteractionDisabled("machine_valve_3"true);
            
PlaySoundAtEntity("""lock_door.snt""machine_valve_3"0true);
            
FadeLightTo("PointLight_8"0,0,0,0, -11.5f);
            
AddLocalVarInt("Valve"1);
        }
    }
    else if (
alState == -1AddDebugMessage("Valve Min"false);
 }
 
void TurnStartSteam4(string &in asEntityint alState)
 {
    if(
alState == 1){
        for(
int i=9i<=12;i++){
            
CreateParticleSystemAtEntity("ValveP"+i"ps_steam.ps""ValveParticles_"+itrue);
            
PlaySoundAtEntity("ValveS"+i"13_steam""ValveParticles_"+i0.5true);
            
SetPropObjectStuckState("machine_valve_4"1);
            
SetEntityInteractionDisabled("machine_valve_4"true);
            
PlaySoundAtEntity("""lock_door.snt""machine_valve_4"0true);
            
FadeLightTo("PointLight_9"0,0,0,0, -11.5f);
            
AddLocalVarInt("Valve"1);
        }
    }
    else if (
alState == -1AddDebugMessage("Valve Min"false);
 } 

All the other things work but not the LocalVarInt
Where's the rest of the script?
Is it intended to add different amounts to Valve? As it is in the for loops it sometimes add 1 but sometimes 3, so if turning 4 valves is meant to make the value of Valve equal 4 the current code does not do this.
it is intended for the valves to be equal to 4 so each valve adds 1. So how do I not make them random? Do I put them before the for loop? Smile
(02-16-2012, 09:46 AM)SilentStriker Wrote: [ -> ]it is intended for the valves to be equal to 4 so each valve adds 1. So how do I not make them random? Do I put them before the for loop? Smile

Your script has each valve add either 2, 3 or 4, which would mean the total result may never equal 4. Your attempt at convenient naming is increasing the variable more than it should.
Pages: 1 2