Frictional Games Forum (read-only)
[SCRIPT] Collapse - 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] Collapse (/thread-11016.html)

Pages: 1 2


Collapse - Sauron The King - 10-27-2011

Hello,

I am new to scripting and I wanted to make a hallway in which a part collapses.

When you enter the Zone "Collapse_Sleepingrooms", the entity "cave_in_1" will become active, a sound of crushing stones will sound ("04_rock_break.snt") and smoke will come out of the hallway.

I have made the following:

Code:
//////////////////////////////////////////////////
// Slaapkamer Geheime doorgang
void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever_Sleepingroom", "func_shelf");
}


void func_shelf(string &in asEntity, int alState)
{
    if (alState == 1)
    {
    SetMoveObjectState("Shelf_Secret_Sleepingroom",1.0f);
    PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
          return;
    }
}
//////////////////////////////////////////////////
// Slaapkamer boel stort in
void Onstart ()
{AddEntityCollideCallback("Player", "Collapse_Sleepingrooms", "Collidewhencollapse", "true", 1);}

{void SetEntityActive("cave_in_1", "true");}

I need to know what I have to do after this, because I won't get any further. If I test it now, I will get the following error:
[attachment=2161]

Could someone help me with this?

Kind regards,
Brian



RE: Collapse - Your Computer - 10-27-2011

You missed a function header on the last code block.


RE: Collapse - Sauron The King - 10-28-2011

(10-27-2011, 11:58 PM)Your Computer Wrote: You missed a function header on the last code block.
How do you add a function header and how should it look like in my scripts?
Yes I know, I am noobie at this. This is the first time working with it.





RE: Collapse - flamez3 - 10-28-2011

(10-28-2011, 09:50 AM)Sauron The King Wrote:
(10-27-2011, 11:58 PM)Your Computer Wrote: You missed a function header on the last code block.
How do you add a function header and how should it look like in my scripts?
Yes I know, I am noobie at this. This is the first time working with it.
You can't have a event happening anywhere, it has to be in a function block for it to work.

False:

PHP Code:
void Onstart ()
{
AddEntityCollideCallback("Player""Collapse_Sleepingrooms""Collidewhencollapse""true"1);}

{
void SetEntityActive("cave_in_1""true");} 



True:


PHP Code:
void Onstart ()
{
AddEntityCollideCallback("Player""Collapse_Sleepingrooms""Collidewhencollapse""true"1);}

void Collidewhencollapse(string &in asParentstring &in asChildint alState)
{    
void SetEntityActive("cave_in_1""true");} 


It might be hard to read due to formatting of the text in the forums though :S




RE: Collapse - devin413 - 10-28-2011

Spoiler below!

void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("Shelf_Secret_Sleepingroom",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

//////////////////////////////////////////////////
// Slaapkamer boel stort in





//////////////////////////////////////////////////
// Slaapkamer Geheime doorgang
//yehh a german one was geht Big Grin


void OnEnter()
{
AddEntityCollideCallback("Player", "Collapse_Sleepingrooms", "Collidewhencollapse", true, 1);



SetEntityActive("cave_in_1", true);



SetEntityConnectionStateChangeCallback("Lever_Sleepingroom", "func_shelf");
}

// True never made so "True" you must make it so SetEntityActive("cave_in_1", true);
//SetEntityActive(string& asName, bool abActive); bool abActive = True or False it dont need to declaration


hope that helps you


RE: Collapse - Sauron The King - 10-28-2011

Thanks for the quick responses!
And actually I am a dutchman Smile (From holland)

After I read the posts, I made this:

Code:
//////////////////////////////////////////////////
// Slaapkamer Geheime doorgang
void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever_Sleepingroom", "func_shelf");
}


void func_shelf(string &in asEntity, int alState)
{
    if (alState == 1)
    {
    SetMoveObjectState("Shelf_Secret_Sleepingroom",1.0f);
    PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
          return;
    }
}
//////////////////////////////////////////////////
// Slaapkamer boel stort in
void OnEnter()
{
AddEntityCollideCallback("Player", "Collapse_Sleepingrooms", "Collidewhencollapse", true, 1);
}

void Collidewhencollapse(string &in asParent, string &in asChild, int alState)
{SetEntityActive("cave_in_1", "true");}

If I left "void Collidewhencollapse(string &in asParent, string &in asChild, int alState)" away, the Entity (The fallen rocks) will be there right away. So I thought that I would make the rocks appear after I entered the area by adding that sentence.
If I play my map now, I will get the following error:
"FATAL ERROR: Could not load script file 'mymaps/The_Haunted_Castle_of_Algium.hps'!
main (26,2): ERR : No matching signatures to 'SetEntityActive(string@&, string @&)'

I want the rocks to appear after I entered the area. When they appear, there must be a sound of collapsing stones.
Thanks for helping me before, but could you help me further with this?





RE: Collapse - flamez3 - 10-28-2011

(10-28-2011, 12:53 PM)Sauron The King Wrote: Thanks for the quick responses!
And actually I am a dutchman Smile (From holland)

After I read the posts, I made this:

Code:
//////////////////////////////////////////////////
// Slaapkamer Geheime doorgang
void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever_Sleepingroom", "func_shelf");
}


void func_shelf(string &in asEntity, int alState)
{
    if (alState == 1)
    {
    SetMoveObjectState("Shelf_Secret_Sleepingroom",1.0f);
    PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
          return;
    }
}
//////////////////////////////////////////////////
// Slaapkamer boel stort in
void OnEnter()
{
AddEntityCollideCallback("Player", "Collapse_Sleepingrooms", "Collidewhencollapse", true, 1);
}

void Collidewhencollapse(string &in asParent, string &in asChild, int alState)
{SetEntityActive("cave_in_1", "true");}

If I left "void Collidewhencollapse(string &in asParent, string &in asChild, int alState)" away, the Entity (The fallen rocks) will be there right away. So I thought that I would make the rocks appear after I entered the area by adding that sentence.
If I play my map now, I will get the following error:
"FATAL ERROR: Could not load script file 'mymaps/The_Haunted_Castle_of_Algium.hps'!
main (26,2): ERR : No matching signatures to 'SetEntityActive(string@&, string @&)'

I want the rocks to appear after I entered the area. When they appear, there must be a sound of collapsing stones.
Thanks for helping me before, but could you help me further with this?
This happened because you have put "" around a bool. Bools do not need "" around them. change "true" to true





RE: Collapse - devin413 - 10-28-2011

Spoiler below!

void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("Shelf_Secret_Sleepingroom",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
//////////////////////////////////////////////////
// Slaapkamer boel stort in



void Collidewhencollapse(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("RockSound", "explosion_rock_large.snt", "Player", 0.0F, false);
StartScreenShake(0.2, 2, 0.2, 0.2);
SetEntityActive("cave_in_1", true);
}


void OnEnter()
{
SetEntityConnectionStateChangeCallback("Lever_Sleepingroom", "func_shelf");




//AddEntityCollide//

AddEntityCollideCallback("Player", "Collapse_Sleepingrooms", "Collidewhencollapse", true, 1);
}


hope you mean that like i do it
i add a screen shake




RE: Collapse - flamez3 - 10-28-2011

(10-28-2011, 02:44 PM)devin413 Wrote:
Spoiler below!

void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("Shelf_Secret_Sleepingroom",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
//////////////////////////////////////////////////
// Slaapkamer boel stort in



void Collidewhencollapse(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("RockSound", "explosion_rock_large.snt", "Player", 0.0F, false);
StartScreenShake(0.2, 2, 0.2, 0.2);
SetEntityActive("cave_in_1", true);
}


void OnEnter()
{
SetEntityConnectionStateChangeCallback("Lever_Sleepingroom", "func_shelf");




//AddEntityCollide//

AddEntityCollideCallback("Player", "Collapse_Sleepingrooms", "Collidewhencollapse", true, 1);
}


hope you mean that like i do it
i add a screen shake
You have a 0.2 on your screen shake and to be safe make sure you put a f after them.


RE: Collapse - devin413 - 10-28-2011

rofl >.> i nerver make an f behind it Big Grin