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
Script Help Collapse
Sauron The King Offline
Junior Member

Posts: 42
Threads: 10
Joined: Oct 2011
Reputation: 0
#1
Collapse

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:

//////////////////////////////////////////////////
// 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:

.jpg   Naamloos2.jpg (Size: 43.15 KB / Downloads: 140)

Could someone help me with this?

Kind regards,
Brian


Attached Files
.jpg   Naamloos.jpg (Size: 26 KB / Downloads: 107)
10-27-2011, 11:52 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Collapse

You missed a function header on the last code block.

Tutorials: From Noob to Pro
10-27-2011, 11:58 PM
Website Find
Sauron The King Offline
Junior Member

Posts: 42
Threads: 10
Joined: Oct 2011
Reputation: 0
#3
RE: Collapse

(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.


10-28-2011, 09:50 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: Collapse

(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: (Select All)
void Onstart ()
{
AddEntityCollideCallback("Player""Collapse_Sleepingrooms""Collidewhencollapse""true"1);}

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



True:


PHP Code: (Select All)
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


(This post was last modified: 10-28-2011, 10:15 AM by flamez3.)
10-28-2011, 10:13 AM
Find
devin413 Offline
Member

Posts: 175
Threads: 7
Joined: Jul 2011
Reputation: 3
#5
RE: Collapse

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

Boris Game Studios: Devin413 Moddels Maps Scripts.
Tenebris Lake
Killings In Altstadt

(This post was last modified: 10-28-2011, 02:33 PM by devin413.)
10-28-2011, 12:12 PM
Find
Sauron The King Offline
Junior Member

Posts: 42
Threads: 10
Joined: Oct 2011
Reputation: 0
#6
RE: Collapse

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

After I read the posts, I made this:

//////////////////////////////////////////////////
// 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?


10-28-2011, 12:53 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#7
RE: Collapse

(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:

//////////////////////////////////////////////////
// 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



10-28-2011, 01:15 PM
Find
devin413 Offline
Member

Posts: 175
Threads: 7
Joined: Jul 2011
Reputation: 3
#8
RE: Collapse

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


Boris Game Studios: Devin413 Moddels Maps Scripts.
Tenebris Lake
Killings In Altstadt

(This post was last modified: 10-28-2011, 02:50 PM by devin413.)
10-28-2011, 02:44 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#9
RE: Collapse

(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.

10-28-2011, 03:09 PM
Find
devin413 Offline
Member

Posts: 175
Threads: 7
Joined: Jul 2011
Reputation: 3
#10
RE: Collapse

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

Boris Game Studios: Devin413 Moddels Maps Scripts.
Tenebris Lake
Killings In Altstadt

10-28-2011, 03:16 PM
Find




Users browsing this thread: 1 Guest(s)