Frictional Games Forum (read-only)
[SCRIPT] How to achieve this scenario? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] How to achieve this scenario? (/thread-20106.html)

Pages: 1 2


RE: How to achieve this scenario? - The chaser - 02-01-2013

(02-01-2013, 04:09 AM)serbusfish Wrote: Thanks for being patient with me, but something is still wrong because I pasted that exact code and the game throws up an error message saying 'ERR - expected '('.

It must have something to do with the line

"void BreakPotPlant(string &in asParent, string &in asChild, int alState)"

because the map loads when this is deleted. Am I supposed to replace the text in this line?

If it helps here is the entire content of my .hps file so far:

Code:
//===========================================
     // This runs when the map first starts
     void OnStart()
{

        if(ScriptDebugOn())

        
    {
              
       GiveItemFromFile("tinderbox", "tinderbox.ent);
              AddEntityCollideCallback("Player", "ScriptArea_2", "BreakPotPlant", true, 1);
                
     }         
  
}        
      
                     void BreakPotPlant(string &in asParent, string &in asChild, int alState)
                         {
                             SetPropHealth("pot_plant_small02_1", 0);
                         }

     //===========================================
     // This runs when the player enters the map
     void OnEnter()
   {
  
   //----AUDIO----//
    PlayMusic("10_amb", true, 5, 1, 0, true);
}
     //===========================================
     // This runs when the player leaves the map
     void OnLeave()
     {
     }

There, fixed it.


RE: How to achieve this scenario? - serbusfish - 02-01-2013

With your version it gives me the error 'Unexpected end of file', any ideas? Even to this n00b your code looks right.

EDIT: Fixed it! The tinderbox line was missing a ".

Im getting closer, now I need to try and make the camera look Smile


RE: How to achieve this scenario? - Kreekakon - 02-01-2013

(02-01-2013, 05:04 PM)serbusfish Wrote: With your version it gives me the error 'Unexpected end of file', any ideas? Even to this n00b your code looks right.

That probably means that one of the brackets in the code is out of place. Go check to see if all of them all have proper corresponding ones.

Notepad++ thankfully makes this extremely easy.


RE: How to achieve this scenario? - serbusfish - 02-03-2013

Well so far so good, I managed to make it so the pot breaks, the player looks, a monster growls, and a few secs later a door shuts. (I changed the monster walk to a growl as you couldnt hear the footsteps over the background music).

Now, sorry to be a pain again but rather than make another thread I was wondering if one of you kind gents could help me make a lever open a locked door? Does it have anything to do with this command?:

Code:
void SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);

I am getting more used to the scripting enviroment, but im not sure in this particular instance how you link the lever to the door I want opened?


RE: How to achieve this scenario? - The chaser - 02-03-2013

Oh, just:

void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever", "Call");
}

void Call (string &in asEntity, int alState)
{
SetSwingDoorLocked("Door", false, true);
}


RE: How to achieve this scenario? - serbusfish - 02-05-2013

(02-03-2013, 11:54 AM)The chaser Wrote: Oh, just:

void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever", "Call");
}

void Call (string &in asEntity, int alState)
{
SetSwingDoorLocked("Door", false, true);
}

Thank you i'll give it a try Big Grin


RE: How to achieve this scenario? - serbusfish - 02-08-2013

Update, I must be doing something wrong because the game wont load, here is what ive got:

Code:
void OnStart()
{


        if(ScriptDebugOn())
        SetEntityConnectionStateChangeCallback("lever_small01_1", "Call");
     }  
        void Call(string &in asEntity, int alState)
            
            {
            SetSwingDoorLocked("castle_arched01_6", false, true);
            }

What did I do?


RE: How to achieve this scenario? - FlawlessHappiness - 02-08-2013

What exactly is it you want with this line: "if(ScriptDebugOn())"?
It isn't used in any way, and it is probably the one that crashed the game.


RE: How to achieve this scenario? - serbusfish - 02-08-2013

(02-08-2013, 06:45 AM)BeeKayK Wrote: What exactly is it you want with this line: "if(ScriptDebugOn())"?
It isn't used in any way, and it is probably the one that crashed the game.

I dont know it was included in the tutorial script. I'll remove it and see what happens, but apart from that does my script look ok?


RE: How to achieve this scenario? - FlawlessHappiness - 02-08-2013

Yea it doesn't look like there should be any problems if you delete the line i specified.