Xallikk
Junior Member
Posts: 35
Threads: 7
Joined: Jun 2016
Reputation:
0
|
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 |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
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:
void OnStart() { SetEntityCollideCallback("Player", "scr_rockfall", "rockfall_1", true, 1); }
void rockfall_1(string &in asParent, string &in asChild, int 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.
Discord: Romulator#0001
(This post was last modified: 06-06-2016, 06:26 AM by Romulator.)
|
|
06-06-2016, 06:16 AM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Trigger Cave In
Don't forget to add sounds and particles on top of this. That will make a huge difference
|
|
06-06-2016, 08:08 AM |
|
Xallikk
Junior Member
Posts: 35
Threads: 7
Joined: Jun 2016
Reputation:
0
|
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 |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
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:
void CreateParticleSystemAtEntity(string& asPSName, string& asPSFile, string& asEntity, bool 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
|
|
06-07-2016, 08:06 AM |
|
Xallikk
Junior Member
Posts: 35
Threads: 7
Joined: Jun 2016
Reputation:
0
|
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 |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
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.
void Function(int parameter) { }
This is a function call. You use it to call the function above within some other function, like OnStart().
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:
void CreateParticleSystemAtEntity(string& asPSName, string& asPSFile, string& asEntity, bool abSavePS);
And so you must call this function using something that satisfies the parameters it asks for. Like so:
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 |
|
Xallikk
Junior Member
Posts: 35
Threads: 7
Joined: Jun 2016
Reputation:
0
|
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 |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
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
(This post was last modified: 06-09-2016, 07:15 AM by Romulator.)
|
|
06-09-2016, 07:14 AM |
|
|