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
Help with variable ints!
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#10
RE: Help with variable ints!

(03-19-2014, 01:40 PM)Badcat5550 Wrote: Ok I made the original I did not rename them this time, so is this supposed to work in game now? should I name the containers BarrelCheck or the script boxes that I am going to put the container on?

PHP Code: (Select All)
void OnStart()
{
    
    
PlayMusic("04_amb.ogg", true, 1, 4, 1, true);
    
AddTimer("AreaScrape_", RandFloat(3.0f,10.f), "TimerAreaScrape");
    
AddTimer("AreaStep_", RandFloat(3.0f,10.f), "TimerAreaStep");
    
AddUseItemCallback("", "DirtyContainer", "PutCont", "UseContainer", true);
    
AddEntityCollideCallback("Player", "AreaDoor", "EventDoor", true, 1);
    
SetLocalVarInt("BarrelCheck", 0);     
    
    


}

void TimerAreaScrape(string &in asTimer)
{
    
int iRand = RandInt(1, 6);

    
PlaySoundAtEntity(asTimer+iRand, "15_wall_crawl.snt", asTimer+iRand, 1, false);
    
AddTimer("EndRadial", 4.0f, "TimerEndRadial");
    
AddTimer(asTimer, RandFloat(15.0f, 30.0f), "TimerAreaScrape");
}

void TimerAreaStep(string &in asTimer)
{
    
int iRand = RandInt(1, 6);

    
PlaySoundAtEntity(asTimer+iRand, "scare_wood_creak_walk.snt", asTimer+iRand, 1, false);
    
AddTimer("EndRadial", 4.0f, "TimerEndRadial");
    
AddTimer(asTimer, RandFloat(15.0f, 30.0f), "TimerAreaStep");
}

void EventDoor(string &in asParent, string &in asChild, int alState)
{
        
SetSwingDoorClosed("Door", false, false);
        
SetSwingDoorDisableAutoClose("Door", true);
 
        
PlaySoundAtEntity("creak", "joint_door_move_special.snt", "Door", 1, false);
    
PlaySoundAtEntity("Wind", "general_wind_whirl", "Player", 2, false);
    
PlaySoundAtEntity("scare", "react_scare.snt", "Player", 0.75f, false);
    
PlaySoundAtEntity("SoundBong", "scare_tingeling.snt", "Player", 0.0f, false);
    
PlayMusic("18_amb.ogg", true, 1.0f, 0, 0, true);
    
CreateParticleSystemAtEntity("PSDoor_3", "ps_dust_push.ps", "Door", false);
    
CreateParticleSystemAtEntity("PSDoor_4", "ps_dust_push.ps", "Door", false);
    
GiveSanityDamage(10, true);    
 
        
AddTimer("", 2, "TimerStopSound");
        
AddTimer("Door", 0, "TimerMoveDoor");
}
 
void TimerMoveDoor(string &in asTimer)
{
        if(
GetLocalVarInt("VarDoor") == 50) return;
        
AddLocalVarInt("VarDoor", 1);
 
        
AddTimer(asTimer, 0.03, "TimerMoveDoor");
 
        
AddPropForce(asTimer, 70, 0, 0, "world");
}
 
void TimerStopSound(string &in asTimer)
{
        
StopSound("creak", 0.4);
}

void TurnLiquidValve(string &in asEntityName, int alState)
{
 if(
alState == 1)
 {
  
CreateParticleSystemAtEntity("liquidps", "ps_liquid_epoxy.ps", "PS", false);
  
CreateParticleSystemAtEntity("splat", "ps_liquid_epoxy_splatt.ps", "PS_1", true);
 
  
PlaySoundAtEntity("turnon", "12_valve_stuck", asEntityName, 0, false);
  
  
PlaySoundAtEntity("hdfg", "12_epoxy_flow", asEntityName, 0, true);
   
  
AddTimer("fillcontainer", 5.0f, "TimerFillContainer");
 }
}

void TimerFillContainer(string &in asTimer)
{
 
SetPropActiveAndFade("Empty", false, 0.5f);
 
SetPropActiveAndFade("Clean", true, 0.5f);
SetEntityActive("PutCont", false);
AddPlayerSanity(2);
}

void InteractCallback(string &in asEntity)
{
 if(
GetLocalVarInt("ContainerUsed") == 0) SetMessage("Messages", "Place", 0);
            return; 
//Stops the script completely
 
 
SetWheelStuckState("ValveStuck", 0, false);
}

void UseContainer(string &in asEntity, string &in asItem)
{
 
PlaySoundAtEntity("plss", "puzzle_place_jar", asEntity, 0.0f, false);
SetWheelStuckState("ValveStuck", 0, true);
 
 
SetEntityActive("Empty", true);
 
SetLocalVarInt("ContainerUsed", 1);
}


void ContainerOnBarrelCheck()
{
    if(
GetLocalVarInt("BarrelCheck") == 1)
    {
        
//WHAT TO DO IF BARREL IS ALREADY CLEANED
    
}

    else if(
GetLocalVarInt("BarrelCheck") != 1)
    {
        
//WHAT TO DO IF BARREL HAVEN'T CLEANED YET
    
}
}
//<- this one 

You have to call the ContainerOnBarrelCheck() function in the callback function that you use to increment the VarInt by one.

Use this to call it;
ContainerOnBarrelCheck();

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-19-2014, 01:50 PM
Find


Messages In This Thread
Help with variable ints! - by Radical Batz - 03-19-2014, 10:05 AM
RE: Help with variable ints! - by Radical Batz - 03-19-2014, 10:24 AM
RE: Help with variable ints! - by Radical Batz - 03-19-2014, 10:38 AM
RE: Help with variable ints! - by Mudbill - 03-19-2014, 12:16 PM
RE: Help with variable ints! - by Mudbill - 03-19-2014, 01:23 PM
RE: Help with variable ints! - by Radical Batz - 03-19-2014, 01:40 PM
RE: Help with variable ints! - by PutraenusAlivius - 03-19-2014, 01:50 PM
RE: Help with variable ints! - by Mudbill - 03-19-2014, 01:57 PM
RE: Help with variable ints! - by Mudbill - 03-19-2014, 02:26 PM



Users browsing this thread: 1 Guest(s)