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
Final help with difficult script
LoneWolf Offline
Senior Member

Posts: 308
Threads: 43
Joined: Sep 2010
Reputation: 0
#8
RE: Final help with difficult script

Couldnt find anything about mixing chemicals into a pot/container on the wiki. i looked into the game hps. and found alot of scripting to do with the mixing of chemicals buts its so confusing and its over 200 lines long... look at it.

/*Use the final drill on the epoxy containers to drill a hole
*/
void UseDrillOnEpoxy(string &in asItem, string &in asEntity)
{
    if(GetLocalVarInt("GotEpoxy") == 1) return;
    
    if(GetLocalVarInt(asEntity) != 0){
        SetMessage("Ch01Level12", "AlreadyDrilled", 0);
        return;
    }
    
    SetEntityActive(asEntity+"_area_2", true);
    AddUseItemCallback("usecontainer1" + asEntity, "empty_container", asEntity + "_area_2", "UseEmptyContainerOnEpoxy", false);
    AddUseItemCallback("usehalfcontainer1" + asEntity, "epoxy_container01_2", asEntity + "_area_2", "UseHalfContainerOnEpoxy", false);
    AddUseItemCallback("usehalfcontainer2" + asEntity, "epoxy_container02_2", asEntity + "_area_2", "UseHalfContainerOnEpoxy", false);
    
    SetEntityActive(asEntity+"_drill", true);
    
    if(asEntity == "epoxy_container02")
        RotatePropToSpeed(asEntity+"_drill", 8.0f, 8.0f, 1.0, 0, 0, true, asEntity+"_drill_area");
    else
        RotatePropToSpeed(asEntity+"_drill", 8.0f, 8.0f, 0, 0, 1.0f, true, asEntity+"_drill_area");
        
    StartPlayerLookAt(asEntity+"_area_1", 2, 2, "");
    
    if(StringContains(asEntity, "01")) SetLocalVarString("WhatEpoxyEffect", "drill01");
    else if(StringContains(asEntity, "02")) SetLocalVarString("WhatEpoxyEffect", "drill02");
    
    CreateParticleSystemAtEntity("ps_"+GetLocalVarString("WhatEpoxyEffect"), "ps_dust_drilling.ps", asEntity+"_area_1", false);
    PlaySoundAtEntity("s_"+GetLocalVarString("WhatEpoxyEffect"), "12_drill", asEntity+"_area_1", 1, false);
    
    SetLocalVarInt(asEntity, 1);

    AddTimer("stoplook", 1.5f, "TimerDrill");
    
    AddTimer(asEntity, 2, "TimerDrill");
    AddTimer(asEntity+"_drill", 1.5f, "TimerDrill");
    
    AddDebugMessage("DRILLING A HOLE", false);
}
void TimerDrill(string &in asTimer)
{
    if(asTimer == "stoplook"){
        StopPlayerLookAt();
        return;
    }
    else if(StringContains(asTimer, "_drill")){
        if(asTimer == "epoxy_container02_drill")
            RotatePropToSpeed(asTimer, 4.0f, 4.0f, 1.0f, 0, 0, false, asTimer+"_area");
        else
            RotatePropToSpeed(asTimer, 4.0f, 4.0f, 0, 0, 1.0f, false, asTimer+"_area");
            
        StopSound("s_"+GetLocalVarString("WhatEpoxyEffect"), 1.0f);
        return;
    }
    
    SetPropActiveAndFade(asTimer+"_drill", false, 0.5f);
        
    CreateParticleSystemAtEntity("ps2_"+GetLocalVarString("WhatEpoxyEffect"), "ps_liquid_epoxy.ps", asTimer+"_area_1", true);
    CreateParticleSystemAtEntity("ps3_"+GetLocalVarString("WhatEpoxyEffect"), "ps_liquid_epoxy_splatt.ps", asTimer+"_area_2", true);

    PlaySoundAtEntity("s2_"+GetLocalVarString("WhatEpoxyEffect"), "12_epoxy_flow", asTimer+"_area_1", 0, true);
}
void UseDrillPartOnEpoxy(string &in asItem, string &in asEntity)
{
    SetMessage("Ch01Level12", "UsingDrillPart", 0);
}

/*Use the chemical container on epoxy containers to fill it will liquid
*/
void UseEmptyContainerOnEpoxy(string &in asItem, string &in asEntity)
{
    if(GetLocalVarInt("GotEpoxy") == 1) return;
    
    /*Container has been drilled so OK to place container
     */
    
    string sEntity = StringSub(asEntity, 0, 17);
    AddDebugMessage(sEntity, false);
    
    if(GetLocalVarInt(sEntity) == 1){
        if(GetTimerTimeLeft(sEntity)>0){
            SetMessage("Ch01Level12", "NotDoneDrilling", 0);
            return;
        }
        
        RemoveItem(asItem);
        
        SetEntityActive(sEntity+"_area_2", false);

        SetEntityActive(sEntity+"_1", true);
        
        StartPlayerLookAt(sEntity+"_area_2", 2, 2, "");
        
        DestroyParticleSystem("ps3_"+GetLocalVarString("WhatEpoxyEffect"));
        
        StopSound("s2_"+GetLocalVarString("WhatEpoxyEffect"), 2.0f);
        
        PlaySoundAtEntity("s3_"+GetLocalVarString("WhatEpoxyEffect"), "12_epoxy_fill", sEntity+"_area_1", 1.0, false);
        PlaySoundAtEntity("s3p_"+GetLocalVarString("WhatEpoxyEffect"), "puzzle_place_jar", sEntity+"_area_2", 0.1f, false);
        
        AddTimer(sEntity, 2, "TimerHalfFill");
        
        SetLocalVarInt(sEntity, 2);
        SetLocalVarInt("BottleNr", 1);
    }
    else if(GetLocalVarInt(sEntity) == 0){
        SetMessage("Ch01Level12", "ContainerNoUse", 0);    //Message that no use placing container as can't get to the content.
    }
}
/*Switch the container to half filled item containter
*/
void TimerHalfFill(string &in asTimer)
{
    StopPlayerLookAt();
    
    SetEntityActive(asTimer+"_"+GetLocalVarInt("BottleNr"), false);
        
    SetLocalVarInt("BottleNr", 2);
        
    SetEntityActive(asTimer+"_"+GetLocalVarInt("BottleNr"), true);
    
    DestroyParticleSystem("ps2_"+GetLocalVarString("WhatEpoxyEffect"));

    CreateParticleSystemAtEntity("ps4_"+GetLocalVarString("WhatEpoxyEffect"), "ps_liquid_epoxy_drip.ps", asTimer+"_area_1", true);
    PlaySoundAtEntity("s4_"+GetLocalVarString("WhatEpoxyEffect"), "12_epoxy_drip", asTimer+"_area_1", 1, true);
}

/*If player has filled the container from one epoxy and does not use it on the same epoxy, fill it
*/
void UseHalfContainerOnEpoxy(string &in asItem, string &in asEntity)
{
    if(GetLocalVarInt("GotEpoxy") == 1) return;
    
    string sEntity = StringSub(asEntity, 0, 17);
    
    /*Only place container if it is not the same epoxy as already used
     */
    if((asItem == "epoxy_container01_2" or asItem == "epoxy_container02_2") && GetLocalVarInt(asEntity) != 2){
        if(GetLocalVarInt(sEntity) == 1){
            if(GetTimerTimeLeft(sEntity)>0){
            SetMessage("Ch01Level12", "NotDoneDrilling", 0);
            return;
            }
        
            RemoveItem(asItem);
            
            SetEntityActive(sEntity+"_area_2", false);

            SetEntityActive(sEntity+"_3", true);
            
            StartPlayerLookAt(sEntity+"_area_2", 2, 2, "");
            
            DestroyParticleSystem("ps3_"+GetLocalVarString("WhatEpoxyEffect"));
            
            StopSound("s2_"+GetLocalVarString("WhatEpoxyEffect"), 2.0f);
            
            PlaySoundAtEntity("s3_"+GetLocalVarString("WhatEpoxyEffect"), "12_epoxy_fill", sEntity+"_area_1", 1.0, false);
            PlaySoundAtEntity("s3p_"+GetLocalVarString("WhatEpoxyEffect"), "puzzle_place_jar", sEntity+"_area_2", 0.2f, false);
            
            AddTimer(sEntity, 2, "TimerFullFill");
        
            SetLocalVarInt("BottleNr", 3);
            
            SetLocalVarInt("GotEpoxy", 1);

        } else SetMessage("Ch01Level12", "NoHole", 0);    
    }
    else
        SetMessage("Ch01Level12", "ContainerAlreadyUsed", 0);
}
/*Switch the half-full container to a completely filled item container
*/
void TimerFullFill(string &in asTimer)
{
    StopPlayerLookAt();
    
    SetEntityActive(asTimer+"_"+GetLocalVarInt("BottleNr"), false);
        
    SetLocalVarInt("BottleNr", 4);
        
    SetEntityActive(asTimer+"_"+GetLocalVarInt("BottleNr"), true);
    
    DestroyParticleSystem("ps2_"+GetLocalVarString("WhatEpoxyEffect"));
    
    CreateParticleSystemAtEntity("ps4_"+GetLocalVarString("WhatEpoxyEffect"), "ps_liquid_epoxy_drip.ps", asTimer+"_area_1", true);
    PlaySoundAtEntity("s4_"+GetLocalVarString("WhatEpoxyEffect"), "12_epoxy_drip", asTimer+"_area_1", 1, true);
}


/*Give Sanity Push
*/
void PickEpoxy(string &in asEntity, string &in asType)
{
    GiveSanityBoostSmall();
    
    PlayMusic("12_puzzle_epoxy.ogg", false, 1.0f, 0.0f, 10, true);
    
    AddTimer("mmmmonsterkill", 2.0f, "TimerMmMonster");
}
void TimerMmMonster(string &in asTimer)
{
    StartScreenShake(0.02f, 0.25f, 0.75f, 1.5f);
    PlaySoundAtEntity("warning", "12_warn.snt", "ScriptArea_2", 0.0f, false);
    AddTimer("scare", 1.0f, "TimerPlayerReactions");
    AddTimer("breath", 3.0f, "TimerPlayerReactions");
    AddTimer("breathl", 5.0f, "TimerPlayerReactions");
}
//END HAND DRILL & EPOXY//
//////////////////////////


////////////////
//BEGIN CAVEIN//
/*Place the final epoxy at the cave in
*/
void UseEpoxyOnCavein(string &in asItem, string &in asEntity)
{
    RemoveItem(asItem);
    
    GiveHint("run!", "Ch01Level12", "HintRunAway", 0);
    
    StartPlayerLookAt("AreaLookAt_1", 2, 2, "");

    AddTimer("crouch", 0.5f, "TimerStopLookCaveIn");
    AddTimer("place", 1.0f, "TimerStopLookCaveIn");
    AddTimer("stoplook", 1.2f, "TimerStopLookCaveIn");
}
void TimerStopLookCaveIn(string &in asTimer)
{
    if(asTimer == "crouch"){
        MovePlayerHeadPos(0.0f, -0.5f, 0.0f, 1.0f, 0.1f);
        PlaySoundAtEntity("crouchs", "player_climb", "Player", 0.5f, false);
    }
    else if(asTimer == "place"){
        SetEntityActive("explosive_container", true);
        PlaySoundAtEntity("placejar", "puzzle_place_jar", "explosive_container", 0, false);
    }
    else if(asTimer == "stoplook"){
        PlaySoundAtEntity("crouchs", "player_crouch", "Player", 0.0f, false);
        MovePlayerHeadPos(0.0f, 0.0f, 0.0f, 1.5f, 0.05f);
        StopPlayerLookAt();
    }
}

void InteractEpoxyByCave(string &in asEntity)
{
    SetMessage("Ch01Level12", "TouchEpoxy", 0);
}

void DaBigBoom(string &in asEntity, string &in asType)
{
    AddTimer("sound", 1, "TimerBigBoomEvent");
    AddTimer("1", 4, "TimerBigBoomEvent");
    
    FadeLightTo("DangerLight", 1, 0, 0, 1, 4, 4);
}
/*After a second from throwing something at the container it explodes
*/
void TimerBigBoomEvent(string &in asTimer)
{
    if(asTimer == "sound"){
        PlaySoundAtEntity("epoxyignite", "12_epoxy_blow", "cave_in_1", 0, false);
        StartScreenShake(0.01, 0, 0, 2.9f);
        return;
    }
    
    SetEntityActive("explosive_container", false);
    
    SetPropHealth("cave_in_1", 0);
    
    StartScreenShake(0.08, 2.5f, 0, 1.0f);
    
    FadeImageTrailTo(0.5, 1);
    
    FadeLightTo("BoomLight", 1, 1, 1, 1, 8, 0.1f);
    FadeLightTo("DangerLight", 0, 0, 0, 0, 0, 0.5f);
    
    switch(GetLocalVarInt("BoomPlayer")){
        case 0:
            //GivePlayerDamage(25, "BloodSplat", true, false);
            //AddDebugMessage("Player got damage: -25", false);
        break;
        case 1:
            GivePlayerDamage(50, "BloodSplat", true, false);
            AddDebugMessage("Player got damage: -50", false);
        break;
        case 2:
            GivePlayerDamage(200, "BloodSplat", true, false);
            AddDebugMessage("Player got damage: -200", false);
        break;
    }
    
    PlayMusic("12_puzzle_cavein.ogg", false, 1, 0.0f, 10, true);
    
    AddTimer("cquest", 2, "TimerCompleteQuest");
    AddTimer("light", 0.75f, "TimerCompleteQuest");
}

void TimerCompleteQuest(string &in asTimer)
{
    if(asTimer == "light"){
        FadeLightTo("BoomLight", 0, 0, 0, 0, 0, 1.25f);
        return;
    }
    
    CompleteQuest("12Cavein", "12Cavein");
    
    FadeImageTrailTo(0.0, 1);
    
    GiveSanityBoost();
}

/*Check what area the player is in during the explosion to deal a certain amount of damage
*/
void CollideBoomArea(string &in asParent, string &in asChild, int alState)
{
    if(asChild == "AreaBoomDeath") SetLocalVarInt("BoomPlayer", 2);
    else if(asChild == "AreaBoomEscape") SetLocalVarInt("BoomPlayer", 0);
    else SetLocalVarInt("BoomPlayer", 1);
    
    AddDebugMessage("Player to get damage: "+GetLocalVarInt("BoomPlayer"), false);
}
//END CAVEIN//
//////////////
10-14-2010, 12:28 AM
Find


Messages In This Thread
Final help with difficult script - by LoneWolf - 10-13-2010, 07:43 PM
RE: Final help with difficult script - by Kyle - 10-13-2010, 09:30 PM
RE: Final help with difficult script - by HakePT - 10-13-2010, 10:24 PM
RE: Final help with difficult script - by ide - 10-13-2010, 11:07 PM
RE: Final help with difficult script - by LoneWolf - 10-14-2010, 12:28 AM
RE: Final help with difficult script - by Chilton - 10-14-2010, 02:57 AM



Users browsing this thread: 1 Guest(s)