Frictional Games Forum

Full Version: Activate intro on Scriptarea
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay, so i'd like to say right of the bat that i'm absolutely horrid at scripting. YOU'VE BEEN WARNED!

Okay, so in my custom story i've created a road, and i've created a scriptarea at the end of the road. What I want is that as soon as the player walks on that scriptarea the screen fades out and starts the intro of my custom story.

My question is: How do I make it that when you walk over the scriptarea the intro starts
(I already have a full functioning intro script, but i'm only missing the scriptarea trigger script thingy)

I've checked the Scripting page and I found things such as "AddEntityCollideCallback". I was wondering if that'll do the trick?

Let me know!

Yep, an AddEntityCollideCallback is what you want:

AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)

asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both

So based on this, we can make one.

The parent is the Player, so we use "Player".
The child is what the Player collides with, so the name of your Script Area.
The function is the name of the function. For now, let's call it IntroFunc.
We delete on collide because this happens once, so True.
It happens when we enter, so the alState will be 1.

Thus, we put this information into OnStart() in our hps file.
PHP Code:
void OnStart()

And the Function name will be IntroFunc, which we also apply to our Callback Syntax (see the code snippet above). Then we get this:

PHP Code:
void IntroFunc(string &in asParentstring &in asChildint alState)
//Intro script

And that's it! Just put whatever you want to happen in the intro between the Braces of the IntroFunc.

Thus, we get a code block which looks like this:

PHP Code:
void OnStart()

void IntroFunc(string &in asParentstring &in asChildint alState)
//Intro script

Just make sure the "ScriptArea" line in the AddEntityCollideCallback matches your Script Area name which you have defined in the Level Editor!
I know I'm saying this for hundredth time and some people prolly get bored of this, but if you have no idea what scripting is about, go and watch some Youtube tutorials (Mudbill's ?).
Then, when you know the basic stuff, come back to ask and learn new things Smile

Intros require quite lot of work, depending on what you want to include; banners, recordings or player walking by themself.

Ps. Sorry for not saying anything about your problem, but Romulator pretty much answered your question Wink