Frictional Games Forum (read-only)
[SCRIPT] AddLocalVarInt and valves problems - 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] AddLocalVarInt and valves problems (/thread-13361.html)

Pages: 1 2


AddLocalVarInt and valves problems - SilentStriker - 02-15-2012

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?



RE: AddLocalVarInt and valves problems - Your Computer - 02-15-2012

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.


RE: AddLocalVarInt and valves problems - Ninami - 02-15-2012

If you did everything correctly then there wouldn't be any problems in the first place Tongue


RE: AddLocalVarInt and valves problems - flamez3 - 02-16-2012

Show us the script c:


RE: AddLocalVarInt and valves problems - Ninami - 02-16-2012

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


RE: AddLocalVarInt and valves problems - SilentStriker - 02-16-2012

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



RE: AddLocalVarInt and valves problems - Your Computer - 02-16-2012

Where's the rest of the script?


RE: AddLocalVarInt and valves problems - jens - 02-16-2012

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.



RE: AddLocalVarInt and valves problems - SilentStriker - 02-16-2012

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


RE: AddLocalVarInt and valves problems - Your Computer - 02-16-2012

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