Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Several advanced(probably) questions
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Several advanced(probably) questions

Wew, a lot of things at once.

1. Short answer; no. We don't have the source code.

Long answer: No - and frankly, don't use too many spotlights. Just use a Pointlight or a few. You don't need to have shadows everywhere, and given how bright that lamp is (it's too bright, it's white light, mind you), even if a shadow were cast, light bouncing off walls would really lower the amount of shadow.

2. Ropes will try to always go 'as the crow flies' from point A to point B; through walls and objects if they must. They will elasticise and rest (think of it like how gravity arches a piece of string downward if there is slack) but will still go through the floor, off the top of my head. Your issue with the objects may be more linked to the strength of the rope. I don't have much experience with ropes but it wouldn't surprise me if what you are trying to do is a bit difficult with ropes alone, but you may have more luck with an edited model, since I bet you can get a similar effect with how the pig corpse and an interactable ragdoll work.

3. Put a PathNode on each step.

4. Create a ScriptArea around the door, and add a collide callback where the enemy or enemies are parents and the ScriptArea is the child. Check for what state the monster is in, and open the door using force when they enter the area, and close it when they exit.

Spoiler below!

PHP Code: (Select All)
void OnEnter()
{
    
AddEntityCollideCallback("servant_grunt_1""ScriptDoorOpen_1""InteractWithDoor"false0);
}

void InteractWithDoor(string &in asParentstring &in asChildint alState)
{
    
//You need to edit this code, supply the name of the door to open 
    //as it is named in your map. You can also use "|| (GetEnemyStateName(asParent)"
    //to check for more than just the Patrol state. See the Engine Scripts page.
    
    
string door "<name of door>";
    if(
alState == 1)
    {

        if(
GetEnemyStateName(asParent) == "Patrol")
        {
            
//Enemy has entered area and is just patrolling (normal walking state).
            //First set the door to not close automatically so it can be opened via script.
            
SetSwingDoorDisableAutoClose(doortrue);
            
//Now open the door. You may want to use either AddPropForce or AddPropImpulse. 
            //Open against Positive/Negative X/Z axis depending on which way the door faces.
        
}
    }
    else
    {
        
//Enemy leaves area. Just close the door.
        
SetSwingDoorDisableAutoClose(doorfalse);
        
SetSwingDoorClosed(doortruetrue);
    }


Please see Conditionals and the Engine Scripts page for more information about the code segment above.

If you are using a retail copy of Amnesia (i.e., you purchased it from Frictional Games directly or bought it in stores forever ago), you need to be on Update 1.3 or above to use GetEnemyStateName. If you need to update, you can do so from here.

5. Personally, I'd keep track of a variable which functions like a boolean, and just switch between the two.

Spoiler below!

PHP Code: (Select All)
void Phonograph(string &in asEntityNameint alState)
{
    if(
alState == 1)
    {
        if(
GetLocalVarInt("PhonographPlaying") == 1)
        {
            
StopMusic(13);
            
SetLocalVarInt("PhonographPlaying"0);
        }
    }
    else
    {
        
PlayMusic("Mus1.ogg"false133false);
        
SetLocalVarInt("PhonographPlaying"1);
    }
    
SetWheelInteractionDisablesStuck("Phonograph"true);
    
SetWheelAngle("Phonograph", -180false);



6. Now I think you can move Areas with SetEntityPos(). As such, you should be able to move Liquid Areas using a looping timer. Place down the water plane entity in entities/special/water_planes/ and use SetEntityPos to raise the entity, and do the same with the LiquidArea. Repeat until greater than the desired height. Have the LiquidArea scaled in such a way that its topmost bit is in line with the entity for the best effect.

Spoiler below!

PHP Code: (Select All)
void RiseWater(string &in asTimer)
{
    
//Increase or decrease these to change the speed or rise of the water.
    
float TimerTick 0.25f //Tick every 1/4th of a second
    
float increaseY 0.125f //Rise by 0.125f on the Y axis.
    
    //Do until greater than the desired height. In this case, 3.5 Y.
    
if(GetEntityPosY("water_plane_ch02_16") > 3.5f)
    {
        
SetEntityPos("LiquidArea_1"GetEntityPosX("LiquidArea_1"), GetEntityPosY("LiquidArea_1")+increaseYGetEntityPosZ("LiquidArea_1");
        
SetEntityPos("water_plane_ch02_16"GetEntityPosX("water_plane_ch02_16"), GetEntityPosY("water_plane_ch02_16")+increaseYGetEntityPosZ("water_plane_ch02_16");
    }
    else 
AddTimer("newRiseWaterTimer"TimerTick"RiseWater");



Discord: Romulator#0001
[Image: 3f6f01a904.png]
06-19-2019, 12:49 PM
Find


Messages In This Thread
RE: Several advanced(probably) questions - by Romulator - 06-19-2019, 12:49 PM



Users browsing this thread: 1 Guest(s)