Frictional Games Forum (read-only)
I need help with creating more than 1 scripts for my custom story - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: I need help with creating more than 1 scripts for my custom story (/thread-18533.html)

Pages: 1 2


I need help with creating more than 1 scripts for my custom story - ironman0001 - 09-27-2012

I am new to scripting and this is my first custom story! i know each script needs a void but i don't know what void to add! besides void onstart and onenter and onleave But i wanna create a bunch of scripts and iv'e seen scripts that had more than just those! Here is my script so far void OnStart()
{
AddEntityCollideCallback("Player", "TeleportScript", "PoopedYaPants", true, 1);
}

void PoopedYaPants(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus", true);
AddPropForce("Jesus", 0, 0, 10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "Jesus", 0, false);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void OnEnter()
{
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}


void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup1", 0); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);.
}

I want a message to pop up as soon as you spawn! Then when you go down stairs, A dead guy teleports and flies in your face! Big Grin Can i replace void OnEnter with anything?


RE: I need help with creating more than 1 scripts for my custom story - i3670 - 09-28-2012

Why would you need any more than OnStart, OnEnter and OnLeave? They pretty much cover all you need.

As for the "message pop-up" just put the ShowMessage in the OnStart


RE: I need help with creating more than 1 scripts for my custom story - ironman0001 - 09-28-2012

(09-28-2012, 12:55 AM)i3670 Wrote: Why would you need any more than OnStart, OnEnter and OnLeave? They pretty much cover all you need.

As for the "message pop-up" just put the ShowMessage in the OnStart
Cause those aren't the only two i'm adding! And put "ShowMessage" in the OnStart? Where on it? In between ()?


RE: I need help with creating more than 1 scripts for my custom story - Statyk - 09-28-2012

Have you looked at other scripts to get an idea of how they work? It may help a bit.


RE: I need help with creating more than 1 scripts for my custom story - ironman0001 - 09-28-2012

(09-28-2012, 03:58 AM)Statyk Wrote: Have you looked at other scripts to get an idea of how they work? It may help a bit.
Yeah, But it's pretty confusing though


RE: I need help with creating more than 1 scripts for my custom story - Statyk - 09-28-2012

Have it like this:

void OnStart()
{
AddEntityCollideCallback("Player", "TeleportScript", "PoopedYaPants", true, 1);
SetMessage("Messages", "Popup1", 0);
}

void PoopedYaPants(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus", true);
AddPropForce("Jesus", 0, 0, 10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "Jesus", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void OnEnter()
{
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}


RE: I need help with creating more than 1 scripts for my custom story - ironman0001 - 09-28-2012

(09-28-2012, 04:20 AM)Statyk Wrote: Have it like this:

void OnStart()
{
AddEntityCollideCallback("Player", "TeleportScript", "PoopedYaPants", true, 1);
SetMessage("Messages", "Popup1", 0);
}

void PoopedYaPants(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus", true);
AddPropForce("Jesus", 0, 0, 10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "Jesus", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void OnEnter()
{
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
Thanks for the help! But how do i know how to do that for when i wanna create more scripts?


RE: I need help with creating more than 1 scripts for my custom story - Statyk - 09-28-2012

depends if you want it to happen when you walk into a script area or a timer. Read up on the wiki. should help =]

http://wiki.frictionalgames.com/hpl2/amnesia/start

Tabs on the left should help you with what you're looking for.


RE: I need help with creating more than 1 scripts for my custom story - ironman0001 - 09-28-2012

(09-28-2012, 04:47 AM)Statyk Wrote: depends if you want it to happen when you walk into a script area or a timer. Read up on the wiki. should help =]

http://wiki.frictionalgames.com/hpl2/amnesia/start

Tabs on the left should help you with what you're looking for.
But they would all say void OnStart () At the beginning... But if i wanna make alot of scripts, I can't keep using void onstart...


RE: I need help with creating more than 1 scripts for my custom story - Statyk - 09-28-2012

No, all your scripts start from there. You should never have more than one OnStart, OnLeave, or OnEnter.