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
Trigger Cave In
Xallikk Offline
Junior Member

Posts: 35
Threads: 7
Joined: Jun 2016
Reputation: 0
#1
Trigger Cave In

Last one I promise. Is there any way without any custom stuff to create a rock fall cave in after the player walks through a script area?

The ones at the front always die first...
06-06-2016, 05:29 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Trigger Cave In

There are two cave in entities, if I recall. One should be in the ptest folder, and another might be in gameplay. If the player isn't looking at them, you could simply just spawn one behind or in front of the player using SetEntityActive(); after walking through a ScriptArea.

If you need to make one which is a bit more realistic, but won't cause a cave in, spawn a few small rocks using SetEntityActive(), and use a timer to call various ones to fall shortly after. Something like this for example:

PHP Code: (Select All)
void OnStart()
{
    
SetEntityCollideCallback("Player""scr_rockfall""rockfall_1"true1);
}

void rockfall_1(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("rock_small_1"true);
    
SetEntityActive("rock_small_2"true);
    
//repeat
    
AddTimer(""2.5f"rockfall_2");
}

void rockfall_2(string &in asTimer)
{
    
SetEntityActive("rock_medium_1"true);
    
//blah blah, add another timer if necessary.


You can use For-Next Loops here too to make your code look at little nicer.

You could also use the latter to make it seem like there may be a cave in. Think about it and try to improve on it, since it could be used as a clever fear factor and feature to cause a bit of subtle and suggestive scare. Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 06-06-2016, 06:26 AM by Romulator.)
06-06-2016, 06:16 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Trigger Cave In

Don't forget to add sounds and particles on top of this. That will make a huge difference Tongue

06-06-2016, 08:08 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: Trigger Cave In

(06-06-2016, 08:08 AM)Mudbill Wrote: Don't forget to add sounds and particles on top of this. That will make a huge difference Tongue

Indeed! Consider also looking at the level where the Kaernk (Water Monster) is chasing you. There is a section where the pathway forks, and whichever path you take causes a cave in. There might be some hints in the mapping there, as well as in script, for what you can do to make a pretty realistic cave in Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
06-06-2016, 05:02 PM
Find
Xallikk Offline
Junior Member

Posts: 35
Threads: 7
Joined: Jun 2016
Reputation: 0
#5
RE: Trigger Cave In

Well, there's a cave in static object, is there any way to convert that to an entity so I can use it?

Ah, found the entity version yayay

How would I generate smoke, or dust from the rock fall? I can't see it anywhere.

The ones at the front always die first...
(This post was last modified: 06-07-2016, 04:52 AM by Xallikk.)
06-07-2016, 04:21 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#6
RE: Trigger Cave In

(06-07-2016, 04:21 AM)Xallikk Wrote: How would I generate smoke, or dust from the rock fall? I can't see it anywhere.

Create one, or a few, small script areas around where the rock fall occurs, and when the cave in happens, use this:

PHP Code: (Select All)
void CreateParticleSystemAtEntity(stringasPSNamestringasPSFilestringasEntitybool abSavePS); 

Creates a particle system on an entity.

asPSName - internal name
asPSFile - the particle system to use + extension .ps
asEntity - the entity to create the particle system at
abSavePS - determines whether a particle system should “remember” its shown/hidden state, so that this state can be restored when the player revisits the level

You can view what the Particle Effects do using the Particle Viewer, or placing them in the Level Editor. Keep in mind that some of them will loop, and some of them do not. Your Entity will be the ScriptArea, and false for the last value.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
06-07-2016, 08:06 AM
Find
Xallikk Offline
Junior Member

Posts: 35
Threads: 7
Joined: Jun 2016
Reputation: 0
#7
RE: Trigger Cave In

Are they all separate? Like:

void CreateParticleSystemAtEntity("rocksmoke1", "ps_impact_dust_high.ps", "rocksmoke_1", false);
{
}
void CreateParticleSystemAtEntity("rocksmoke2", "ps_impact_dust_high.ps", "rocksmoke_2", false);
{
}

The ones at the front always die first...
06-07-2016, 09:40 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
RE: Trigger Cave In

There's a difference between a constructor and a function call. You use a function call to call a function using its constructor, but they are different.

This is a function. The first line is called the constructor of that function.
PHP Code: (Select All)
void Function(int parameter
{


This is a function call. You use it to call the function above within some other function, like OnStart().
PHP Code: (Select All)
Function(1); 

The constructor tells the code which parameters it wants, and the call must then satisfy those parameters. So "int parameter" changes into '1' in the call because int is a numerical variable. If it had said (string parameter), then you'd need to input Function("SomeText"); instead.

So to put this into your situation. This is the constructor:
PHP Code: (Select All)
void CreateParticleSystemAtEntity(stringasPSNamestringasPSFilestringasEntitybool abSavePS); 

And so you must call this function using something that satisfies the parameters it asks for. Like so:
PHP Code: (Select All)
CreateParticleSystemAtEntity("rocksmoke2""ps_impact_dust_high.ps""rocksmoke_2"false); 

That line can be called within your existing script to create this particle system.

Hope you understand this. To anyone else, if anything I said is incorrect, please tell me.

(This post was last modified: 06-07-2016, 11:10 PM by Mudbill.)
06-07-2016, 10:58 PM
Find
Xallikk Offline
Junior Member

Posts: 35
Threads: 7
Joined: Jun 2016
Reputation: 0
#9
RE: Trigger Cave In

I got it all to work, but now I want to make subtitles when the cave in event happens. The script I have isn't working for it. THe game works but no subtitles. The sound "OutroSound" is a silent 10 second ogg, if that matters at all.
void OnStart()
{
AddTimer("scare", 3, "TimerPlayerReact");
AddTimer("breath", 4.5, "TimerPlayerReact");
AddTimer("breath", 6.5, "TimerPlayerReact");
AddTimer("saw3", 12, "TimerTorture");
AddTimer("saw_voice3", 11, "TimerTorture");
AddEntityCollideCallback("Player", "kista1", "kista1", true, 1);
AddEntityCollideCallback("Player", "scr_rockfall", "rockfall_1", true, 1);
AddEntityCollideCallback("Player", "scr_rockfall", "subtitles", true, 1);
}

void subtitles(string &in asParent, string &in asChild, int alState)
{
AddEffectVoice("OutroSound", "", "Subtitles", "LastWords", true, "Player", 5, 10);
}
void rockfall_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("CaveIn", true);
CreateParticleSystemAtEntity("rocksmoke1", "ps_impact_dust_high.ps", "rocksmoke_1", false);
CreateParticleSystemAtEntity("rocksmoke2", "ps_impact_dust_high.ps", "rocksmoke_2", false);
CreateParticleSystemAtEntity("rocksmoke3", "ps_impact_dust_high.ps", "rocksmoke_3", false);
CreateParticleSystemAtEntity("rocksmoke4", "ps_impact_dust_high.ps", "rocksmoke_4", false);
CreateParticleSystemAtEntity("rocksmoke5", "ps_impact_dust_high.ps", "rocksmoke_5", false);
CreateParticleSystemAtEntity("rocksmoke6", "ps_impact_dust_high.ps", "rocksmoke_6", false);
CreateParticleSystemAtEntity("rocksmoke7", "ps_impact_dust_high.ps", "rocksmoke_7", false);
PlaySoundAtEntity("cavein", "explosion_rock_large.snt", "Player", 0.01f, false);
AddTimer("TimerEndGame", 15, "Exit");
}

void Exit(string &in asEntity)
{
FadeOut(1);
StartCredits("OutroTheme.ogg", false, "Credits", "Ending", 3);
}
void kista1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("maidenopen", true);
SetEntityActive("maidenclosed", false);
CreateParticleSystemAtEntity("", "ps_iron_maiden_event_smoke.ps", "ScriptArea_1", false);
PlaySoundAtEntity("maidenopen", "24_iron_maiden", "maidenopen", 0, false);
StartScreenShake(0.3, 0.3, 0, 0.3);
AddPlayerSanity(-10);
}

void TimerPlayerReact(string &in asTimer)
{
PlayGuiSound("react_" + asTimer, 0.6);
}

void TimerTorture(string &in asTimer)
{
PlayGuiSound("23_" + asTimer, 0.6);
}

The ones at the front always die first...
(This post was last modified: 06-09-2016, 02:35 AM by Xallikk.)
06-09-2016, 02:34 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#10
RE: Trigger Cave In

Have you got a language entry in your extra_english.lang which can be used for the Credits? Do all your other language entries also work?

<CATEGORY Name="Credits">
<Entry Name="Ending">These are my credits.</Entry>
</CATEGORY>

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 06-09-2016, 07:15 AM by Romulator.)
06-09-2016, 07:14 AM
Find




Users browsing this thread: 1 Guest(s)