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
Recreating a Script
dailycreepypasta Offline
Junior Member

Posts: 32
Threads: 18
Joined: Aug 2014
Reputation: 0
#1
Recreating a Script

I'm try to recreate a script in Amnesia: TDD where in the storage areas you had to drill holes in the epoxy containers. I'm trying to use just pure knowledge but I ran into a problem. It works for one of the containers, but then it doesn't work for the others when I try the second part of the script (I'm trying to make it so you have a choice to drill into 3 epoxy containers, to fill a container until it's full. You have to drill 2 times, until it's half full and until it's completely full, and you can reuse the same epoxy container.) I think it's not recognizing the item trying to be reused (the drill) because I get rid of the item and give back the item with the same internal name. For the script, I have 3 script areas, one for the item interaction, one for a rotate area, and one for particles. I have a drill entity and an invisible box mass for the container.

PHP Code: (Select All)
void OnStart()
{
    
AddUseItemCallback("""HandDrill""InteractDrill_1""DrillHole1"false);
    
AddUseItemCallback("""HandDrill""InteractDrill_2""DrillHole2"false);
    
AddUseItemCallback("""HandDrill""InteractDrill_3""DrillHole3"false);
}

void DrillHole1(string &in asItemstring &in asEntity)
{
    if(
HasItem("Container_1") == true)
    {
        
RemoveItem(asItem);
        
SetEntityActive("InvisibleContainer_1"true);
        
SetEntityActive("HandDrill_1"true);
        
RemoveItem("Container_1");
        
AddAttachedPropToProp("InvisibleContainer_1""ContainerEmpty""chemical_container_static.ent"0,0,0,0,0,0);
        
AddTimer("interact1"1"StartDrillingHalf");
    }
    
    if(
HasItem("Container_Half") == true)
    {
        
RemoveItem(asItem);
        
SetEntityActive("InvisibleContainer_1"true);
        
SetEntityActive("HandDrill_1"true);
        
RemoveItem("Container_Half");
        
AddAttachedPropToProp("InvisibleContainer_1""ContainerHalfFull""chemical_container_half_static.ent"0,0,0,0,0,0);
        
AddTimer("interact4"1"StartDrillingHalf");
    }
    else
    {
        
SetMessage("Messages""NotEnough"3);
    }
}

void DrillHole2(string &in asItemstring &in asEntity)
{
    if(
HasItem("Container_1") == true)
    {
        
RemoveItem(asItem);
        
SetEntityActive("InvisibleContainer_2"true);
        
SetEntityActive("HandDrill_2"true);
        
RemoveItem("Container_1");
        
AddAttachedPropToProp("InvisibleContainer_2""ContainerEmpty""chemical_container_static.ent"0,0,0,0,0,0);
        
AddTimer("interact2"1"StartDrillingHalf");
    }
    
    if(
HasItem("Container_Half") == true)
    {
        
RemoveItem(asItem);
        
SetEntityActive("InvisibleContainer_2"true);
        
SetEntityActive("HandDrill_2"true);
        
RemoveItem("Container_Half");
        
AddAttachedPropToProp("InvisibleContainer_2""ContainerHalfFull""chemical_container_half_static.ent"0,0,0,0,0,0);
        
AddTimer("interact5"1"StartDrillingHalf");
    }
    else
    {
        
SetMessage("Messages""NotEnough"3);
    }
}

void DrillHole3(string &in asItemstring &in asEntity)
{
    if(
HasItem("Container_1") == true)
    {
        
RemoveItem(asItem);
        
SetEntityActive("InvisibleContainer_3"true);
        
SetEntityActive("HandDrill_3"true);
        
RemoveItem("Container_1");
        
AddAttachedPropToProp("InvisibleContainer_3""ContainerEmpty""chemical_container_static.ent"0,0,0,0,0,0);
        
AddTimer("interact3"1"StartDrillingHalf");
    }
    
    if(
HasItem("Container_Half") == true)
    {
        
RemoveItem(asItem);
        
SetEntityActive("InvisibleContainer_3"true);
        
SetEntityActive("HandDrill_3"true);
        
RemoveItem("Container_Half");
        
AddAttachedPropToProp("InvisibleContainer_3""ContainerHalfFull""chemical_container_half_static.ent"0,0,0,0,0,0);
        
AddTimer("interact6"1"StartDrillingHalf");
    }
    else
    {
        
SetMessage("Messages""NotEnough"3);
    }
}

void StartDrillingHalf(string &in asTimer)
{
    if(
asTimer == "interact1")
    {
        
RotatePropToSpeed("HandDrill_1"13, -18000false"AreaRotate_1");
        
CreateParticleSystemAtEntity("drip1","ps_liquid_epoxy_drip.ps""AreaParticleWine_1"false);
        
AddTimer("drilled1"5"GiveHalfContainer");
    }
    
    if(
asTimer == "interact2")
    {
        
RotatePropToSpeed("HandDrill_2"13, -18000false"AreaRotate_2");
        
CreateParticleSystemAtEntity("drip2","ps_liquid_epoxy_drip.ps""AreaParticleWine_2"false);
        
AddTimer("drilled2"5"GiveHalfContainer");
    }
    
    if(
asTimer == "interact3")
    {
        
RotatePropToSpeed("HandDrill_3"13, -18000false"AreaRotate_3");
        
CreateParticleSystemAtEntity("drip3","ps_liquid_epoxy_drip.ps""AreaParticleWine_3"false);
        
AddTimer("drilled3"5"GiveHalfContainer");
    }
    if(
asTimer == "interact4")
    {
        
RotatePropToSpeed("HandDrill_1"13, -18000false"AreaRotate_1");
        
CreateParticleSystemAtEntity("drip4","ps_liquid_epoxy_drip.ps""AreaParticleWine_1"false);
        
AddTimer("drilled4"5"GiveFullContainer");
    }
    if(
asTimer == "interact5")
    {
        
RotatePropToSpeed("HandDrill_2"13, -18000false"AreaRotate_2");
        
CreateParticleSystemAtEntity("drip5","ps_liquid_epoxy_drip.ps""AreaParticleWine_2"false);
        
AddTimer("drilled5"5"GiveFullContainer");
    }
    if(
asTimer == "interact6")
    {
        
RotatePropToSpeed("HandDrill_3"13, -18000false"AreaRotate_3");
        
CreateParticleSystemAtEntity("drip6","ps_liquid_epoxy_drip.ps""AreaParticleWine_3"false);
        
AddTimer("drilled6"5"GiveFullContainer");
    }
}

void GiveHalfContainer(string &in asTimer)
{
    if(
asTimer == "drilled1")
    {
        
DestroyParticleSystem("drip1");
        
RotatePropToSpeed("HandDrill_1"00000false"AreaRotate_1");
        
RemoveAttachedPropFromProp("InvisibleContainer_1""ContainerEmpty");
        
AddAttachedPropToProp("InvisibleContainer_1""ContainerHalf""chemical_container_half_static.ent"0,0,0,0,0,0);
        
SetEntityCustomFocusCrossHair("InvisibleContainer_1","Pick");
        
SetEntityPlayerInteractCallback("InvisibleContainer_1""PickUpHalfContainer"true);
        
SetEntityActive("PickDrill_1"true);
    }
    if(
asTimer == "drilled2")
    {
        
DestroyParticleSystem("drip2");
        
RotatePropToSpeed("HandDrill_2"00000false"AreaRotate_2");
        
RemoveAttachedPropFromProp("InvisibleContainer_2""ContainerEmpty");
        
AddAttachedPropToProp("InvisibleContainer_2""ContainerHalf""chemical_container_half_static.ent"0,0,0,0,0,0);
        
SetEntityCustomFocusCrossHair("InvisibleContainer_2","Pick");
        
SetEntityPlayerInteractCallback("InvisibleContainer_2""PickUpHalfContainer2"true);
        
SetEntityActive("PickDrill_2"true);
    }
    if(
asTimer == "drilled3")
    {
        
DestroyParticleSystem("drip3");
        
RotatePropToSpeed("HandDrill_3"00000false"AreaRotate_3");
        
RemoveAttachedPropFromProp("InvisibleContainer_3""ContainerEmpty");
        
AddAttachedPropToProp("InvisibleContainer_3""ContainerHalf""chemical_container_half_static.ent"0,0,0,0,0,0);
        
SetEntityCustomFocusCrossHair("InvisibleContainer_3","Pick");
        
SetEntityPlayerInteractCallback("InvisibleContainer_3""PickUpHalfContainer3"true);
        
SetEntityActive("PickDrill_3"true);
    }
}

void GiveFullContainer(string &in asTimer)
{
    if(
asTimer == "drilled4")
    {
        
DestroyParticleSystem("drip4");
        
RotatePropToSpeed("HandDrill_1"00000false"AreaRotate_1");
        
RemoveAttachedPropFromProp("InvisibleContainer_1""ContainerHalfFull");
        
AddAttachedPropToProp("InvisibleContainer_1""ContainerFull""chemical_container_epoxy_static.ent"0,0,0,0,0,0);
        
SetEntityCustomFocusCrossHair("InvisibleContainer_1","Pick");
        
SetEntityPlayerInteractCallback("InvisibleContainer_1""PickUpFullContainer"true);
    }
    if(
asTimer == "drilled5")
    {
        
DestroyParticleSystem("drip5");
        
RotatePropToSpeed("HandDrill_2"00000false"AreaRotate_2");
        
RemoveAttachedPropFromProp("InvisibleContainer_2""ContainerHalfFull");
        
AddAttachedPropToProp("InvisibleContainer_2""ContainerFull""chemical_container_epoxy_static.ent"0,0,0,0,0,0);
        
SetEntityCustomFocusCrossHair("InvisibleContainer_2","Pick");
        
SetEntityPlayerInteractCallback("InvisibleContainer_2""PickUpFullContainer2"true);
    }
    if(
asTimer == "drilled6")
    {
        
DestroyParticleSystem("drip6");
        
RotatePropToSpeed("HandDrill_3"00000false"AreaRotate_3");
        
RemoveAttachedPropFromProp("InvisibleContainer_3""ContainerHalfFull");
        
AddAttachedPropToProp("InvisibleContainer_3""ContainerFull""chemical_container_epoxy_static.ent"0,0,0,0,0,0);
        
SetEntityCustomFocusCrossHair("InvisibleContainer_3","Pick");
        
SetEntityPlayerInteractCallback("InvisibleContainer_3""PickUpFullContainer3"true);
    }
}

void PickUpHalfContainer(string &in asEntity)
{
    
RemoveAttachedPropFromProp("InvisibleContainer_1""ContainerHalf");
    
SetEntityActive("InvisibleContainer_1"false);
    
GiveItem("ContainerHalf_Item""Puzzle""ContainerHalf""chemical_container_epoxy.tga"1);
    
SetEntityCustomFocusCrossHair("HandDrill_1","Pick");
    
SetEntityPlayerInteractCallback("HandDrill_1""PickUpDrill"true);
}

void PickUpHalfContainer2(string &in asEntity)
{
    
RemoveAttachedPropFromProp("InvisibleContainer_2""ContainerHalf");
    
SetEntityActive("InvisibleContainer_2"false);
    
GiveItem("ContainerHalf_Item""Puzzle""ContainerHalf""chemical_container_epoxy.tga"1);
    
SetEntityCustomFocusCrossHair("HandDrill_2","Pick");
    
SetEntityPlayerInteractCallback("HandDrill_2""PickUpDrill"true);
}

void PickUpHalfContainer3(string &in asEntity)
{
    
RemoveAttachedPropFromProp("InvisibleContainer_3""ContainerHalf");
    
SetEntityActive("InvisibleContainer_3"false);
    
GiveItem("ContainerHalf_Item""Puzzle""ContainerHalf""chemical_container_epoxy.tga"1);
    
SetEntityCustomFocusCrossHair("HandDrill_3","Pick");
    
SetEntityPlayerInteractCallback("HandDrill_3""PickUpDrill"true);
}

void PickUpFullContainer(string &in asEntity)
{
    
RemoveAttachedPropFromProp("InvisibleContainer_1""ContainerFull");
    
SetEntityActive("InvisibleContainer_1"false);
    
GiveItem("ContainerFull_Item""Puzzle""ContainerFull""chemical_container_epoxy.tga"1);
    
SetEntityActive("InteractDrill_1"false);
    
SetEntityActive("InteractDrill_2"false);
    
SetEntityActive("InteractDrill_3"false);
}

void PickUpFullContainer2(string &in asEntity)
{
    
RemoveAttachedPropFromProp("InvisibleContainer_2""ContainerFull");
    
SetEntityActive("InvisibleContainer_2"false);
    
GiveItem("ContainerFull_Item""Puzzle""ContainerFull""chemical_container_epoxy.tga"1);
    
SetEntityActive("InteractDrill_1"false);
    
SetEntityActive("InteractDrill_2"false);
    
SetEntityActive("InteractDrill_3"false);
}

void PickUpFullContainer3(string &in asEntity)
{
    
RemoveAttachedPropFromProp("InvisibleContainer_3""ContainerFull");
    
SetEntityActive("InvisibleContainer_3"false);
    
GiveItem("ContainerFull_Item""Puzzle""ContainerFull""chemical_container_epoxy.tga"1);
    
SetEntityActive("InteractDrill_1"false);
    
SetEntityActive("InteractDrill_2"false);
    
SetEntityActive("InteractDrill_3"false);
}

void GetDrill(string &in asEntity)
{
    
GiveItem("HandDrill""Puzzle""DrillFinal""hand_drill.tga"1);
    
SetEntityActive(asEntityfalse);
    if(
asEntity == "PickDrill_1")
    {
        
SetEntityActive("HandDrill_1"false);
    }
    
    if(
asEntity == "PickDrill_2")
    {
        
SetEntityActive("HandDrill_2"false);
    }
    
    if(
asEntity == "PickDrill_3")
    {
        
SetEntityActive("HandDrill_3"false);
    }


If anything, can you at least give me an idea on how to recreate the script?

Creator of "The Night I Went Insane".

http://www.moddb.com/mods/the-night-i-went-insane
03-18-2015, 07:03 AM
Find




Users browsing this thread: 1 Guest(s)