Frictional Games Forum (read-only)

Full Version: New Question: How to create a door
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8
write the script under the same one. there can never be 2 functions of the same name, and the OnStart() function is played when you first enter the map.
(06-21-2012, 07:47 PM)FastHunteR Wrote: [ -> ]write the script under the same one. there can never be 2 functions of the same name, and the OnStart() function is played when you first enter the map.
I can't get the script to work :/
I tried already to solve it, but no clue.
The FATAL ERROR is attached and here is the whole script:

Quote:void OnStart()
{
AddUseItemCallback("", "stone_hammer_1", "shelf", "DestroyShelf", true);
}
void DestroyShelf(string &in asItem, string &in asEntity)
{
//Do your stuff, whatever you want to do, here. Example:
FadeOut(2);
AddTimer("Timer_1", 2, "PlaySound");
}
void PlaySound(string &in asTimer)
{
PlaySoundAtEntity("", "break_wood.snt", "shelf", 0, false);
SetEntityActive("shelf", false);
SetEntityActive("book_row02_1", false);
SetEntityActive("book_row01_2", false);
SetEntityActive("book_pile01_1", false);
SetEntityActive("candlestick01_4", false);
SetEntityActive("book_row03_1", false);
SetEntityActive("book_open_1", false);
SetEntityActive("book_row02_2", false);
SetEntityActive("book_pile02_1", false);
SetEntityActive("book_pile01_2", false);
SetEntityActive("book_row02_3", false);
SetEntityActive("candlestick01_2", false);
SetEntityActive("candlestick01_3", false);
AddTimer("Timer_2", 1, "FadeInFunction");
}
void FadeInFunction(string &in asTimer)
{
FadeIn(2);
}
{
AddEntityCollideCallback("Player", "cavein_area", "cavein_function", true, 1);
void cavein_function(string &in asParent, string &in asChild, int alState)
AddTimer("Timer_1", 2, "PlaySound");
}
void PlaySound(string &in asTimer)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "cave_in_1", 0, false);
SetEntityActive("cave_in_1", true);
}
void FadeInFunction(string &in asTimer)
{
FadeIn(2);
}
{
AddEntityCollideCallback("Player", "cavein_area", "cavein_function", true, 1);
void cavein_function(string &in asParent, string &in asChild, int alState)
AddTimer("Timer_1", 2, "PlaySound");
}
no initiated function, nothing is doing those last 3 rows.
take the AddEntityCollideCallback("Player", "cavein_area", "cavein_function", true, 1);
and put it into OnStart()
I'll correct and post the whole script for you:
void OnStart()
{
AddUseItemCallback("", "stone_hammer_1", "shelf", "DestroyShelf", true);
AddEntityCollideCallback("Player", "cavein_area", "cavein_function", true, 1);
}
void DestroyShelf(string &in asItem, string &in asEntity)
{
//Do your stuff, whatever you want to do, here. Example:
FadeOut(2);
AddTimer("Timer_1", 2, "PlaySound");
}
void PlaySound(string &in asTimer)
{
PlaySoundAtEntity("", "break_wood.snt", "shelf", 0, false);
SetEntityActive("shelf", false);
SetEntityActive("book_row02_1", false);
SetEntityActive("book_row01_2", false);
SetEntityActive("book_pile01_1", false);
SetEntityActive("candlestick01_4", false);
SetEntityActive("book_row03_1", false);
SetEntityActive("book_open_1", false);
SetEntityActive("book_row02_2", false);
SetEntityActive("book_pile02_1", false);
SetEntityActive("book_pile01_2", false);
SetEntityActive("book_row02_3", false);
SetEntityActive("candlestick01_2", false);
SetEntityActive("candlestick01_3", false);
AddTimer("Timer_2", 1, "FadeInFunction");
}
void FadeInFunction(string &in asTimer)
{
FadeIn(2);
}

void cavein_function(string &in asParent, string &in asChild, int alState)
{
AddTimer("Timer_1", 2, "PlaySound");
}
void PlaySound(string &in asTimer)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "cave_in_1", 0, false);
SetEntityActive("cave_in_1", true);
}

By the way, you maybe want to play the cave in sound at yourself, since if that cave in is too far away, you won't hear it. Putting the sound by you, you hear it like if it's a huge explosion/cave in
(06-21-2012, 09:28 PM)FastHunteR Wrote: [ -> ]void FadeInFunction(string &in asTimer)
{
FadeIn(2);
}
{
AddEntityCollideCallback("Player", "cavein_area", "cavein_function", true, 1);
void cavein_function(string &in asParent, string &in asChild, int alState)
AddTimer("Timer_1", 2, "PlaySound");
}
no initiated function, nothing is doing those last 3 rows.
take the AddEntityCollideCallback("Player", "cavein_area", "cavein_function", true, 1);
and put it into OnStart()
I'll correct and post the whole script for you:
void OnStart()
{
AddUseItemCallback("", "stone_hammer_1", "shelf", "DestroyShelf", true);
AddEntityCollideCallback("Player", "cavein_area", "cavein_function", true, 1);
}
void DestroyShelf(string &in asItem, string &in asEntity)
{
//Do your stuff, whatever you want to do, here. Example:
FadeOut(2);
AddTimer("Timer_1", 2, "PlaySound");
}
void PlaySound(string &in asTimer)
{
PlaySoundAtEntity("", "break_wood.snt", "shelf", 0, false);
SetEntityActive("shelf", false);
SetEntityActive("book_row02_1", false);
SetEntityActive("book_row01_2", false);
SetEntityActive("book_pile01_1", false);
SetEntityActive("candlestick01_4", false);
SetEntityActive("book_row03_1", false);
SetEntityActive("book_open_1", false);
SetEntityActive("book_row02_2", false);
SetEntityActive("book_pile02_1", false);
SetEntityActive("book_pile01_2", false);
SetEntityActive("book_row02_3", false);
SetEntityActive("candlestick01_2", false);
SetEntityActive("candlestick01_3", false);
AddTimer("Timer_2", 1, "FadeInFunction");
}
void FadeInFunction(string &in asTimer)
{
FadeIn(2);
}

void cavein_function(string &in asParent, string &in asChild, int alState)
{
AddTimer("Timer_1", 2, "PlaySound");
}
void PlaySound(string &in asTimer)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "cave_in_1", 0, false);
SetEntityActive("cave_in_1", true);
}

By the way, you maybe want to play the cave in sound at yourself, since if that cave in is too far away, you won't hear it. Putting the sound by you, you hear it like if it's a huge explosion/cave in

It gives another FATAL ERROR.
It is attached.
oh, i didn't see that one.
at the very last function, change its name to something else than PlaySound, since it already exists a bit up. Also, change the timer right above it to its name.
(06-21-2012, 09:59 PM)FastHunteR Wrote: [ -> ]oh, i didn't see that one.
at the very last function, change its name to something else than PlaySound, since it already exists a bit up. Also, change the timer right above it to its name.
It's now working Smile
I saw in the Engine scripts a command to create particle systems at entities.
I used it at the end of the script, you'll see it easily.
It is giving me a error. Other thing I wanted to do, if the particle system doesn't work, was making the player not able to move while it fades out and in, otherwise he can pass through the cave in before it appears :/

Here's the script:
Quote:void OnStart()
{
AddUseItemCallback("", "stone_hammer_1", "shelf", "DestroyShelf", true);
AddEntityCollideCallback("Player", "cavein_area", "cavein_function", true, 1);
}
void DestroyShelf(string &in asItem, string &in asEntity)
{
//Do your stuff, whatever you want to do, here. Example:
FadeOut(2);
AddTimer("Timer_1", 2, "PlaySound");
}
void PlaySound(string &in asTimer)
{
PlaySoundAtEntity("", "break_wood.snt", "shelf", 0, false);
SetEntityActive("shelf", false);
SetEntityActive("book_row02_1", false);
SetEntityActive("book_row01_2", false);
SetEntityActive("book_pile01_1", false);
SetEntityActive("candlestick01_4", false);
SetEntityActive("book_row03_1", false);
SetEntityActive("book_open_1", false);
SetEntityActive("book_row02_2", false);
SetEntityActive("book_pile02_1", false);
SetEntityActive("book_pile01_2", false);
SetEntityActive("book_row02_3", false);
SetEntityActive("candlestick01_2", false);
SetEntityActive("candlestick01_3", false);
AddTimer("Timer_2", 1, "FadeInFunction");
}
void FadeInFunction(string &in asTimer)
{
FadeIn(2);
}

void cavein_function(string &in asParent, string &in asChild, int alState)
void CreateParticleSystemAtEntity(string& "ParticleSystem_1", string& "ps_break_cavein", string& "cave_in_1", bool abSavePS);
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "cave_in_1", 0, false);
SetEntityActive("cave_in_1", true);
SetEntityActive("cave_in_2", true);
}
you don't need string& when they aren't callback syntax functions.
Also, do it under the cavein_function, since you want it to happen at the same time, also, by your move there, you got a function with nothing to do.
delete everything from cavein_function on and paste this:
void cavein_function(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "cave_in_1", 0, false);
SetEntityActive("cave_in_1", true);
SetEntityActive("cave_in_2", true);
CreateParticleSystemAtEntity("ParticleSystem_1", "ps_break_cavein.ps", "cave_in_1", false);
}
(06-22-2012, 12:42 PM)FastHunteR Wrote: [ -> ]you don't need string& when they aren't callback syntax functions.
Also, do it under the cavein_function, since you want it to happen at the same time, also, by your move there, you got a function with nothing to do.
delete everything from cavein_function on and paste this:
void cavein_function(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "explosion_rock_large.snt", "cave_in_1", 0, false);
SetEntityActive("cave_in_1", true);
SetEntityActive("cave_in_2", true);
CreateParticleSystemAtEntity("ParticleSystem_1", "ps_break_cavein.ps", "cave_in_1", false);
}
Thank you so much for all your help!
First room is finished Smile

+1 Rep

EDIT:
You know that tunnel that has 2 ways? Where can I find it and how can I put it in the middle of a wall? Because I wouldn't be able to enter the tunnel because the wall would be blocking the entrance.
Do I have to edit the wall and make a hole on it?
There is only 1 thing you could probably do except designing your own tunnel:
the "2" way tunnel is under static object>tunnelbase.
But since 1 way is blocked and the entrance is either through the wall or the top, there is only 1 way. The wall fitting to the hole is already attached.
One more thing you could probably do is somehow import one of those spider tunnels in penumbra:overture, but no idea on that one.
(06-23-2012, 11:48 PM)FastHunteR Wrote: [ -> ]There is only 1 thing you could probably do except designing your own tunnel:
the "2" way tunnel is under static object>tunnelbase.
But since 1 way is blocked and the entrance is either through the wall or the top, there is only 1 way. The wall fitting to the hole is already attached.
One more thing you could probably do is somehow import one of those spider tunnels in penumbra:overture, but no idea on that one.


Thanks once again Smile
There is only one problem, the hole is attached to the Castle wall, and Im using Mansionbase > Default, the white wall. Is there anyway to change it? I went to Model Editor, choosed Import Mesh (cause I cant open static objects) and tried to change the texture of the wall, but the changed texture looks so weird. It doesnt fit :/ I tried to make a hole in the normal white wall, but it always looks weird (I tried to make the hole by placing several walls leaving a space in the middle. Is there anyway I can make the wall that is attached to the tunnel entrance look like the normal white wall from the mansionbase?
Pages: 1 2 3 4 5 6 7 8