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
#1
Final help with difficult script

This is what i need to do.

I have 4 chemical jars, i need them to be able to be mixed into a pot. I then need to be able to place the pot onto the ground near a barricade. Then just like the game i need it to blow up when hit by a rock. I then need the barricade to disappear so that my other barricade(which the broken version) will only be visible.

Any idea how to do this, or atleast start as this is my last script thread.
10-13-2010, 07:43 PM
Find
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
#2
RE: Final help with difficult script

You know you can just open that particular map's .hps file and just look at the exact code.

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
10-13-2010, 08:33 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#3
RE: Final help with difficult script

Lol... just, lol... Smile

Sometimes it is not always the best thing to do if you copy the script from the game. It wouldn't be original and also wouldn't be such a cool thing to do.

10-13-2010, 09:30 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#4
RE: Final help with difficult script

Problem is that we have 2 people here who just want others to create them the scripts instead of learning on their own.

10-13-2010, 09:40 PM
Find
HakePT Offline
Junior Member

Posts: 49
Threads: 1
Joined: Sep 2010
Reputation: 0
#5
RE: Final help with difficult script

(10-13-2010, 09:40 PM)Pandemoneus Wrote: Problem is that we have 2 people here who just want others to create them the scripts instead of learning on their own.

True.

Still create inactive items and make them active when your event happens.
That should work for the barricade. Activate particles, sound and a few random rocks flying and the change will be "easy".
10-13-2010, 10:24 PM
Find
LoneWolf Offline
Senior Member

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

(10-13-2010, 09:40 PM)Pandemoneus Wrote: Problem is that we have 2 people here who just want others to create them the scripts instead of learning on their own.

Why don't you stop spamming on my threads?

Did you know that you can learn from others? I guess you dont.
10-13-2010, 10:25 PM
Find
ide Offline
Junior Member

Posts: 20
Threads: 3
Joined: Oct 2010
Reputation: 0
#7
RE: Final help with difficult script

But if you get complete code handed out to you it won't teach you anything.

Afaik all one needs are these:
- List of script functions http://www.hpl2.frictionalgames.com/amne..._functions
- Knowledge of basic scripting (basic meaning knowing that: func(variables for function to use){what function does} and int=number, string=word in "", bool=true or false )
- Two brain cells to rub together
10-13-2010, 11:07 PM
Find
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
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#9
RE: Final help with difficult script

Scripts like this are not easy - But possible.
Unfortunately, its not possible for someone to give you a script because they would literally need to be controlling your screen just to know what theyre doing.

Huh
10-14-2010, 02:57 AM
Find
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
#10
RE: Final help with difficult script

(10-13-2010, 07:43 PM)LoneWolf Wrote: This is what i need to do.

I have 4 chemical jars, i need them to be able to be mixed into a pot. I then need to be able to place the pot onto the ground near a barricade. Then just like the game i need it to blow up when hit by a rock. I then need the barricade to disappear so that my other barricade(which the broken version) will only be visible.

Any idea how to do this, or atleast start as this is my last script thread.

What you are asking isn't really that hard to comprehend, it is just putting it into code.

Basically, you just have 4 AddCombineItemCallbacks for each of the jars. Then, you have a use item callback on the ground where you want the finished pot to go. Then, you add an AddEntityCollideCallback between a rock and the entity pot you just made. The callback for that function would probably shake the screen, fade out, set the barricade to inactive, and set the broken version to active.

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
10-14-2010, 08:33 AM
Find




Users browsing this thread: 3 Guest(s)