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 Combining and more :S Help!
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Combining and more :S Help!

void OnStart()
{

    SetLocalVarInt("CellarDoorOpen", 0);
    SetLocalVarInt("FirstTimeCellar", 1);
    SetLocalVarInt("Ingredients", 0);
    
    AddUseItemCallback("RopeToDynamite", "dynamite_static", "rope", "UseRopeOnDynamite", true);
    AddUseItemCallback("NitroglycerinToDynamite", "Nitroglycerin", "dynamite_static", "UseNitroglycerinOnDynamite", true);
    SetEntityPlayerInteractCallback("dynamite_inventory", "DynamiteLit", true);
    AddUseItemCallback("", "Cellar_Key", "ScriptArea_2", "OpenCellarDoor1", true); // Unlocking The Cellar Door.
    SetEntityPlayerInteractCallback("ScriptArea_2", "EnterCellar", false); // Entering Cellar 'Telport Player'.
    SetEntityPlayerInteractCallback("ScriptArea_3", "LeaveCellar", false); // Leaving Cellar 'Telport Player'.
    AddEntityCollideCallback("Player", "Teleport_Intro_Cave", "EnterCave", true, 1); // When Player Has Lantern Go To Func TeleportToCave
    AddEntityCollideCallback("Player", "Forrest_Area", "EnterForrest", true, 1); // Teleport Into Forrest.
    AddEntityCollideCallback("Player", "TeleportCave", "TeleportToCave", true, 1); // Teleport Into Cave.
    AddEntityCollideCallback("Player", "CaveEvent1", "Collaps", true, 1); // Collapse Cave Event Happen.


    
    SetPlayerLampOil(10); // Set oil 10% When get Lantern.
    
}

void OpenCellarDoor1(string &in asItem, string &in asEntity) // Unlocking The Cellar Door.
{
    SetLocalVarInt("CellarDoorOpen", 1);
    PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
    RemoveItem(asItem);
}

void EnterCellar(string &in asEntity) // Teleport Player Into The Cellar.
{
    if(GetLocalVarInt("CellarDoorOpen") != 1) {
        SetMessage("Messages", "DoorLocked", 0);
        return;
    }
    
    TeleportPlayer("InsideCellar");
    
    if(GetLocalVarInt("FirstTimeCellar") == 1) {
        SetMessage("Messages", "EnteringTheCellar", 0);
        SetLocalVarInt("FirstTimeCellar", 0);
    }
}

void LeaveCellar(string &in asEntity) // Teleport Player Outside The Cellar.
{
    TeleportPlayer("OutsideCellar");
}

void EnterCave (string &in asParent, string &in asChild, int alState) // When Player Has Lantern He Teleport Inside Cave.
{
    if(HasItem("lantern")) {
    TeleportPlayer("InsideCave");
    SetEntityActive("block_box_cave", false);
}
else {
    SetMessage("Messages", "NeedLantern", 4);
}

}

void JakeStorageEmotion(string &in asArea) // Emotion To Activate Ladder.
{
    StartEffectEmotionFlash("Messages", "JakesStorageEmotion", "ui_insanity_touch.snt");
    
    SetEntityActive("LadderAreaStorage", true);
}

void EnterForrest (string &in asParent, string &in asChild, int alState) // When Trying Enter Forrest Set Message.
{
    SetMessage("Messages", "ForrestEnter", 4);
}

void TeleportToCave (string &in asParent, string &in asChild, int alState) // Teleporting Player Inside Cave.
{
    TeleportPlayer("InsideCave");
}

void Collaps (string &in asParent, string &in asChild, int alState) // Collapse Event Happens On Cave Enter.

{
    SetEntityActive("rock_debris_brown02_1", true);
    SetEntityActive("rock_debris_brown01_2", true);
    SetEntityActive("rock_debris_brown01_1", true);
    SetEntityActive("rock_debris_brown01_3", true);
    SetEntityActive("rock_debris_brown02_2", true);
    SetEntityActive("rock_debris_brown02_3", true);
    SetEntityActive("rock_debris_brown01_4", true);
    SetEntityActive("rock_debris_brown01_5", true);
    SetEntityActive("rock_debris_brown02_4", true);
    SetEntityActive("rock_debris_brown01_6", true);
    SetEntityActive("rock_debris_brown02_5", true);
    SetEntityActive("rock_debris_brown01_7", true);
    SetEntityActive("rock_debris_brown02_5", true);
    SetEntityActive("rock_debris_brown01_8", true);
    SetEntityActive("rock_debris_brown01_7", true);
    SetEntityActive("rock_debris_brown02_6", true);
    SetEntityActive("hanging_lantern_ceiling_2", false);
    SetEntityActive("PointLight_11", false);
    SetEntityActive("PointLight_15", true);
    SetEntityActive("hanging_lantern_ceiling_3", true);
    SetPlayerActive(false);
    MovePlayerHeadPos(0.25f, -1.3f, 0, 1, 1.5f);
    FadePlayerRollTo(90, 1.1, 3);
    AddTimer("", 0.5, "Collaps2");
    PlayMusic("03_rock_move3.ogg", true, 3, 0, 1, true);
    StartScreenShake(0.20f, 1.4f, 0.0f,1.0f);
    SetPlayerCrouching(true);
}
void Collaps2 (string &in asTimer) // Timer Collapse Event Effects 1.
{
    PlaySoundAtEntity("playerfall", "player_bodyfall.snt", "Player", 1, true);
    StartPlayerLookAt("AreaLook", 2.5f, 2.5f, "");
    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
    AddTimer("", 2.0, "Collaps3");
}
void Collaps3 (string &in asTimer) // Timer Collapse Event Effects 2.
{
    MovePlayerHeadPos(0.00f, -0.0f, 0, 45, 6.5f);
    FadePlayerRollTo(0, 45, 45);
    PlaySoundAtEntity("cough", "player_cough.snt", "Player", 1, true);
    CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact_1", false);
    StopPlayerLookAt();
    SetPlayerCrouching(false);
    SetPlayerActive(true);
    StopMusic(0, 1);
}

void Toxic(string &in asEntity) // Start Toxic Event!
{
    SetMessage("Messages", "ToxicText", 4);
    SetEntityActive("ToxicDamage", true);
    SetEntityActive("ToxicLabatory", false);
}

void ToxicDamage(string &in asEntity) // Getting ToxicDamage!
{
    GivePlayerDamage(10.0f, "BloodSplat", false, false);
}

void GetRope(string &in asEntity)
{
    GiveItem("rope_beam02_1", "string_pile.ent", "Rope_Dynamite", "pile_string.tga", 1);
    SetEntityActive("rope_beam02_1", false);
    SetMessage("Messages", "Rope", 4);
}

void UseRopeOnDynamite(string &in asItem, string &in asEntity)
{
AddLocalVarInt("Ingredients", 1);
CheckIngredient();
}

void UseNitroglycerinOnDynamite(string &in asItem, string &in asEntity)
{
AddLocalVarInt("Ingredients", 1);
CheckIngredient();
}

void CheckIngredient()
{
if(GetLocalVarInt("Ingredients") == 2)
{
SetMessage("Messages", "Dynamite", 0);
SetEntityActive("dynamite_static", false);
SetEntityActive("dynamite_inventory", true);
}
}

void DynamiteLit(string &in asEntity)
{
SetLampLit("dynamite_inventory", true, false);
AddTimer("", 7.15f, "DynamiteExplode");
}

void DynamiteExplode(string &in asTimer)
{
SetEntityActive("dynamite_inventory", false);
SetEntityActive("RockEntrance1", false); //First rock to be destroyed.
SetEntityActive("RockEntrance2", false); //Second one.
AddDebugMessage("KABOOOOOM!!!", false);
CreateParticleSystemAtEntity("", "PSFile.ps", "ScriptAreaName", false);
}

////////////////////////////
// Run when entering map
void OnEnter()
{    
    AutoSave();
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Sorry, that was a mistake at my end. Here's the fixed script.

EDIT:
Seems like you want a particle when it explodes. I've put a parameter up there. Make sure you create a small - medium sized script area where you want the particle to be, and then change the stuff up there.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 06-11-2013, 02:14 AM by PutraenusAlivius.)
06-11-2013, 02:03 AM
Find


Messages In This Thread
RE: Combining and more :S Help! - by Bridge - 06-10-2013, 07:47 PM
RE: Combining and more :S Help! - by PutraenusAlivius - 06-11-2013, 02:03 AM



Users browsing this thread: 1 Guest(s)