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


Thread Rating:
  • 4 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anyone need help?
RawkBandMan Offline
Posting Freak

Posts: 1,146
Threads: 35
Joined: Nov 2010
Reputation: 5
RE: Anyone need help?

I have yet another question. Not much of a scripting question, because the scripting part of it I know.

How can I make it so it uses Justine's player files and not Daniel's? I mean the .ogg files that are "player_female_jump1" and that goes to 5. Please help. Thanks in advance.

I've come to learn to not fear the living, nor the dead... But the monsters that hide in closets.
05-21-2011, 03:36 PM
Find
Exostalker Offline
Member

Posts: 204
Threads: 10
Joined: Aug 2010
Reputation: 3
RE: Anyone need help?

This just gives me unexpected end of file error, could someone check what is wrong?
I checked it a few times and still can't figure out what's wrong...

////////////////////////////
// Run first time starting map
void OnStart()
{  
   GiveItemFromFile("lantern", "lantern.ent");

   for(int i=0;i< 10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");    
  
  
   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
/////-----HALLUCINATION-----//////
  AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
  /////-----REAL GRUNT DEACTIVATES-----/////
      AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate", "CollideAreaGruntDeactivate", true, 1);
    /////-----CLOSES THE DOORS-----/////
        AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate2", "DoorSwing", true, 1);    
        /////-----KEY OPENS CORIDOR DOORS AFTER GRUNT LOCKS THEM-----/////
    AddUseItemCallback("", "key_tomb_rusty_1", "mansion_4", "KeyOnDoor", true);         
    /////-----REAL GRUNT-----//////
      AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc2" , true , 1);
    /////-----HALLUCINATION 2 IN  SECRET CORIDOR-----//////
     AddEntityCollideCallback("Player" , "ScriptArea_3" , "MonsterFunc3" , true , 1);
     /////-----SHELF MOVES ONLY IF YOU  DROP BOOKS----/////
          SetLocalVarInt("Check", 0);
     SetEntityConnectionStateChangeCallback("secret_lever", "LevChangeFunc");
     for (int i = 1; i > 0 && i <= 3; i++)
     {
          AddEntityCollideCallback("book_shelf_"+i, "ScriptArea_5", "Func"+i, true, -1);
     }
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    }
    
         /////-----SHELF MOVES ONLY IF YOU  DROP BOOKS----/////
        
         void LevChangeFunc(string &in asEntity, int alState)
{
     if (GetLeverState("secret_lever") == 1)
     {
          if (GetLocalVarInt("Check") == 3)
          {
               SetLeverStuckState("secret_lever", 1, true);
     ConnectEntities("shelf_connection", "secret_lever", "secret_shelf", false, 1, "CreateDust");
               return;
          {
          else if (GetLocalVarInt("Check") != 3)
          {
               AddMessage("", "", 0); // Message you want to display when lever is pulled and the books are still on the shelf.
               return;
          }
     }
}
void Func1(string &in asParent, string &in asChild, int alState)
{
     AddLocalVarInt("Check", 1);
}
void Func2(string &in asParent, string &in asChild, int alState)
{
     AddLocalVarInt("Check", 1);
}
void Func3(string &in asParent, string &in asChild, int alState)
{
     AddLocalVarInt("Check", 1);
}
    
    /////-----HALLUCINATION-----//////
    
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_1" , true);
  
      AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
}

    /////-----REAL GRUNT-----//////
    
void MonsterFunc2(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_2" , true);
  
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_6", 0.0f, "");
        AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_7", 0.0f, "");
        AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_8", 0.0f, "");
        AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_9", 0.0f, "");
        AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_10", 0.0f, "");
        AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_11", 0.0f, "");
               AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_12", 0.0f, "");
                AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_13", 0.0f, "");
        AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_14", 0.0f, "");
            
  
}

  /////-----REAL GRUNT DEACTIVATES-----//////

void CollideAreaGruntDeactivate(string &in asParent, string &in asChild, int alState)
{
        SetEntityActive("servant_grunt_2", false);
        PlaySoundAtEntity("doorgruntleave","10_open_door.snt", "mansion_3", 0.5, false);
    
}

    /////-----CLOSES THE DOORS-----/////

void DoorSwing(string &in asParent, string &in asChild, int alState)
{
     SetSwingDoorClosed("mansion_4", true, true);
         SetSwingDoorLocked("mansion_4", true, true);
}

/////------LEVER MOVES SECRET SHELF-----//////

void CreateDust(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
    //for(int i=1;i<10;i++) AddPropForce("jara_"+i, 1.0f, 1.0f, 1.0f, "world");
    //for(int i=1;i<4;i++) AddPropForce("jbok_"+i, 1.0f, 1.0f, 1.0f, "world");
    
    if(GetLocalVarInt("DoSecretDoorEffects") == 1) return;
    
    CreateParticleSystemAtEntity("PSDoorDust", "ps_dust_falling_door.ps", "secret_door", false);
    
    AddTimer("sucess_music", 2, "TimerMusic");    
    
    AddTimer("Hint", 0.5f, "TimerHint");
    
    StartScreenShake(0.01f, 0.5f, 2.0f,2.0f);
    
    SetLocalVarInt("DoSecretDoorEffects", 1);
    
    FadeRadialBlurTo(1, 0.1f);
    
        PlayMusic("14_elevator_clank.ogg", false, 0.9f, 0, 1, false);
        
    
}

void TimerMusic(string &in asTimer)
{
    
    PlayMusic("01_puzzle_passage.ogg", false, 0.6f, 0.2f, 10, false);
    
     FadeRadialBlurTo(0.0, 3.2f);
}

        /////-----KEY OPENS CORIDOR DOORS AFTER GRUNT LOCKS THEM----/////
        
void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansion_4", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "mansion_4", 0.0f, true);
    RemoveItem("key_tomb_rusty_1");
}

            /////-----ONCE THE KEY IS PICKED UP, DOORS ARE UNLOCKED-----//////
void PickedUpKey(string &in asEntity, string &in asType) //Has to be the same name as the callback function.
{
   SetSwingDoorLocked("mansion_3", false, true);
    CheckPoint("check01","PlayerStartArea_3", "CheckPoint01", "Hints", "DeathGrunt_10_Daniels_Room_01");
}

    //////------FIRST CHECKPOINT-----//////
void CheckPoint01(string &in asName, int alCount)
{
    ResetProp("cabinet_simple_1");    
    ResetProp("mansion_3");
        ResetProp("mansion_4");
       SetSwingDoorLocked("mansion_3", false, true);
      
         AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc2" , true , 1);
                 AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate2", "DoorSwing", true, 1);    
      
}

    /////-----HALLUCINATION 2 IN  SECRET CORIDOR-----//////
    
void MonsterFunc3(string &in asParent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_3" , true);
  
      AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_100", 0, "");
}

////////////////////////////
// Run when entering map

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void OnEnter()
{

}

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

}

05-21-2011, 04:50 PM
Find
Modular100 Offline
Junior Member

Posts: 35
Threads: 5
Joined: Apr 2011
Reputation: 0
RE: Anyone need help?

void OnStart()
{

    AddEntityCollideCallback("Player", "EnemyActivate1", "Enemy1Collide", true, 1);

}

void Enemy1Collide(string &in asParent, string &in asChild, int alState);
{
    ShowEnemyPlayerPosition(string& asEnemy1);
    SetSwingDoorClosed("mansion_1", true, true);
}

I've been using this code to activate an enemy and close a door when the player enters an area, but the map won't load when I try to enter it.
But I get this error:
Main (9,1) : ERR  : Unexpected token '{'

Since I'm a complete noob at scripting, I'm not able to check my own code for mistakes, so I'll just miss the obvious. Some help would be very appreciated! Smile

05-22-2011, 04:30 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
RE: Anyone need help?

@Modular100,

It should be this:

void Enemy1Collide(string &in asParent, string &in asChild, int alState)

There is supposed to be no ; at the end of it.
@Exostalker,

Here it your script. You accidently forgot 2 "}"s.

void OnStart()
{
    GiveItemFromFile("lantern", "lantern.ent");
    for(int i=0;i< 10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");    
    AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
    AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate", "CollideAreaGruntDeactivate", true, 1);
    AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate2", "DoorSwing", true, 1);    
    AddUseItemCallback("", "key_tomb_rusty_1", "mansion_4", "KeyOnDoor", true);        
    AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc2" , true , 1);
    AddEntityCollideCallback("Player" , "ScriptArea_3" , "MonsterFunc3" , true , 1);
    SetLocalVarInt("Check", 0);
    SetEntityConnectionStateChangeCallback("secret_lever", "LevChangeFunc");
    for (int i = 1; i > 0 && i <= 3; i++)
    {
        AddEntityCollideCallback("book_shelf_"+i, "ScriptArea_5", "Func"+i, true, -1);
    }
}
void LevChangeFunc(string &in asEntity, int alState)
{
    if (GetLeverState("secret_lever") == 1)
    {
        if (GetLocalVarInt("Check") == 3)
        {
            SetLeverStuckState("secret_lever", 1, true);
            ConnectEntities("shelf_connection", "secret_lever", "secret_shelf", false, 1, "CreateDust");
            return;
        }
        else if (GetLocalVarInt("Check") != 3)
        {
            AddMessage("", "", 0);
            return;
        }
    }
}
void Func1(string &in asParent, string &in asChild, int alState)
{
     AddLocalVarInt("Check", 1);
}
void Func2(string &in asParent, string &in asChild, int alState)
{
     AddLocalVarInt("Check", 1);
}
void Func3(string &in asParent, string &in asChild, int alState)
{
     AddLocalVarInt("Check", 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
    SetEntityActive("servant_grunt_1" , true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
}
void MonsterFunc2(string &in asParent , string &in asChild , int alState)
{
    SetEntityActive("servant_grunt_2" , true);
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_6", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_7", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_8", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_9", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_10", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_11", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_12", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_13", 0.0f, "");
    AddEnemyPatrolNode("servant_grunt_2", "PathNodeArea_14", 0.0f, "");
}
void CollideAreaGruntDeactivate(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt_2", false);
    PlaySoundAtEntity("doorgruntleave","10_open_door.snt", "mansion_3", 0.5, false);
}
void DoorSwing(string &in asParent, string &in asChild, int alState)
{
    SetSwingDoorClosed("mansion_4", true, true);
    SetSwingDoorLocked("mansion_4", true, true);
}
void CreateDust(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
    if(GetLocalVarInt("DoSecretDoorEffects") == 1)
    {
        CreateParticleSystemAtEntity("PSDoorDust", "ps_dust_falling_door.ps", "secret_door", false);
        AddTimer("sucess_music", 2, "TimerMusic");    
        AddTimer("Hint", 0.5f, "TimerHint");
        StartScreenShake(0.01f, 0.5f, 2.0f,2.0f);
        SetLocalVarInt("DoSecretDoorEffects", 1);
        FadeRadialBlurTo(1, 0.1f);
        PlayMusic("14_elevator_clank.ogg", false, 0.9f, 0, 1, false);
        return;
    }
}
void TimerMusic(string &in asTimer)
{
    PlayMusic("01_puzzle_passage.ogg", false, 0.6f, 0.2f, 10, false);
    FadeRadialBlurTo(0.0, 3.2f);
}  
void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansion_4", false, true);
    PlaySoundAtEntity("", "unlock_door.snt", "mansion_4", 0.0f, true);
    RemoveItem("key_tomb_rusty_1");
}
void PickedUpKey(string &in asEntity, string &in asType)
{
    SetSwingDoorLocked("mansion_3", false, true);
    CheckPoint("check01","PlayerStartArea_3", "CheckPoint01", "Hints", "DeathGrunt_10_Daniels_Room_01");
}
void CheckPoint01(string &in asName, int alCount)
{
    ResetProp("cabinet_simple_1");    
    ResetProp("mansion_3");
    ResetProp("mansion_4");
    SetSwingDoorLocked("mansion_3", false, true);
    AddEntityCollideCallback("Player" , "ScriptArea_2" , "MonsterFunc2" , true , 1);
    AddEntityCollideCallback("servant_grunt_2", "AreaGruntDeactivate2", "DoorSwing", true, 1);      
}
void MonsterFunc3(string &in asParent , string &in asChild , int alState)
{
    SetEntityActive("servant_grunt_3" , true);
    AddEnemyPatrolNode("servant_grunt_3", "PathNodeArea_100", 0, "");
}
void OnEnter()
{
}
void OnLeave()
{
}

(05-21-2011, 03:36 PM)XxRoCkBaNdMaNxX Wrote: I have yet another question. Not much of a scripting question, because the scripting part of it I know.

How can I make it so it uses Justine's player files and not Daniel's? I mean the .ogg files that are "player_female_jump1" and that goes to 5. Please help. Thanks in advance.

If you go to "config" under the Amnesia file, there are "game.cfg" and "ptest_game.cfg".

If you want to, copy the Jump, Crouch, and Stand sounds from below into your "game.cfg" under the specified subtitle from below.

You can change it much more easier when you are making a full conversion, but if you want to change it permanently, open the "game.cfg" and open "ptest_game.cfg". In the "ptest_game.cfg", scroll down until you find the subtitle "<Player_Movement_Normal", there are these lines:

JumpSound = "player_female_jump"
CrouchSound = "player_crouch"
StandSound = "player_stand"

Copy them and then paste under the subtitle in your "game.cfg" file under the same subtitle. If you want to, you can change all the other movement speeds and whatnot.

Sorry if I sort of repeated myself. :p

P.S. You can remove these 3 lines from your "game.cfg" if you want to switch back to Daniel. Smile

(This post was last modified: 05-22-2011, 05:36 PM by Kyle.)
05-22-2011, 05:05 PM
Find
Modular100 Offline
Junior Member

Posts: 35
Threads: 5
Joined: Apr 2011
Reputation: 0
RE: Anyone need help?

Quote:@Modular100,

It should be this:

void Enemy1Collide(string &in asParent, string &in asChild, int alState)

There is supposed to be no ; at the end of it.

Thanks alot! You're a lifesaver! Smile

05-22-2011, 05:38 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
RE: Anyone need help?

(05-22-2011, 05:38 PM)Modular100 Wrote:
Quote:@Modular100,

It should be this:

void Enemy1Collide(string &in asParent, string &in asChild, int alState)

There is supposed to be no ; at the end of it.

Thanks alot! You're a lifesaver! Smile

You're welcome! And I'm only 13 years old. :p

05-22-2011, 05:41 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
RE: Anyone need help?

Kyle. How do i make a script so that when i take a key a monster spawns? AND! how do i make a script so that when i open a door it explodes and/or a entity comes with speed out of the room.
05-22-2011, 06:00 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
RE: Anyone need help?

(05-22-2011, 06:00 PM)xtron Wrote: Kyle. How do i make a script so that when i take a key a monster spawns? AND! how do i make a script so that when i open a door it explodes and/or a entity comes with speed out of the room.

I'm not sure what you mean with the second question, but the first one, you can try this:

void OnStart()
{
     SetEntityPlayerInteractCallback("KeyName", "Func01", true);
}
void Func01(string &in asEntity)
{
     SetEntityActive("MonsterName", true);
}

(This post was last modified: 05-22-2011, 06:42 PM by Kyle.)
05-22-2011, 06:41 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
RE: Anyone need help?

(05-22-2011, 06:41 PM)Kyle Wrote:
(05-22-2011, 06:00 PM)xtron Wrote: Kyle. How do i make a script so that when i take a key a monster spawns? AND! how do i make a script so that when i open a door it explodes and/or a entity comes with speed out of the room.

I'm not sure what you mean with the second question, but the first one, you can try this:

void OnStart()
{
     SetEntityPlayerInteractCallback("KeyName", "Func01", true);
}
void Func01(string &in asEntity)
{
     SetEntityActive("MonsterName", true);
}

Could you try add it for me since I don't understand. Is It possible to have a "SetEntity" at at "void onstart" ?. Cuz i added some keys etc and they're only "Add" and not "SetEntity".


Attached Files
.rar   script file.rar (Size: 765 bytes / Downloads: 126)

[Image: 44917299.jpg]Dubstep <3
05-22-2011, 07:26 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
RE: Anyone need help?

What is the name of the key that you want to be interacted with which then causes the monster to spawn?

What is the name of the monster that will spawn?

05-22-2011, 07:33 PM
Find




Users browsing this thread: 13 Guest(s)