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
Script Help AddLocalVarInt and valves problems
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#1
AddLocalVarInt and valves problems

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?

02-15-2012, 10:50 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: AddLocalVarInt and valves problems

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.

Tutorials: From Noob to Pro
02-15-2012, 11:33 PM
Website Find
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#3
RE: AddLocalVarInt and valves problems

If you did everything correctly then there wouldn't be any problems in the first place Tongue
02-15-2012, 11:35 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: AddLocalVarInt and valves problems

Show us the script c:

(This post was last modified: 02-16-2012, 04:00 AM by flamez3.)
02-16-2012, 04:00 AM
Find
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#5
RE: AddLocalVarInt and valves problems

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 }.
02-16-2012, 06:38 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#6
RE: AddLocalVarInt and valves problems

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: (Select All)
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

02-16-2012, 08:21 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
RE: AddLocalVarInt and valves problems

Where's the rest of the script?

Tutorials: From Noob to Pro
02-16-2012, 09:19 AM
Website Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#8
RE: AddLocalVarInt and valves problems

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.
02-16-2012, 09:28 AM
Website Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#9
RE: AddLocalVarInt and valves problems

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
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: AddLocalVarInt and valves problems

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

Tutorials: From Noob to Pro
(This post was last modified: 02-16-2012, 09:54 AM by Your Computer.)
02-16-2012, 09:52 AM
Website Find




Users browsing this thread: 1 Guest(s)